Exercises
In Example 11-7 the new field
appeared at the bottom of the entry. Modify this program so that it
inserts the new subelement right after the lxfield. (Hint: create the newcvfield usingElement('cv'), assign a text value to it, then use theinsert()method of the parent element.)
Write a function that deletes a specified field from a
lexical entry. (We could use this to sanitize our lexical data
before giving it to others, e.g., by removing fields containing
irrelevant or uncertain content.)
Write a program that scans an HTML dictionary file to find
entries having an illegal part-of-speech field, and then reports the
headword for each entry.
Write a program to find any parts-of-speech (psfield) that occurred less than 10 times. Perhaps these are typing mistakes?
We saw a method for adding a cvfield (Working with Toolbox Data). There is an interesting issue with keeping this up-to-date when someone modifies the content of thelxfield on which it is based. Write a version of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access