Skip to Content
Python和NLTK实现自然语言处理
book

Python和NLTK实现自然语言处理

by Posts & Telecom Press, Nitin Hardeniya
February 2024
Intermediate to advanced
649 pages
9h 58m
Chinese
Packt Publishing
Content preview from Python和NLTK实现自然语言处理

第3章 词性标注

为了可以使用任意的文本语料库进行工作,先前章节探讨了所需的预处理步骤。现在,你应该可以非常自由地解析和清理任何类型的文本。你应该能够执行所有的文本预处理,对任何文本进行标记解析、词干提取和停用词删除。你可以自定义所有的预处理工具以满足你的需要。到目前为止,本书主要讨论了文本文档需要进行的一般预处理。现在开始讨论更加繁重的NLP预处理步骤。

本章将讨论什么是词性标注,以及在NLP应用的上下文中词性标注的意义是什么。我们还将学习如何使用NLTK以及用于NLP密集型应用程序的标签和各种标注器,提取有意义的信息。最后,我们将学习如何使用NLTK来标记命名实体。我们将详细讨论各种NLP标注器,同时也给出一小片段代码,帮助你理解。我们也会观察一下最佳做法,以及在何处使用何种标注器。本章主要内容如下。

  • 在自然语言处理的上下文中,词性(Part of Speech,POS)标注的定义以及词性标注的重要性。
  • 使用NLTK,进行POS标注的不同方式。
  • 使用NLTK,建立自定义POS标注器的方法。

在你的童年,你可能已经听说过词性(POS)这个术语。你真的需要投入大量的时间,才可以自信地说出什么是形容词,什么是副词,它们之间的具体区别是什么。请思考一下,我们希望建立一个系统,将所有这方面的知识编码到这个系统中。这可能看起来很容易,而几十年来,将这种知识编码到机器学习模型中成为一个非常困难的NLP问题。我认为,当前最先进的POS标注算法可以以较高的精准率(大约为97%),预测给定单词的词性。然而,人们仍然在POS标注领域进行了大量的研究。

在新闻和其他领域中,像英语这样的语言具有许多标注的语料库可供使用,这使得人们得到了许多先进的算法。一些标注器非常通用,可以使用在不同的领域和不同的文本中。但是,在特定的用例中,POS可能无法表现得与预期一样。在这些用例中,我们可能需要从头开始建立一个POS标注器。为了理解POS标注器的内部细节,我们需要对一些机器学习技术有一个基本的了解。第6章将探讨其中的一些内容,但是为了构建适合我们需要的自定义POS标注器,必须讨论一些基本知识。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Java持续交付

Java持续交付

Daniel Bryant, Abraham Marín-Pérez
C++语言导学(原书第2版)

C++语言导学(原书第2版)

本贾尼 斯特劳斯特鲁普
软件开发实践:项目驱动式的Java开发指南

软件开发实践:项目驱动式的Java开发指南

Raoul-Gabriel Urma, Richard Warburton
Spark机器学习实战

Spark机器学习实战

Posts & Telecom Press, Siamak Amirghodsi, Meenakshi Rajendran, Broderick Hall, Shuen Mei

Publisher Resources

ISBN: 9781835083451