mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-13 09:42:26 +03:00
Update lightning tour
This commit is contained in:
parent
9b4c38fe9f
commit
5dd0d6a383
|
@ -54,7 +54,7 @@ include _includes/_mixins
|
||||||
.o-content
|
.o-content
|
||||||
+grid
|
+grid
|
||||||
+grid-col("two-thirds")
|
+grid-col("two-thirds")
|
||||||
+terminal("lightning_tour.py").
|
+terminal("lightning_tour.py", "More examples", "/usage/spacy-101#lightning-tour").
|
||||||
# Install: pip install spacy && spacy download en
|
# Install: pip install spacy && spacy download en
|
||||||
import spacy
|
import spacy
|
||||||
|
|
||||||
|
@ -65,16 +65,18 @@ include _includes/_mixins
|
||||||
text = open('war_and_peace.txt').read()
|
text = open('war_and_peace.txt').read()
|
||||||
doc = nlp(text)
|
doc = nlp(text)
|
||||||
|
|
||||||
# Hook in your own deep learning models
|
# Find named entities, phrases and concepts
|
||||||
similarity_model = load_my_neural_network()
|
for entity in doc.ents:
|
||||||
def install_similarity(doc):
|
print(entity.text, entity.label_)
|
||||||
doc.user_hooks['similarity'] = similarity_model
|
|
||||||
nlp.pipeline.append(install_similarity)
|
|
||||||
|
|
||||||
|
# Determine semantic similarities
|
||||||
doc1 = nlp(u'the fries were gross')
|
doc1 = nlp(u'the fries were gross')
|
||||||
doc2 = nlp(u'worst fries ever')
|
doc2 = nlp(u'worst fries ever')
|
||||||
doc1.similarity(doc2)
|
doc1.similarity(doc2)
|
||||||
|
|
||||||
|
# Hook in your own deep learning models
|
||||||
|
nlp.add_pipe(load_my_model(), before='parser')
|
||||||
|
|
||||||
+grid-col("third")
|
+grid-col("third")
|
||||||
+h(2) Features
|
+h(2) Features
|
||||||
+list
|
+list
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
p
|
p
|
||||||
| The following examples and code snippets give you an overview of spaCy's
|
| The following examples and code snippets give you an overview of spaCy's
|
||||||
| functionality and its usage. If you're new to spaCy, make sure to check
|
| functionality and its usage.
|
||||||
| out the #[+a("/usage/spacy-101") spaCy 101 guide].
|
|
||||||
|
|
||||||
+h(3, "lightning-tour-models") Install models and process text
|
+h(3, "lightning-tour-models") Install models and process text
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user