From 42340740e3a6c7628a3457134db2a682f92cec34 Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Tue, 24 Sep 2019 10:47:17 +0200 Subject: [PATCH] update neuralcoref example (#4317) --- website/meta/universe.json | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/website/meta/universe.json b/website/meta/universe.json index f9dae7ead..32afcfa59 100644 --- a/website/meta/universe.json +++ b/website/meta/universe.json @@ -432,17 +432,21 @@ { "id": "neuralcoref", "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 dataset — e.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 dataset — e.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", "thumb": "https://i.imgur.com/j6FO9O6.jpg", "code_example": [ - "from neuralcoref import Coref", + "import spacy", + "import neuralcoref", "", - "coref = Coref()", - "clusters = coref.one_shot_coref(utterances=u\"She loves him.\", context=u\"My sister has a dog.\")", - "mentions = coref.get_mentions()", - "utterances = coref.get_utterances()", - "resolved_utterance_text = coref.get_resolved_utterances()" + "nlp = spacy.load('en')", + "neuralcoref.add_to_pipe(nlp)", + "doc1 = nlp('My sister has a dog. She loves him.')", + "print(doc1._.coref_clusters)", + "", + "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_links": {