Skip to content

Commit 04e5734

Browse files
committed
Add instructions on how to use coreference chains in README
1 parent 8d0c71c commit 04e5734

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ results in:
7474
`>>> (0 Princess Liana ) felt sad , because (1 Zarth Arn ) was gone . (0 The princess) went to sleep .`
7575

7676

77+
## Using Coreference Chains
78+
79+
The coreference chains predicted can be accessed using the `.coref_chains` attribute:
80+
81+
```python
82+
annotated_doc = predict_coref_simple(
83+
"Princess Liana felt sad, because Zarth Arn was gone. The princess went to sleep.",
84+
model,
85+
tokenizer
86+
)
87+
print(annotated_doc.coref_chains)
88+
```
89+
90+
`>>>[[Mention(tokens=['The', 'princess'], start_idx=11, end_idx=13), Mention(tokens=['Princess', 'Liana'], start_idx=0, end_idx=2)], [Mention(tokens=['Zarth', 'Arn'], start_idx=6, end_idx=8)]]`
91+
92+
7793
## Training a model
7894

7995
Aside from the `tibert.train.train_coref_model` function, it is possible to train a model from the command line. Training a model requires installing the `sacred` library. Here is the most basic example:

0 commit comments

Comments
 (0)