update neuralcoref example (#4317)

This commit is contained in:
Sofie Van Landeghem 2019-09-24 10:47:17 +02:00 committed by Ines Montani
parent 16aa092fb5
commit 42340740e3

View File

@ -432,17 +432,21 @@
{ {
"id": "neuralcoref", "id": "neuralcoref",
"slogan": "State-of-the-art coreference resolution based on neural nets and spaCy", "slogan": "State-of-the-art coreference resolution based on neural nets and spaCy",
"description": "This coreference resolution module is based on the super fast [spaCy](https://spacy.io/) parser and uses the neural net scoring model described in [Deep Reinforcement Learning for Mention-Ranking Coreference Models](http://cs.stanford.edu/people/kevclark/resources/clark-manning-emnlp2016-deep.pdf) by Kevin Clark and Christopher D. Manning, EMNLP 2016. With ✨Neuralcoref v2.0, you should now be able to train the coreference resolution system on your own datasete.g., another language than English! — **provided you have an annotated dataset**.", "description": "This coreference resolution module is based on the super fast [spaCy](https://spacy.io/) parser and uses the neural net scoring model described in [Deep Reinforcement Learning for Mention-Ranking Coreference Models](http://cs.stanford.edu/people/kevclark/resources/clark-manning-emnlp2016-deep.pdf) by Kevin Clark and Christopher D. Manning, EMNLP 2016. Since ✨Neuralcoref v2.0, you can train the coreference resolution system on your own datasete.g., another language than English! — **provided you have an annotated dataset**. Note that to use neuralcoref with spaCy > 2.1.0, you'll have to install neuralcoref from source.",
"github": "huggingface/neuralcoref", "github": "huggingface/neuralcoref",
"thumb": "https://i.imgur.com/j6FO9O6.jpg", "thumb": "https://i.imgur.com/j6FO9O6.jpg",
"code_example": [ "code_example": [
"from neuralcoref import Coref", "import spacy",
"import neuralcoref",
"", "",
"coref = Coref()", "nlp = spacy.load('en')",
"clusters = coref.one_shot_coref(utterances=u\"She loves him.\", context=u\"My sister has a dog.\")", "neuralcoref.add_to_pipe(nlp)",
"mentions = coref.get_mentions()", "doc1 = nlp('My sister has a dog. She loves him.')",
"utterances = coref.get_utterances()", "print(doc1._.coref_clusters)",
"resolved_utterance_text = coref.get_resolved_utterances()" "",
"doc2 = nlp('Angela lives in Boston. She is quite happy in that city.')",
"for ent in doc2.ents:",
" print(ent._.coref_cluster)"
], ],
"author": "Hugging Face", "author": "Hugging Face",
"author_links": { "author_links": {