Python 中 NLTK 工具包的默认分块器是什么?

发布于 2024-08-10 11:15:49 字数 91 浏览 6 评论 0原文

我正在使用他们的默认 POS 标记和默认标记化..这似乎足够了。我也想要他们的默认分块器。

我正在阅读 NLTK 工具包书,但他们似乎没有默认的分块器?

I am using their default POS tagging and default tokenization..and it seems sufficient. I'd like their default chunker too.

I am reading the NLTK toolkit book, but it does not seem like they have a default chunker?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

悲凉≈ 2024-08-17 11:15:49

您可以使用 nltk.ne_chunk() 方法摆脱命名实体分块的束缚。它采用 POS 标记元组列表:

nltk.ne_chunk([('Barack', 'NNP'), ('Obama', 'NNP'), ('lives', 'NNS'), ('in ', 'IN'), ('Washington', 'NNP')])

结果:

Tree('S', [Tree('PERSON', [('Barack', 'NNP') )]), Tree('组织', [('奥巴马', 'NNP')]), ('生活', 'NNS'), ('in', 'IN'), Tree('GPE', [ ('Washington', 'NNP')])])

它将 Barack 标识为一个人,但将 Obama 标识为一个组织。所以,并不完美。

You can get out of the box named entity chunking with the nltk.ne_chunk() method. It takes a list of POS tagged tuples:

nltk.ne_chunk([('Barack', 'NNP'), ('Obama', 'NNP'), ('lives', 'NNS'), ('in', 'IN'), ('Washington', 'NNP')])

results in:

Tree('S', [Tree('PERSON', [('Barack', 'NNP')]), Tree('ORGANIZATION', [('Obama', 'NNP')]), ('lives', 'NNS'), ('in', 'IN'), Tree('GPE', [('Washington', 'NNP')])])

It identifies Barack as a person, but Obama as an organization. So, not perfect.

一身软味 2024-08-17 11:15:49

我也找不到默认的分块器/浅解析器。尽管这本书描述了如何使用示例功能构建和训练功能。提供额外的功能来获得良好的性能应该不会太困难。

请参阅第 7 章有关基于训练分类器的部分分块器

I couldn't find a default chunker/shallow parser either. Although the book describes how to build and train one with example features. Coming up with additional features to get good performance shouldn't be too difficult.

See Chapter 7's section on Training Classifier-based Chunkers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文