Update README.md
Browse files
README.md
CHANGED
@@ -22,31 +22,47 @@ license: apache-2.0
|
|
22 |
## 使用方法
|
23 |
|
24 |
```commandline
|
25 |
-
pip install
|
26 |
```
|
27 |
|
28 |
```python
|
29 |
from pprint import pprint
|
30 |
-
from
|
31 |
|
32 |
# 实体识别
|
33 |
schema = ['时间', '选手', '赛事名称']
|
34 |
-
uie =
|
35 |
pprint(uie("2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷爱凌以188.25分获得金牌!")) # Better print results using pprint
|
36 |
|
37 |
# 输出
|
38 |
-
[
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
## 参考链接
|