MORPHY(7WN)
π MORPHY β the WordNet morphology tea π
okay bestie, welcome to morphy(7WN), a whole discussion page about WordNetβ’'s morphological processing. yes it's a 7WN page, yes it's giving "the lore behind the library", and yes we're gonna read every word of it together. sit down, grab a snack π
β¨ NAME β¨
morphy β the whole discussion of WordNet's morphological processing, aka the reason you can type axes and not get yelled at π
πΈ DESCRIPTION πΈ
So here's the vibe: WordNet usually only stores base forms of words. Like, the un-inflected, un-bothered, main-character version. But searches? Searches can absolutely be done on inflected forms. And when they are, a little set of morphology functions called Morphy gets applied to the search string to generate a form that actually lives in WordNet. slay.
Morphology in WordNet uses two types of processes to try to convert the string you passed in into one that can be found in the WordNet database:
- There are lists of inflectional endings, based on syntactic category, that can be detached from individual words in an attempt to find a form of the word that's in WordNet.
- There are also exception list files, one for each syntactic category, in which a search for an inflected form is done.
Morphy tries to use these two processes in an intelligent manner to translate the string passed to the base form found in WordNet. And the order matters, bestie: Morphy first checks for exceptions, then uses the rules of detachment. π
Important: the Morphy functions are not independent from WordNet. After each transformation, WordNet is searched for the resulting string in the syntactic category specified. no WordNet, no vibes.
The Morphy functions are passed a string and a syntactic category. And a string is either a single word or a collocation. Now β because some words, such as axes, can have more than one base form (axe and axis), Morphy works like this:
- The first time Morphy is called with a specific string, it returns a base form.
- For each subsequent call to Morphy made with a
NULLstring argument, Morphy returns another base form. - Whenever Morphy cannot perform a transformation β whether on the first call for a word or on subsequent calls β
NULLis returned. - A transformation to a valid English string will return
NULLif the base form of the string is not in WordNet.
The morphological functions are found in the WordNet library. See morph(3WN) for information on using these functions. π«Ά
π¦ Rules of Detachment π¦
The following table shows the rules of detachment used by Morphy. If a word ends with one of the suffixes, it is stripped from the word and the corresponding ending is added. Then WordNet is searched for the resulting string.
No rules are applicable to adverbs. periodt. adverbs are free. π
Here's the whole table, one bullet per row, nothing skipped:
NOUNβ suffix"s"β ending""NOUNβ suffix"ses"β ending"s"NOUNβ suffix"xes"β ending"x"NOUNβ suffix"zes"β ending"z"NOUNβ suffix"ches"β ending"ch"NOUNβ suffix"shes"β ending"sh"NOUNβ suffix"men"β ending"man"NOUNβ suffix"ies"β ending"y"VERBβ suffix"s"β ending""VERBβ suffix"ies"β ending"y"VERBβ suffix"es"β ending"e"VERBβ suffix"es"β ending""VERBβ suffix"ed"β ending"e"VERBβ suffix"ed"β ending""VERBβ suffix"ing"β ending"e"VERBβ suffix"ing"β ending""ADJβ suffix"er"β ending""ADJβ suffix"est"β ending""ADJβ suffix"er"β ending"e"ADJβ suffix"est"β ending"e"
π§ Exception Lists π§
There is one exception list file for each syntactic category. These exception lists contain the morphological transformations for strings that are not regular and therefore cannot be processed in an algorithmic manner. (the chaotic ones. the ones that don't follow the rules. we love them.)
Each line of an exception list contains an inflected form of a word or collocation, followed by one or more base forms. The list is kept in alphabetical order and a binary search is used to find words in these lists. See wndb(5WN) for information on the format of the exception list files. β
π Single Words π
In general, single words are relatively easy to process. Morphy's whole routine is:
- Morphy first looks for the word in the exception list.
- If it is found, the first base form is returned.
- Subsequent calls with a
NULLargument return additional base forms, if present. - A
NULLis returned when there are no more base forms of the word.
If the word is not found in the exception list corresponding to the syntactic category, an algorithmic process using the rules of detachment looks for a matching suffix. If a matching suffix is found, a corresponding ending is applied β and sometimes this ending is a NULL string, so in effect the suffix is just removed from the word β and then WordNet is consulted to see if the resulting word is found in the desired part of speech. π
π Collocations π
As opposed to single words, collocations can be quite difficult to transform into a base form that is present in WordNet. ngl, they're the divas of this whole system.
In general, only base forms of words β even those comprising collocations β are stored in WordNet, such as attorney general. Transforming the collocation attorneys general is then simply a matter of finding the base forms of the individual words comprising the collocation. This usually works for nouns, therefore non-conforming nouns, such as customs duty, are presently entered in the noun exception list. (they got put on the list. deserved.)
Verb collocations that contain prepositions, such as ask for it, are more difficult. As with single words, the exception list is searched first. If the collocation is not found, special code in Morphy determines whether a verb collocation includes a preposition. If it does, a function is called to try to find the base form in the following manner:
- It is assumed that the first word in the collocation is a verb.
- It is assumed that the last word is a noun.
- The algorithm then builds a search string with the base forms of the verb and noun, leaving the remainder of the collocation (usually just the preposition, but more words may be involved) in the middle.
For example, passed asking for it, the database search would be performed with ask for it, which is found in WordNet, and therefore returned from Morphy. π₯
If a verb collocation does not contain a preposition, then the base form of each word in the collocation is found and WordNet is searched for the resulting string.
π©· Hyphenation π©·
Hyphenation also presents special difficulties when searching WordNet. It is often a subjective decision as to whether a word is hyphenated, joined as one word, or is a collocation of several words β and which of the various forms are entered into WordNet. it's giving "choose your own adventure" but the adventure is database entries.
When Morphy breaks a string into "words", it looks for both spaces and hyphens as delimiters. It also looks for periods in strings and removes them if an exact match is not found. A search for an abbreviation like oct. return the synset for { October, Oct }. π
Heads up bestie: not every pattern of hyphenated and collocated string is searched for properly, so it may be advantageous to specify several search strings if the results of a search attempt seem incomplete.
π Special Processing for nouns ending with 'ful' π
Morphy contains code that searches for nouns ending with ful and performs a transformation on the substring preceeding it. It then appends 'ful' back onto the resulting string and returns it. For example, if passed the nouns boxesful, it will return boxful. β¨ iconic behaviour honestly
π BUGS π
okay so. the bugs section. deep breaths. π«Ά
- Since many noun collocations contains prepositions, such as
line of products, an algorithm similar to that used for verbs should be written for nouns. In the present scheme, if Morphy is passedlines of products, the search string becomesline of product, which is not in WordNet - Morphy will allow non-words to be converted to words, if they follow one of the rules described above. For example, it will happily convert
plantestoplants.
yeah that second one is real. Morphy is confident. Morphy does not check your vibes. π
πΈ ENVIRONMENT VARIABLES (UNIX) πΈ
WNHOMEβ Base directory for WordNet. Default is/usr/local/WordNet-3.0.WNSEARCHDIRβ Directory in which the WordNet database has been installed. Default isWNHOME/dict.
π REGISTRY (WINDOWS) π
HKEY_LOCAL_MACHINE\SOFTWARE\WordNet\3.0\WNHomeβ Base directory for WordNet. Default isC:\Program Files\WordNet\3.0.
π¦ FILES π¦
pos.excβ morphology exception lists
β SEE ALSO β
wn(1WN), wnb(1WN), binsrch(3WN), morph(3WN), wndb(5WN), wninput(7WN).
and that's the whole page, bestie β every rule, every list, every bug, no cap. π
this was WordNet 3.0, from Dec 2006, and it's signing off with main character energy. go forth and inflect responsibly. πβ¨π
π¦ where this page comes from
- debian bookworm: wordnet 1:3.0-37 Β· WordNet3.0
- debian trixie: wordnet 1:3.0-39 Β· WordNet3.0
- ubuntu jammy: wordnet 1:3.0-37 Β· WordNet3.0
- ubuntu noble: wordnet 1:3.0-37 Β· WordNet3.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms