mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 17:24:41 +03:00
Update lightning tour
This commit is contained in:
parent
9b4c38fe9f
commit
5dd0d6a383
|
@ -54,7 +54,7 @@ include _includes/_mixins
|
|||
.o-content
|
||||
+grid
|
||||
+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
|
||||
import spacy
|
||||
|
||||
|
@ -65,16 +65,18 @@ include _includes/_mixins
|
|||
text = open('war_and_peace.txt').read()
|
||||
doc = nlp(text)
|
||||
|
||||
# Hook in your own deep learning models
|
||||
similarity_model = load_my_neural_network()
|
||||
def install_similarity(doc):
|
||||
doc.user_hooks['similarity'] = similarity_model
|
||||
nlp.pipeline.append(install_similarity)
|
||||
# Find named entities, phrases and concepts
|
||||
for entity in doc.ents:
|
||||
print(entity.text, entity.label_)
|
||||
|
||||
# Determine semantic similarities
|
||||
doc1 = nlp(u'the fries were gross')
|
||||
doc2 = nlp(u'worst fries ever')
|
||||
doc1.similarity(doc2)
|
||||
|
||||
# Hook in your own deep learning models
|
||||
nlp.add_pipe(load_my_model(), before='parser')
|
||||
|
||||
+grid-col("third")
|
||||
+h(2) Features
|
||||
+list
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
p
|
||||
| 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
|
||||
| out the #[+a("/usage/spacy-101") spaCy 101 guide].
|
||||
| functionality and its usage.
|
||||
|
||||
+h(3, "lightning-tour-models") Install models and process text
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user