自然语言文本处理库:spaCy

jopen 10年前

spaCy 是一个 Python 和 CPython 的 NLP 自然语言文本处理库。

示例代码:

>>> import spacy.en  >>> from spacy.parts_of_speech import ADV  >>> # Load the pipeline, and call it with some text.  >>> nlp = spacy.en.English()  >>> tokens = nlp("‘Give it back,’ he pleaded abjectly, ‘it’s mine.’",                   tag=True, parse=False)  >>> print(''.join(tok.string.upper() if tok.pos == ADV else tok.string for tok in tokens))  ‘Give it BACK,’ he pleaded ABJECTLY, ‘it’s mine.

项目主页:http://www.open-open.com/lib/view/home/1422252639373