mirror of https://github.com/explosion/spaCy.git
docs(website): fix issue on example in spacy-lookup
This commit is contained in:
parent
42364dcd9f
commit
688a328668
|
@ -334,15 +334,16 @@
|
||||||
"from spacy_lookup import Entity",
|
"from spacy_lookup import Entity",
|
||||||
"",
|
"",
|
||||||
"nlp = spacy.load('en')",
|
"nlp = spacy.load('en')",
|
||||||
"entity = Entity(keywords_list=['python', 'java platform'])",
|
"entity = Entity(keywords_list=['python', 'product manager', 'java platform'])",
|
||||||
"nlp.add_pipe(entity, last=True)",
|
"nlp.add_pipe(entity, last=True)",
|
||||||
"",
|
"",
|
||||||
"doc = nlp(u\"I am a product manager for a java and python.\")",
|
"doc = nlp(u\"I am a product manager for a java and python.\")",
|
||||||
"assert doc._.has_entities == True",
|
"assert doc._.has_entities == True",
|
||||||
"assert doc[2:5]._.has_entities == True",
|
|
||||||
"assert doc[0]._.is_entity == False",
|
"assert doc[0]._.is_entity == False",
|
||||||
|
"assert doc[3]._.entity_desc == 'product manager'",
|
||||||
"assert doc[3]._.is_entity == True",
|
"assert doc[3]._.is_entity == True",
|
||||||
"print(doc._.entities)"
|
"",
|
||||||
|
"print([(token.text, token._.canonical) for token in doc if token._.is_entity])"
|
||||||
],
|
],
|
||||||
"author": "Marc Puig",
|
"author": "Marc Puig",
|
||||||
"author_links": {
|
"author_links": {
|
||||||
|
|
Loading…
Reference in New Issue