Exercises

  1. ○ Search the Web for “spoof newspaper headlines,” to find such gems as: British Left Waffles on Falkland Islands, and Juvenile Court to Try Shooting Defendant. Manually tag these headlines to see whether knowledge of the part-of-speech tags removes the ambiguity.

  2. ○ Working with someone else, take turns picking a word that can be either a noun or a verb (e.g., contest); the opponent has to predict which one is likely to be the most frequent in the Brown Corpus. Check the opponent’s prediction, and tally the score over several turns.

  3. ○ Tokenize and tag the following sentence: They wind back the clock, while we chase after the wind. What different pronunciations and parts-of-speech are involved?

  4. ○ Review the mappings in Table 5-4. Discuss any other examples of mappings you can think of. What type of information do they map from and to?

  5. ○ Using the Python interpreter in interactive mode, experiment with the dictionary examples in this chapter. Create a dictionary d, and add some entries. What happens whether you try to access a non-existent entry, e.g., d['xyz']?

  6. ○ Try deleting an element from a dictionary d, using the syntax del d['abc']. Check that the item was deleted.

  7. ○ Create two dictionaries, d1 and d2, and add some entries to each. Now issue the command d1.update(d2). What did this do? What might it be useful for?

  8. ○ Create a dictionary e, to represent a single lexical entry for some word of your choice. Define keys such as headword, part-of-speech, sense, and example, and ...

Get Natural Language Processing with Python 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.