擅长:python、mysql、java
<p>如果您打开了<code>NLTK</code>以外的选项,请签出<a href="https://textblob.readthedocs.io/en/dev/quickstart.html#noun-phrase-extraction" rel="noreferrer">^{<cd2>}</a>。它很容易提取所有名词和名词短语:</p>
<pre><code>>>> from textblob import TextBlob
>>> txt = """Natural language processing (NLP) is a field of computer science, artificial intelligence, and computational linguistics concerned with the inter
actions between computers and human (natural) languages."""
>>> blob = TextBlob(txt)
>>> print(blob.noun_phrases)
[u'natural language processing', 'nlp', u'computer science', u'artificial intelligence', u'computational linguistics']
</code></pre>