Chapter 6. Transforming Chunks and Trees

In this chapter, we will cover the following recipes:

  • Filtering insignificant words from a sentence
  • Correcting verb forms
  • Swapping verb phrases
  • Swapping noun cardinals
  • Swapping infinitive phrases
  • Singularizing plural nouns
  • Chaining chunk transformations
  • Converting a chunk tree to text
  • Flattening a deep tree
  • Creating a shallow tree
  • Converting tree labels

Introduction

Now that you know how to get chunks/phrases from a sentence, what do you do with them? This chapter will show you how to do various transforms on both chunks and trees. The chunk transforms are for grammatical correction and rearranging phrases without loss of meaning. The tree transforms give you ways to modify and flatten deep parse trees. The functions ...

Get Natural Language Processing: Python and NLTK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.