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 detailed in these recipes modify data, as opposed to learning from it. This means it's not safe to apply them indiscriminately. A thorough knowledge of the data you want to transform, along with a few experiments, should help you decide which functions to apply and when.

Whenever the term chunk is used in this chapter, it could refer to an actual chunk extracted by a chunker, or it could simply refer to a short phrase or sentence in the form of a list of tagged words. What's important in this chapter is what you can do with a chunk, not where it came from.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset