Update README.md
Browse files
README.md
CHANGED
|
@@ -80,18 +80,18 @@ def post_process_re_output(re_output, re_input, ner_output):
|
|
| 80 |
return template
|
| 81 |
|
| 82 |
>>> input = "Hugging face is a French company in New york."
|
| 83 |
-
>>> output = ner_pip(input)
|
| 84 |
|
| 85 |
-
>>> re_input = process_ner_output(output, input)
|
| 86 |
|
| 87 |
>>> re_output = []
|
| 88 |
>>> for idx in range(len(re_input)):
|
| 89 |
-
>>> tmp_re_output = re_pip(re_input[idx]["re_input"])
|
| 90 |
>>> re_output.append(tmp_re_output)
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
-
>>> re_ner_output = post_process_re_output(re_output)
|
| 95 |
>>> print("Sentence: ",re_ner_output["input"])
|
| 96 |
>>> print("Entity: ", re_ner_output["entity"])
|
| 97 |
>>> print("Relation: ", re_ner_output["relation"])
|
|
|
|
| 80 |
return template
|
| 81 |
|
| 82 |
>>> input = "Hugging face is a French company in New york."
|
| 83 |
+
>>> output = ner_pip(input) # inference NER tags
|
| 84 |
|
| 85 |
+
>>> re_input = process_ner_output(output, input) # prepare a pair of entity and predict relation type
|
| 86 |
|
| 87 |
>>> re_output = []
|
| 88 |
>>> for idx in range(len(re_input)):
|
| 89 |
+
>>> tmp_re_output = re_pip(re_input[idx]["re_input"]) # for each pair of entity, predict relation
|
| 90 |
>>> re_output.append(tmp_re_output)
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
+
>>> re_ner_output = post_process_re_output(re_output) # post process NER and relation predictions
|
| 95 |
>>> print("Sentence: ",re_ner_output["input"])
|
| 96 |
>>> print("Entity: ", re_ner_output["entity"])
|
| 97 |
>>> print("Relation: ", re_ner_output["relation"])
|