Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Separate parts of a compound word
ResourceFunction["WordCompounds"][wd] gives a list of ways wd can be split into two complete words. | |
ResourceFunction["WordCompounds"][wd,min] gives a list of ways wd can be split into two complete words of min characters or more. min should be a positive integer. |
Split a compound word into its two parts:
In[1]:= |
Out[1]= |
If there are multiple ways to split wd into two valid words, then all are given:
In[2]:= |
Out[2]= |
The input wd does not have to be a known word:
In[3]:= |
Out[3]= |
Capitalization is preserved:
In[4]:= |
Out[4]= |
In languages like German, where the second part of the compound may be capitalized differently from the dictionary entry, a match is still found and the results preserve the capitalization of wd:
In[5]:= |
Out[5]= |
Select a language other than English:
In[6]:= |
Out[6]= |
The minimum string length of the two parts of the compound is set to 3 by default, but you can change this with the optional second argument:
In[7]:= |
Out[7]= |
Sometimes words that are not compounds get divided:
In[8]:= |
Out[8]= |
In some languages, the parts of compounds differ from the original words. In this example, the two parts of the compound are "Schwein" and "Hund", but there is an "e" between them. WordCompounds will not find the match in these cases:
In[9]:= |
Out[9]= |
This work is licensed under a Creative Commons Attribution 4.0 International License