Etymology, also known as the study of word origins, serves as a crucial component to understanding language, culture, and human evolution, while also deepening linguistic perceptions that sustain modern technologies like large language models. Historical linguists typically rely on ancient texts and word databases to gather knowledge, but this can be time-consuming and inconsistent, prompting the search for possible computational strategies to reveal etymological information. This project considers the analysis of different segments of a word in both orthographic and phonetic forms as a method of predicting its language of origin, using probability calculations based on patterns identified in a large dataset. After the combinations of letters and phonemes in each word are examined through two separate functions, they are finally integrated into one holistic model, which proves to provide the most significant insight into the words’ individual backgrounds.
Introduction
Introduction
The origin of an English word can sometimes be deduced simply upon glancing at its different parts. For example, a reader may automatically categorize a word ending in “tion” as one of Latin origin. However, there are several factors that play into the etymological history of a word, making this method not entirely trustworthy. This project probes this complexity by attempting to produce a function that splits an English word into segments of different lengths — using both standard spelling and IPA (International Phonetic Alphabet) format — and accurately predicts the probability of that word originating from the languages in its database.
Initialization
Initialization
To work with orthographic words and their origins, we will use an etymology dataset previously imported from the web, filtered to include only words directly originating from their corresponding languages, excluding proper nouns and hyphenated words. Their phonetic representations will come from a list transformed prior to use via the WordPhoneticSyllabify ResourceFunction.
Accessing data stored in Wolfram Cloud:
In[]:=
validLangs = CloudGet["https://www.wolframcloud.com/obj/violavpande/validlangs"];allLangs = CloudGet["https://www.wolframcloud.com/obj/violavpande/alllangs"];originMap = CloudGet["https://www.wolframcloud.com/obj/violavpande/originmap"];allWords = Keys[originMap];
Finding and storing phonetic representations of each word:
In[]:=
phonemeMap = SelectAssociation#[[2]] -> #[[1]] &/@ , KeyExistsQ[originMap, #]&;allPhonetics = Keys[phonemeMap];
The output below depicts two small samples of the Associations to be used throughout this project. The first one maps English words in their orthographic and phonetic forms to the languages they originate from, while the second maps their phonetic forms to orthographic form. The dataset of words comprises over 38,000 words used in the English language, originating from 35 different languages, which will prove useful in studying the relationship between smaller segments of the words and their common origins.
RandomSample[originMap,10]
Out[]=
effectiveLatin,susegadPortuguese,reginalMedieval Latin,geteldOld English,alpargataSpanish,kharzaRussian,procreateLatin,matchAncient Greek,fentLatin,everycuntScots
RandomSample[phonemeMap,10]
Out[]=
hiliəmhelium,ɪmpɔrtimport,deɪzdays,sænzsans,duɒdənəmduodenum,lubrɪkeɪtlubricate,wɒztɛlwastel,ɛkstɝpeɪtextirpate,sɪnænθərɒlədʒisynantherology,viəməntvehement
Word Segmentation
Word Segmentation
The next phase of the project entails segmenting the words and their phonetic representations into smaller substrings of length 2, 3, and 4. First, we can create three lists that store all possible letter combinations of each length using the words in the dataset above.
Given a specification for substring length and dataset, produce a list of letter combinations that appear in the word list:
In[]:=
findCombos[num_,ls_]:=Sort[DeleteDuplicates[Flatten[StringPartition[#,num,1]&/@ls]]]letterCombos2=findCombos[2,allWords];letterCombos3=findCombos[3,allWords];letterCombos4=findCombos[4,allWords];phonemeCombos2=findCombos[2,allPhonetics];phonemeCombos3=findCombos[3,allPhonetics];phonemeCombos4=findCombos[4,allPhonetics];
Below is a truncated list of the two-letter combinations found in allWords, stored in letterCombos2. Similarly, letterCombos3 has combinations like {aab, aad, aaf...} and letterCombos4 {aabi, aads, aage...}.
aa,ab,ac,ad,ae,af,ag,,zq,zt,zu,zv,zw,zy,zz
Likewise, phonemeCombos2, phonemeCombos3, and phonemeCombos4 store phoneme combinations of each length. These lists will allow us to store the frequency of each letter combination linking back to each language.
In order to calculate these frequencies, we need a count of each time a letter or phoneme combination appears in a word that originates from any one language. For example, every time the substring “aa” appears in a Hindi-derived word, the Hindi position of the list of counts for “aa” should be incremented by one. Before we can begin counting, we must initialize a list of zeros — one for every possible origin language — for each combination.
Taking the list of possible letter/phoneme combinations (found above) for each length, associate each combination to a list of zeros:
In[]:=
mapCounts[combos_]:=Association[#->Table[0,Length[validLangs]]&/@combos]letterComboCt2=mapCounts[letterCombos2];letterComboCt3=mapCounts[letterCombos3];letterComboCt4=mapCounts[letterCombos4];phonemeComboCt2=mapCounts[phonemeCombos2];phonemeComboCt3=mapCounts[phonemeCombos3];phonemeComboCt4=mapCounts[phonemeCombos4];
The output below shows the first element of each of the associations defined in the code above. As visible, every combination has a corresponding list of zeros, which will serve as the counts of the given combination originating from each language.
Letter form:
aa{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
aab{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
aabi{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
Phonetic form:
ŋɔ{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
ŋəʃ{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
ŋəʃɔ{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
Subsequently, we must split each word in the dataset into all possible substrings of length 2, 3, and 4, both in orthographic and phonetic form.
Taking a specification for substring length and dataset, split every word into substrings of that length:
In[]:=
mapCombos[num_,ls_]:=Association[#->DeleteDuplicates[StringPartition[#,num,1]]&/@ls];letterComboMap2=mapCombos[2,allWords];letterComboMap3=mapCombos[3,allWords];letterComboMap4=mapCombos[4,allWords];phonemeComboMap2=mapCombos[2,allPhonetics];phonemeComboMap3=mapCombos[3,allPhonetics];phonemeComboMap4=mapCombos[4,allPhonetics];
The output below again shows the first element of each association created in the above code. As the first word in allWords happens to be “portmanteau”, this is the first word that is split into substrings and stored in each map.
Letter form:
portmanteau{po,or,rt,tm,ma,an,nt,te,ea,au}
portmanteau{por,ort,rtm,tma,man,ant,nte,tea,eau}
portmanteau{port,ortm,rtma,tman,mant,ante,ntea,teau}
Phonetic form:
pɔrtmæntoʊpɔ,ɔr,rt,tm,mæ,æn,nt,to,oʊ
pɔrtmæntoʊpɔr,ɔrt,rtm,tmæ,mæn,ænt,nto,toʊ
pɔrtmæntoʊpɔrt,ɔrtm,rtmæ,tmæn,mænt,ænto,ntoʊ
Data Collection
Data Collection
We are now prepared to go through every word in the dataset and count how many times each of its substrings occurs in a word that originates in each language.
To start, we can create a function that effectively increments the count of a given substring and the language it was found to be correlated with. Recall that every letter and phoneme combination is associated with a list initially filled with zeros, each meant to count the occurrences of a different origin language. validLangs, defined in the Initialization section, is a list of every language appearing as an origin in the dataset. We can keep the order of validLangs and each list of counts the same, so that we know which count belongs to which language.
To start, we can create a function that effectively increments the count of a given substring and the language it was found to be correlated with. Recall that every letter and phoneme combination is associated with a list initially filled with zeros, each meant to count the occurrences of a different origin language. validLangs, defined in the Initialization section, is a list of every language appearing as an origin in the dataset. We can keep the order of validLangs and each list of counts the same, so that we know which count belongs to which language.
Given any letter or phoneme combination, add one to the count for the given word origin:
In[]:=
updateCount[combo_,origin_,ls_]:=Module[{temp=ls[combo],idx=FirstPosition[validLangs,origin][[1]]},temp[[idx]]+=1;temp];
Call updateCount for each two-letter combination:
In[]:=
Module[{combos=letterComboMap2[#],origin=Lookup[originMap,#]},Table[letterComboCt2[combo]=updateCount[combo,origin,letterComboCt2],{combo,combos}]]&/@allWords;
Repeat for three-and-four-letter combinations (note how we must repeat the code because there is no simple way to pass an Association as an argument and simultaneously modify it in-place):
In[]:=
Same process for phoneme combinations:
In[]:=
Now, we have a separate Association for each length of substrings, where each key represents a letter combination (e.g., “aa”, “aab”, “aaba”) or a phoneme combination (e.g., “ŋɔ”, “ŋəʃ”, “ŋəʃɔ”) and each value is a list of the number of times that combination appears in words from each language. Below is a visualization of the words containing the segment “ana” in the dataset, a root word that primarily originates from Greek language.
Out[]=
Frequency of 'ana' across origin languages |
It is unsurprising that the segment appears most often in words of Ancient Greek origin, because it is an established Greek root word. What is more interesting is the result of probing patterns of combinations that are not necessarily attributed to any one origin. Take the graph of the segment “cha” as an example. It happens to be widely found in words from French and Ancient Greek, despite not being recognized as a root or affix in either of these languages. Finding patterns in seemingly arbitrary letter and phoneme combinations like “cha” could provide valuable guidance regarding the etymology of different words.
However, it is important to recognize that the set of words being used does not contain an even representation of every language. Around 28% of the words in allWords have a Latin origin, 11% Ancient Greek, and 10% Middle English, leaving the other half of the words to be spread across 32 other languages. We are looking to calculate the probability of a word being of any of these origins simply based on the languages its substrings most frequently map to, which is directly reliant on the words in the dataset. Therefore, there is a clear risk of bias towards overrepresented languages.
To account for this skew in the word data, we can create a function that scales the counts based on the number of times the origin language appears at all throughout the dataset. This way, words with lower frequencies will have a slightly augmented count in the table. For instance, if “aa” maps to both Latin and Middle Dutch only once throughout allWords, but Latin appears in the the dataset 10,619 times and Middle Dutch appears only 114 times, the latter count will be scaled up, as 1 out of 114 words is far more significant than 1 out of 10,619.
To account for this skew in the word data, we can create a function that scales the counts based on the number of times the origin language appears at all throughout the dataset. This way, words with lower frequencies will have a slightly augmented count in the table. For instance, if “aa” maps to both Latin and Middle Dutch only once throughout allWords, but Latin appears in the the dataset 10,619 times and Middle Dutch appears only 114 times, the latter count will be scaled up, as 1 out of 114 words is far more significant than 1 out of 10,619.
Taking the Association of combinations and counts, divide each count by the total number of words originating from that language in the dataset:
After partially normalizing the data, we can start to analyze which letter combinations are most likely to be from which languages.
Given the origins with the highest count for any given letter combination, calculate the probability that the combination serves as an indicator of each language:
Along with using these functions to draw relationships, we can discard the letter combinations that do not seem to provide significant information on the origin of a word. If a word mainly maps to five or fewer languages, it likely has a meaningful correlation with these origins, as compared to having an equal distribution across all 35 languages.
Taking the Association of combinations and counts, calculate the probabilities with the helper functions above, keeping only the combinations that are most unique to specific languages:
The output below depicts the first element of probs2, probs3, and probs4, respectively, for each combination type. Taking an example from the data shown, if a word contains the substring “abac”, this is most likely (45.5% probability) an indicator of Portuguese roots.
Letter form:
Phonetic form:
Predictor Functions
Predictor Functions
Separate Approach
Separate Approach
Having collected the essential data, we can create two functions that aim to accurately predict the origin of any word spoken in the English language solely based off the origins of its smaller segments. One function will use letter data and the other, phoneme data. To do this, we’ll add up the scores for each language across all the substrings and then divide these subtotals by the sum of all scores to get the individual probabilities, at last outputting the languages that the word has the highest probability of originating from. We can do this for both the orthographic and phonetic forms of the word, using Wolfram WordData to obtain its IPA representation.
Construction
Construction
Taking a word and a combination length as input, return the relevant substrings appearing in the word:
Using the substrings provided by the above function and the earlier-calculated probabilities, compute the final probability that each substring originates from any language:
Combine the probabilities for each length substring to find a holistic probability that takes substrings of all length into account, first orthographically and then phonetically:
Sort the probabilities, from highest to lowest, that the word originates from each correlated language based on its letters and phonemes:
The chunks of code above can be joined into two separate functions -- one using letter data and one using phonetic data:
Sample run:
The output above shows the calculated probabilities that the word “word” originates from each of the languages the functions found it to be associated with. According to the functions, the word is most likely to be Proto-West Germanic in origin, closely followed by Old English.
Analysis of Accuracy
Analysis of Accuracy
To assess how accurate the predictions of each function are, we can perform the process on both the standard written and IPA forms of a large sample from our original dataset and then compare how many predictions were right for each format. To account for answers that are close enough to be considered correct (e.g., the function returns Proto-Germanic for a word that has Proto-West Germanic origins in the database), we will count an iteration as correct if the right language of origin appears in any of the top three highest probabilities outputted by the function.
Above are the proportions of correct and incorrect answers when the functions are run on approximately 15,000 words from the original dataset. As made clear by the charts, predictions based on letter combinations tend to be slightly more accurate. The weaker performance of the phonetic-based predictions could possibly be due to the slightly smaller dataset of phonetic words (23,000 compared to 38,000 standard written words) from which we extracted the counts and primary probabilities, translating to less information on phonetic patterns and their relationships with different languages.
Another explanation, more grounded in historical linguistics as opposed to data quality, could be that the way words sound (exactly the information provided by a word written in IPA format) is simply not a reliable predictor of the origin of a language. Many words from differing origins can be similar-sounding; for instance, the word “school” originates from Ancient Greek yet starts out phonetically identical to “skirt”, which is from Old Norse. The reason that investigating letter combinations leads to more accurate results might be because the spelling of the word is often more preservative of etymological roots than its pronunciation. By looking at the contrasting letter combinations that make up the beginnings of “school” and “skirt”, the difference in their origins is much clearer.
We can also explore what happens when we increase leniency in classifying answers as correct and incorrect. If we ignore the historical stage of the predicted language and only regard its main family (e.g., the prediction that a Medieval Latin word originates from any kind of Latin is correct, be it Late Latin, Medieval Latin, or New Latin), there is a sharp increase in accuracy.
Another explanation, more grounded in historical linguistics as opposed to data quality, could be that the way words sound (exactly the information provided by a word written in IPA format) is simply not a reliable predictor of the origin of a language. Many words from differing origins can be similar-sounding; for instance, the word “school” originates from Ancient Greek yet starts out phonetically identical to “skirt”, which is from Old Norse. The reason that investigating letter combinations leads to more accurate results might be because the spelling of the word is often more preservative of etymological roots than its pronunciation. By looking at the contrasting letter combinations that make up the beginnings of “school” and “skirt”, the difference in their origins is much clearer.
We can also explore what happens when we increase leniency in classifying answers as correct and incorrect. If we ignore the historical stage of the predicted language and only regard its main family (e.g., the prediction that a Medieval Latin word originates from any kind of Latin is correct, be it Late Latin, Medieval Latin, or New Latin), there is a sharp increase in accuracy.
Now, the majority of guesses made by the functions are classified as correct, and the two approaches are almost equivalent in accuracy level. The contrast between these charts and the previous two suggests that analyzing the segments of a word may provide strong clues about its language of origin, yet it is less effective in identifying the precise era of that language.
Joint Approach
Joint Approach
Alternative to two separate functions, we can utilize the information from combinations of both letters and phonemes to create one function that makes an optimized prediction. Given that the letter combinations seem to be more directly indicative of word origins, we can assign the probabilities from predictL a larger multiplier, heightening their influence on the final decision.
Construction
Construction
Merge the two functions into one by multiplying the separate-approach probabilities by a set weight and taking their sum:
Sample run:
Analysis of Accuracy
Analysis of Accuracy
The joint function combines the strong points of the two approaches, leading to optimal origin predictions. When we run the code on the same sample used earlier, implementing the lenient correctness classification system, accuracy increases by approximately three percent, as visible in the chart below.
User Interface
User Interface
This mini-interface allows users to explore the etymology of English words using the predictor function in a fun and interactive way.
Note: Due to gaps in Wolfram WordData, this algorithm uses the Wolfram LLM Kit and WordPhoneticSyllabify from the Wolfram Function Repository to get the phonetic representation of unknown words. If the user does not have access to the LLM Kit and inputs a word missing from Wolfram’s built-in phonetic WordData, an error may occur.
Conclusions, Limitations, and Extensions
Conclusions, Limitations, and Extensions
This project provided insight on how splitting a word into smaller segments can offer key information on the languages it originates from. By examining both the combinations of letters and phonemes (given by IPA format), we were able to create a function that is over 50% accurate in its language origin predictions of English words given no prior information about their roots. While the two approaches were fairly similar in accuracy, the letter-based predictions predominantly outperformed the phonetic-based ones, leading us to postulate that the spelling of a word is more relevant to its origin than its pronunciation. Ultimately, combining the two approaches yielded the best results, highlighting the complementary strengths of each prediction method.
Despite its breakthroughs, this project included substantial limitations:
◼
The dataset containing phonetic representations was smaller than that of standard spellings, partly due to missing data in Wolfram and slow rendering times, creating a possible hole in understanding of the role of phonetics in language origin.
◼
There was a lack of specificity regarding what step of the derivation the origins in originMap were from, leading to questionable accuracy (e.g., a word marked as French may have been borrowed from French at only the last etymological stage, when its true beginnings were in Latin instead).
◼
The dataset was largely skewed towards words originating from Latin and Greek, limiting insights into words from other minority languages. Using a weighting system helped, but did not fully eliminate this bias.
Future work should focus on expanding the dataset to broader sources beyond a GitHub dictionary, which would help to get more words originating from a larger scope of languages. Additionally, dividing the words at different syllables rather than finding every possible character combination could optimize prediction accuracy, which in turn may be applied to etymological research, translation software, and multilingual NLP systems. Lastly, further analysis can be conducted across languages — for example, studying the origins of French and German words — to explicitly define a relationship between the origin of a word and the substrings of letters and phonemes appearing within it.
Acknowledgements
Acknowledgements
I would like to thank my mentor, Mark Greenberg, for authoring the Wolfram ResourceFunction I used within my interface and for providing me with expert guidance throughout this project. Additionally, I appreciate my group members, especially Adit, as well as Anne and the other program TAs, for helping me brainstorm and debug my code. Finally, I extend a profound thank-you to the directors of WSRP ’25 for organizing this opportunity.
References
References
◼
◼
Roher, D. (2023, December 5). etymology-db [Source code]. GitHub. https://github.com/droher/etymology-db
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Predicting Word Origins Based on Substrings
by Viola Pande
Wolfram Community, STAFF PICKS, July 10, 2025
https://community.wolfram.com/groups/-/m/t/3498608
by Viola Pande
Wolfram Community, STAFF PICKS, July 10, 2025
https://community.wolfram.com/groups/-/m/t/3498608