Update README.md
Browse files
README.md
CHANGED
|
@@ -21,14 +21,40 @@ metrics:
|
|
| 21 |
## 使用方法
|
| 22 |
|
| 23 |
```commandline
|
| 24 |
-
pip install
|
| 25 |
```
|
| 26 |
|
| 27 |
```python
|
| 28 |
from pprint import pprint
|
| 29 |
-
from
|
| 30 |
|
| 31 |
-
|
| 32 |
text = "查尔斯·阿兰基斯(Charles Aránguiz),1989年4月17日出生于智利圣地亚哥,智利职业足球运动员,司职中场,效力于德国足球甲级联赛勒沃库森足球俱乐部。"
|
| 33 |
-
pprint(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
```
|
|
|
|
|
|
|
|
|
| 21 |
## 使用方法
|
| 22 |
|
| 23 |
```commandline
|
| 24 |
+
pip install litie
|
| 25 |
```
|
| 26 |
|
| 27 |
```python
|
| 28 |
from pprint import pprint
|
| 29 |
+
from litie.pipelines import RelationExtractionPipeline
|
| 30 |
|
| 31 |
+
pipeline = RelationExtractionPipeline("gplinker", model_name_or_path="xusenlin/duie-gplinker", model_type="bert")
|
| 32 |
text = "查尔斯·阿兰基斯(Charles Aránguiz),1989年4月17日出生于智利圣地亚哥,智利职业足球运动员,司职中场,效力于德国足球甲级联赛勒沃库森足球俱乐部。"
|
| 33 |
+
pprint(pipeline(text))
|
| 34 |
+
|
| 35 |
+
# 输出
|
| 36 |
+
[
|
| 37 |
+
{
|
| 38 |
+
"出生地": [
|
| 39 |
+
{
|
| 40 |
+
"subject": "查尔斯·阿兰基斯",
|
| 41 |
+
"object": "智利圣地亚哥"
|
| 42 |
+
}
|
| 43 |
+
],
|
| 44 |
+
"国籍": [
|
| 45 |
+
{
|
| 46 |
+
"subject": "查尔斯·阿兰基斯",
|
| 47 |
+
"object": "智利"
|
| 48 |
+
}
|
| 49 |
+
],
|
| 50 |
+
"出生日期": [
|
| 51 |
+
{
|
| 52 |
+
"subject": "查尔斯·阿兰基斯",
|
| 53 |
+
"object": "1989年4月17日"
|
| 54 |
+
}
|
| 55 |
+
]
|
| 56 |
+
}
|
| 57 |
+
]
|
| 58 |
```
|
| 59 |
+
|
| 60 |
+
模型训练和推理的详细代码见 [litie](https://github.com/xusenlinzy/lit-ie)
|