xusenlin commited on
Commit
3c58784
1 Parent(s): 8312e1f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -15
README.md CHANGED
@@ -22,31 +22,47 @@ license: apache-2.0
22
  ## 使用方法
23
 
24
  ```commandline
25
- pip install lightningnlp
26
  ```
27
 
28
  ```python
29
  from pprint import pprint
30
- from lightningnlp.task.uie import UIEPredictor
31
 
32
  # 实体识别
33
  schema = ['时间', '选手', '赛事名称']
34
- uie = UIEPredictor("xusenlin/uie-base", schema=schema)
35
  pprint(uie("2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷爱凌以188.25分获得金牌!")) # Better print results using pprint
36
 
37
  # 输出
38
- [{'时间': [{'end': 6,
39
- 'probability': 0.9857378532924486,
40
- 'start': 0,
41
- 'text': '2月8日上午'}],
42
- '赛事名称': [{'end': 23,
43
- 'probability': 0.8503089953268272,
44
- 'start': 6,
45
- 'text': '北京冬奥会自由式滑雪女子大跳台决赛'}],
46
- '选手': [{'end': 31,
47
- 'probability': 0.8981548639781138,
48
- 'start': 28,
49
- 'text': '谷爱凌'}]}]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  ```
51
 
52
  ## 参考链接
 
22
  ## 使用方法
23
 
24
  ```commandline
25
+ pip install litie
26
  ```
27
 
28
  ```python
29
  from pprint import pprint
30
+ from litie.pipelines import UIEPipeline
31
 
32
  # 实体识别
33
  schema = ['时间', '选手', '赛事名称']
34
+ uie = UIEPipeline("xusenlin/uie-base", schema=schema)
35
  pprint(uie("2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷爱凌以188.25分获得金牌!")) # Better print results using pprint
36
 
37
  # 输出
38
+ [
39
+ {
40
+ "时间": [
41
+ {
42
+ "end": 6,
43
+ "probability": 0.98573786,
44
+ "start": 0,
45
+ "text": "2月8日上午"
46
+ }
47
+ ],
48
+ "赛事名称": [
49
+ {
50
+ "end": 23,
51
+ "probability": 0.8503085,
52
+ "start": 6,
53
+ "text": "北京冬奥会自由式滑雪女子大跳台决赛"
54
+ }
55
+ ],
56
+ "选手": [
57
+ {
58
+ "end": 31,
59
+ "probability": 0.8981544,
60
+ "start": 28,
61
+ "text": "谷爱凌"
62
+ }
63
+ ]
64
+ }
65
+ ]
66
  ```
67
 
68
  ## 参考链接