Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Separate the stem of an English word from its affixes
ResourceFunction["WordAffixStructure"][wd] gives <|m1→lbl1,m2→lbl2,…|> labeling each part mi of the English word wd as either “prefix”, “stem”, “suffix” or “inflection”. | |
ResourceFunction["WordAffixStructure"][{wd1,wd2,…}] gives a list of associations, one for each wd. |
OutputFormat | "LabeledParts" | determines which output format to use |
"LabeledParts" | association(s) in which the keys are parts of wd and the values are "prefix", "stem", "suffix" or "inflection" |
"NestedLists" | {{pre1,pre2,…},stem,{suf1,suf2,…,{inf1,inf2,…}} |
"MarkupString" | wd with "~" inserted after each prefix, "•" inserted before each morphological suffix and * inserted before each inflectional suffix |
"NestedBoxes" | a visualization of the affix structure |
Reveal the affix structure of an English word:
In[1]:= |
Out[1]= |
Reveal the affix structure of a list of English words:
In[2]:= |
Out[2]= |
WordAffixStructure attempts to reveal structure of coinages that are not in the dictionary:
In[3]:= |
Out[3]= |
WordAffixStructure attempts to separate foreign inflectional endings in English words:
In[4]:= |
Out[4]= |
The OutputFormat option changes the way the structure is returned:
In[5]:= |
Out[6]= |
Analyze the affix proportions in a piece of text (here a quote by Eleanor Roosevelt):
In[7]:= |
Out[9]= |
Parse words to learn about roots, prefixes and suffixes:
In[10]:= |
Out[11]= |
Word parts do not always divide cleanly into prefixes, stems and suffixes. WordAffixStructure tries to make reasonable choices when there is uncertainty. In this example, "demo" could be a prefix or a part of the stem, and "crat" could be considered a suffix or a part of the stem. Since a word must have a stem, the function divides it as you see here:
In[12]:= |
Out[12]= |
This work is licensed under a Creative Commons Attribution 4.0 International License