句子分块
分块也称为浅层分析,它基本上是识别句子部分和短语(如名词短语)。 词性标注告诉你单词是名词,动词,形容词等,但它并没有给你任何关于句子中句子或短语结构的线索。有时除了单词的词性,自然语言处理任务需要获取更多信息,这是就需要对句子进行解析,从中获得完整的解析树。
PyRATA
Python nltk.RegexpParser() Examples
1 | def prepareForNLP(text): |
输出:1
2
3
4
5
6
7
8
9a man with a red helmet stands on a small moped on a dirt road .
a man
with a red helmet
a red helmet
stands on a small moped on a dirt road
on a small moped
a small moped
on a dirt road
a dirt road
相关链接
名词短语的分块:
NP Chunking (State of the art))