Example: quiz answers

Natural Language Processing with Python

Natural Language Processing with PythonNatural Language Processingwith PythonSteven Bird, Ewan Klein, and Edward LoperBeijing Cambridge Farnham K ln Sebastopol Taipei TokyoNatural Language Processing with Pythonby Steven Bird, Ewan Klein, and Edward LoperCopyright 2009 Steven Bird, Ewan Klein, and Edward Loper. All rights in the United States of by O Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA Reilly books may be purchased for educational, business, or sales promotional use. Online editionsare also available for most titles ( ). For more information, contact ourcorporate/institutional sales department: (800) 998-9938 or SteeleProduction Editor:Loranah DimantCopyeditor:Genevieve d EntremontProofreader:Loranah DimantIndexer:Ellen Troutman ZaigCover Designer:Karen MontgomeryInterior Designer:David FutatoIllustrator:Robert RomanoPrinting History:June 2009:First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O Reilly logo are registered trademarks ofO Reilly Media, Inc.

Natural Language Processing—or NLP for short—in a wide sense to cover any kind of computer manipulation of natural language. At one extreme, it could be as simple as counting word frequencies to compare different writing styles. At the other extreme, NLP involves “understanding” complete human utterances, at least to the extent of

Tags:

  Python, Language, With, Processing, Natural, Natural language processing, Natural language processing with python

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Natural Language Processing with Python

1 Natural Language Processing with PythonNatural Language Processingwith PythonSteven Bird, Ewan Klein, and Edward LoperBeijing Cambridge Farnham K ln Sebastopol Taipei TokyoNatural Language Processing with Pythonby Steven Bird, Ewan Klein, and Edward LoperCopyright 2009 Steven Bird, Ewan Klein, and Edward Loper. All rights in the United States of by O Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA Reilly books may be purchased for educational, business, or sales promotional use. Online editionsare also available for most titles ( ). For more information, contact ourcorporate/institutional sales department: (800) 998-9938 or SteeleProduction Editor:Loranah DimantCopyeditor:Genevieve d EntremontProofreader:Loranah DimantIndexer:Ellen Troutman ZaigCover Designer:Karen MontgomeryInterior Designer:David FutatoIllustrator:Robert RomanoPrinting History:June 2009:First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O Reilly logo are registered trademarks ofO Reilly Media, Inc.

2 Natural Language Processing with Python , the image of a right whale, and relatedtrade dress are trademarks of O Reilly Media, of the designations used by manufacturers and sellers to distinguish their products are claimed astrademarks. Where those designations appear in this book, and O Reilly Media, Inc. was aware of atrademark claim, the designations have been printed in caps or initial every precaution has been taken in the preparation of this book, the publisher and authors assumeno responsibility for errors or omissions, or for damages resulting from the use of the information con-tained : 978-0-596-51649-9[M]1244726609 Table of ContentsPreface .. Processing and Python .. Computing with Language : Texts and A Closer Look at Python : Texts as Lists of Computing with Language : Simple Back to Python : Making Decisions and Taking Automatic Natural Language Further Text Corpora and Lexical Resources .. Accessing Text Conditional Frequency More Python : Reusing Lexical Further Raw Text.

3 Accessing Text from the Web and from Strings: Text Processing at the Lowest Text Processing with Regular Expressions for Detecting Word Useful Applications of Regular Normalizing Regular Expressions for Tokenizing Formatting: From Lists to Further Structured Programs .. Back to the Questions of Functions: The Foundation of Structured Doing More with Program Algorithm A Sample of Python Further and Tagging Words .. Using a Tagged Mapping Words to Properties Using Python Automatic N-Gram Transformation-Based How to Determine the Category of a Further to Classify Text .. Supervised Further Examples of Supervised Decision Naive Bayes Maximum Entropy Modeling Linguistic Further Information from Text .. Information Extraction261vi|Table of Developing and Evaluating Recursion in Linguistic Named Entity Relation Further Sentence Structure .. Some Grammatical What s the Use of Syntax?

4 Context-Free Parsing with Context-Free Dependencies and Dependency Grammar Further Feature-Based Grammars .. Grammatical Processing Feature Extending a Feature-Based Further the Meaning of Sentences .. Natural Language Propositional First-Order The Semantics of English Discourse Further Linguistic Data .. Corpus Structure: A Case The Life Cycle of a Acquiring Working with XML425 Table of Contents| Working with Toolbox Describing Language Resources Using OLAC Further Exercises438 Afterword: The Language Challenge .. 441 Bibliography .. 449 NLTK Index .. 459 General Index .. 463viii|Table of ContentsPrefaceThis is a book about Natural Language Processing . By Natural Language we mean alanguage that is used for everyday communication by humans; languages such as Eng-lish, Hindi, or Portuguese. In contrast to artificial languages such as programming lan-guages and mathematical notations, Natural languages have evolved as they pass fromgeneration to generation, and are hard to pin down with explicit rules.

