mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Update universe example codes (#9422)
* Update universe plugins * Adjust azure trigger * Add init to tests/universe * deliberatly trying to break the universe to see if the CI catches it * revert Co-authored-by: svlandeg <svlandeg@github.com>
This commit is contained in:
parent
3b429619a8
commit
9dfb12e29f
|
@ -16,6 +16,8 @@ pr:
|
|||
exclude:
|
||||
- "website/*"
|
||||
- "*.md"
|
||||
include:
|
||||
- "website/meta/universe.json"
|
||||
|
||||
jobs:
|
||||
# Perform basic checks for most important errors (syntax etc.) Uses the config
|
||||
|
|
|
@ -1343,20 +1343,19 @@
|
|||
"url": "https://explosion.ai/demos/sense2vec",
|
||||
"code_example": [
|
||||
"import spacy",
|
||||
"from sense2vec import Sense2VecComponent",
|
||||
"",
|
||||
"nlp = spacy.load('en')",
|
||||
"s2v = Sense2VecComponent('/path/to/reddit_vectors-1.1.0')",
|
||||
"nlp.add_pipe(s2v)",
|
||||
"nlp = spacy.load(\"en_core_web_sm\")",
|
||||
"s2v = nlp.add_pipe(\"sense2vec\")",
|
||||
"s2v.from_disk(\"/path/to/s2v_reddit_2015_md\")",
|
||||
"",
|
||||
"doc = nlp(\"A sentence about natural language processing.\")",
|
||||
"assert doc[3].text == 'natural language processing'",
|
||||
"freq = doc[3]._.s2v_freq",
|
||||
"vector = doc[3]._.s2v_vec",
|
||||
"most_similar = doc[3]._.s2v_most_similar(3)",
|
||||
"# [(('natural language processing', 'NOUN'), 1.0),",
|
||||
"# (('machine learning', 'NOUN'), 0.8986966609954834),",
|
||||
"# (('computer vision', 'NOUN'), 0.8636297583580017)]"
|
||||
"assert doc[3:6].text == \"natural language processing\"",
|
||||
"freq = doc[3:6]._.s2v_freq",
|
||||
"vector = doc[3:6]._.s2v_vec",
|
||||
"most_similar = doc[3:6]._.s2v_most_similar(3)",
|
||||
"# [(('machine learning', 'NOUN'), 0.8986967),",
|
||||
"# (('computer vision', 'NOUN'), 0.8636297),",
|
||||
"# (('deep learning', 'NOUN'), 0.8573361)]"
|
||||
],
|
||||
"category": ["pipeline", "standalone", "visualizers"],
|
||||
"tags": ["vectors"],
|
||||
|
@ -2855,11 +2854,10 @@
|
|||
"github": "thomasthiebaud/spacy-fastlang",
|
||||
"pip": "spacy_fastlang",
|
||||
"code_example": [
|
||||
"import spacy",
|
||||
"from spacy_fastlang import LanguageDetector",
|
||||
"import spacy_fastlang",
|
||||
"",
|
||||
"nlp = spacy.load('en_core_web_sm')",
|
||||
"nlp.add_pipe(LanguageDetector())",
|
||||
"nlp = spacy.load(\"en_core_web_sm\")",
|
||||
"nlp.add_pipe(\"language_detector\")",
|
||||
"doc = nlp('Life is like a box of chocolates. You never know what you are gonna get.')",
|
||||
"",
|
||||
"assert doc._.language == 'en'",
|
||||
|
|
Loading…
Reference in New Issue
Block a user