擅长:python、mysql、java
<p><strong>代码:</strong></p>
<pre><code>import os
from spacy.en import English, LOCAL_DATA_DIR
data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR)
nlp = English(data_dir=data_dir)
doc3 = nlp(u"this is spacy lemmatize testing. programming books are more better than others")
for token in doc3:
print token, token.lemma, token.lemma_
</code></pre>
<p><strong>输出:</strong></p>
<pre><code>this 496 this
is 488 be
spacy 173779 spacy
lemmatize 1510965 lemmatize
testing 2900 testing
. 419 .
programming 3408 programming
books 1011 book
are 488 be
more 529 more
better 615 better
than 555 than
others 871 others
</code></pre>
<p>引用示例:<a href="http://textminingonline.com/getting-started-with-spacy" rel="noreferrer">here</a></p>