5 We will takeNatural Language Processing or NLP for short in a wide sense to cover any kind ofcomputer manipulation of Natural Language . At one extreme, it could be as simple ascounting word frequencies to compare different writing styles. At the other extreme,NLP involves understanding complete human utterances, at least to the extent ofbeing able to give useful responses to based on NLP are becoming increasingly widespread. For example,phones and handheld computers support predictive text and handwriting recognition;web search engines give access to information locked up in unstructured text; machinetranslation allows us to retrieve texts written in Chinese and read them in Spanish. Byproviding more Natural human-machine interfaces, and more sophisticated access tostored information, Language Processing has come to play a central role in the multi-lingual information book provides a highly accessible introduction to the field of NLP. It can be usedfor individual study or as the textbook for a course on Natural Language Processing orcomputational linguistics, or as a supplement to courses in artificial intelligence, textmining, or corpus linguistics.

6 The book is intensely practical, containing hundreds offully worked examples and graded book is based on the Python programming Language together with an open sourcelibrary called the Natural Language Toolkit (NLTK). NLTK includes extensive soft-ware, data, and documentation, all freely downloadable from are provided for Windows, Macintosh, and Unix platforms. We stronglyencourage you to download Python and NLTK, and try out the examples and exercisesalong the is important for scientific, economic, social, and cultural reasons. NLP is experi-encing rapid growth as its theories and methods are deployed in a variety of new lan-guage technologies. For this reason it is important for a wide range of people to have aworking knowledge of NLP. Within industry, this includes people in human-computerinteraction, business information analysis, and web software development. Withinacademia, it includes people in areas from humanities computing and corpus linguisticsthrough to computer science and artificial intelligence.

7 (To many people in academia,NLP is known by the name of Computational Linguistics. )This book is intended for a diverse range of people who want to learn how to writeprograms that analyze written Language , regardless of previous programmingexperience:New to programming?The early chapters of the book are suitable for readers with no prior knowledge ofprogramming, so long as you aren t afraid to tackle new concepts and develop newcomputing skills. The book is full of examples that you can copy and try for your-self, together with hundreds of graded exercises. If you need a more general intro-duction to Python , see the list of Python resources at to Python ?Experienced programmers can quickly learn enough Python using this book to getimmersed in Natural Language Processing . All relevant Python features are carefullyexplained and exemplified, and you will quickly come to appreciate Python s suit-ability for this application area. The Language index will help you locate relevantdiscussions in the dreaming in Python ?

8 Skim the Python examples and dig into the interesting Language analysis materialthat starts in Chapter 1. You ll soon be applying your skills to this book is a practical introduction to NLP. You will learn by example, write realprograms, and grasp the value of being able to test an idea through implementation. Ifyou haven t learned already, this book will teach you programming. Unlike otherprogramming books, we provide extensive illustrations and exercises from NLP. Theapproach we have taken is also principled, in that we cover the theoretical underpin-nings and don t shy away from careful linguistic and computational analysis. We havetried to be pragmatic in striking a balance between theory and application, identifyingthe connections and the tensions. Finally, we recognize that you won t get through thisunless it is also pleasurable, so we have tried to include many applications and ex-amples that are interesting and entertaining, and sometimes |PrefaceNote that this book is not a reference work.

9 Its coverage of Python and NLP is selective,and presented in a tutorial style. For reference material, please consult the substantialquantity of searchable resources available at and book is not an advanced computer science text. The content ranges from intro-ductory to intermediate, and is directed at readers who want to learn how to analyzetext using Python and the Natural Language Toolkit. To learn about advanced algo-rithms implemented in NLTK, you can examine the Python code linked from , and consult the other materials cited in this You Will LearnBy digging into the material presented here, you will learn: How simple programs can help you manipulate and analyze Language data, andhow to write these programs How key concepts from NLP and linguistics are used to describe and analyzelanguage How data structures and algorithms are used in NLP How Language data is stored in standard formats, and how data can be used toevaluate the performance of NLP techniquesDepending on your background, and your motivation for being interested in NLP, youwill gain different kinds of skills and knowledge from this book, as set out in Table P-1.

10 Skills and knowledge to be gained from reading this book, depending on readers goals andbackgroundGoalsBackground in arts and humanitiesBackground in science and engineeringLanguageanalysisManipulating large corpora, exploring linguisticmodels, and testing empirical techniques in data modeling, data mining, andknowledge discovery to analyze Natural robust systems to perform linguistic taskswith technological linguistic algorithms and data structures in robustlanguage Processing early chapters are organized in order of conceptual difficulty, starting with a prac-tical introduction to Language Processing that shows how to explore interesting bodiesof text using tiny Python programs (Chapters 1 3). This is followed by a chapter onstructured programming (Chapter 4) that consolidates the programming topics scat-tered across the preceding chapters. After this, the pace picks up, and we move on toa series of chapters covering fundamental topics in Language Processing : tagging, clas-sification, and information extraction (Chapters 5 7).


Related search queries