Update README.md
Browse files
README.md
CHANGED
@@ -42,10 +42,48 @@ pip install --editable .
|
|
42 |
```
|
43 |
|
44 |
|
45 |
-
```
|
|
|
46 |
import argparse
|
47 |
-
from fengshen import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
|
|
|
|
49 |
|
50 |
```
|
51 |
|
|
|
42 |
```
|
43 |
|
44 |
|
45 |
+
```python
|
46 |
+
|
47 |
import argparse
|
48 |
+
from fengshen.pipelines.information_extraction import UniEXPipelines
|
49 |
+
|
50 |
+
total_parser = argparse.ArgumentParser("TASK NAME")
|
51 |
+
total_parser = UniEXPipelines.pipelines_args(total_parser)
|
52 |
+
args = total_parser.parse_args()
|
53 |
+
|
54 |
+
args.pretrained_model_path = 'IDEA-CCNL/Erlangshen-UniEX-RoBERTa-110M-Chinese'
|
55 |
+
|
56 |
+
args.threshold_index = 0.5 # 设置位置识别的概率阈值
|
57 |
+
args.threshold_entity = 0.5 # 设置实体类型的概率阈值
|
58 |
+
args.threshold_event = 0.5 # 设置事件类型的概率阈值
|
59 |
+
args.threshold_relation = 0.5 # 设置关系类型的概率阈值
|
60 |
+
|
61 |
+
model = UniEXPipelines(args)
|
62 |
+
train_data = []
|
63 |
+
dev_data = []
|
64 |
+
test_data = [
|
65 |
+
{
|
66 |
+
"task_type": "实体识别",
|
67 |
+
"text": "彭小军认为,国内银行现在走的是台湾的发卡模式,先通过跑马圈地再在圈的地里面选择客户,",
|
68 |
+
"entity_list": [],
|
69 |
+
"choice": [
|
70 |
+
"姓名",
|
71 |
+
"地址",
|
72 |
+
"组织机构",
|
73 |
+
"游戏",
|
74 |
+
"景点",
|
75 |
+
"书名",
|
76 |
+
"职位",
|
77 |
+
"公司",
|
78 |
+
"政府",
|
79 |
+
"电影"
|
80 |
+
],
|
81 |
+
"id": 0
|
82 |
+
}
|
83 |
+
]
|
84 |
|
85 |
+
result = model.predict(test_data,cuda=False)
|
86 |
+
print(result)
|
87 |
|
88 |
```
|
89 |
|