wjn1996 commited on
Commit
b9735e7
·
1 Parent(s): 3fca638

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +39 -39
README.md CHANGED
@@ -12,45 +12,45 @@ license: apache-2.0
12
 
13
  ```python
14
  from applications.information_extraction.HugIE.api_test import HugIEAPI
15
- model_type = 'bert'
16
- hugie_model_name_or_path = 'wjn1996/wjn1996-hugnlp-hugie-large-zh'
17
- hugie = HugIEAPI('bert', hugie_model_name_or_path)
18
- text = "央广网北京2月23日消息 据中国地震台网正式测定,2月23日8时37分在塔吉克斯坦发生7.2级地震,震源深度10公里,震中位于北纬37.98度,东经73.29度,距我国边境线最近约82公里,地震造成新疆喀什等地震感强烈。"
19
-
20
- entity = "塔吉克斯坦地震"
21
- relation = "震源位置"
22
- predictions, topk_predictions = hugie.request(text, entity, relation=relation)
23
- print("entity:{}, relation:{}".format(entity, relation))
24
- print("predictions:\n{}".format(predictions))
25
- print("topk_predictions:\n{}".format(predictions))
26
- print("\n\n")
27
-
28
- """
29
- # 实体识别输出结果:
30
- entity:塔吉克斯坦地震, relation:震源位置
31
- predictions:
32
- {0: ['10公里', '距我国边境线最近约82公里', '北纬37.98度,东经73.29度', '北纬37.98度,东经73.29度,距我国边境线最近约82公里']}
33
- topk_predictions:
34
- {0: [{'answer': '10公里', 'prob': 0.9895901083946228, 'pos': [(80, 84)]}, {'answer': '距我国边境线最近约82公里', 'prob': 0.8584909439086914, 'pos': [(107, 120)]}, {'answer': '北纬37.98度,东经73.29度', 'prob': 0.7202121615409851, 'pos': [(89, 106)]}, {'answer': '北纬37.98度,东经73.29度,距我国边境线最近约82公里', 'prob': 0.11628123372793198, 'pos': [(89, 120)]}]}
35
- """
36
-
37
-
38
- entity = "塔吉克斯坦地震"
39
- relation = "时间"
40
- predictions, topk_predictions = hugie.request(text, entity, relation=relation)
41
- print("entity:{}, relation:{}".format(entity, relation))
42
- print("predictions:\n{}".format(predictions))
43
- print("topk_predictions:\n{}".format(predictions))
44
- print("\n\n")
45
-
46
- """
47
- # 事件信息输出结果:
48
- entity:塔吉克斯坦地震, relation:时间
49
- predictions:
50
- {0: ['2月23日8时37分']}
51
- topk_predictions:
52
- {0: [{'answer': '2月23日8时37分', 'prob': 0.9999995231628418, 'pos': [(49, 59)]}]}
53
- """
54
  ```
55
 
56
  ---
 
12
 
13
  ```python
14
  from applications.information_extraction.HugIE.api_test import HugIEAPI
15
+ model_type = 'bert'
16
+ hugie_model_name_or_path = 'wjn1996/wjn1996-hugnlp-hugie-large-zh'
17
+ hugie = HugIEAPI('bert', hugie_model_name_or_path)
18
+ text = "央广网北京2月23日消息 据中国地震台网正式测定,2月23日8时37分在塔吉克斯坦发生7.2级地震,震源深度10公里,震中位于北纬37.98度,东经73.29度,距我国边境线最近约82公里,地震造成新疆喀什等地震感强烈。"
19
+
20
+ entity = "塔吉克斯坦地震"
21
+ relation = "震源位置"
22
+ predictions, topk_predictions = hugie.request(text, entity, relation=relation)
23
+ print("entity:{}, relation:{}".format(entity, relation))
24
+ print("predictions:\n{}".format(predictions))
25
+ print("topk_predictions:\n{}".format(predictions))
26
+ print("\n\n")
27
+
28
+ """
29
+ # 实体识别输出结果:
30
+ entity:塔吉克斯坦地震, relation:震源位置
31
+ predictions:
32
+ {0: ['10公里', '距我国边境线最近约82公里', '北纬37.98度,东经73.29度', '北纬37.98度,东经73.29度,距我国边境线最近约82公里']}
33
+ topk_predictions:
34
+ {0: [{'answer': '10公里', 'prob': 0.9895901083946228, 'pos': [(80, 84)]}, {'answer': '距我国边境线最近约82公里', 'prob': 0.8584909439086914, 'pos': [(107, 120)]}, {'answer': '北纬37.98度,东经73.29度', 'prob': 0.7202121615409851, 'pos': [(89, 106)]}, {'answer': '北纬37.98度,东经73.29度,距我国边境线最近约82公里', 'prob': 0.11628123372793198, 'pos': [(89, 120)]}]}
35
+ """
36
+
37
+
38
+ entity = "塔吉克斯坦地震"
39
+ relation = "时间"
40
+ predictions, topk_predictions = hugie.request(text, entity, relation=relation)
41
+ print("entity:{}, relation:{}".format(entity, relation))
42
+ print("predictions:\n{}".format(predictions))
43
+ print("topk_predictions:\n{}".format(predictions))
44
+ print("\n\n")
45
+
46
+ """
47
+ # 事件信息输出结果:
48
+ entity:塔吉克斯坦地震, relation:时间
49
+ predictions:
50
+ {0: ['2月23日8时37分']}
51
+ topk_predictions:
52
+ {0: [{'answer': '2月23日8时37分', 'prob': 0.9999995231628418, 'pos': [(49, 59)]}]}
53
+ """
54
  ```
55
 
56
  ---