Exercises
○ 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.
○ 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.
○ 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?
○ 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?
○ 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']
?○ Try deleting an element from a dictionary
d
, using the syntaxdel d['abc']
. Check that the item was deleted.○ Create two dictionaries,
d1
andd2
, and add some entries to each. Now issue the commandd1.update(d2)
. What did this do? What might it be useful for?○ Create a dictionary
e
, to represent a single lexical entry for some word of your choice. Define keys such asheadword
,part-of-speech
,sense
, andexample
, 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.