Equations between Languages

Dear All,

I got an idea that every word in any language has a unique value depending on the letters contained in it
and the rank of each letter. For example “he” = “e” rank in alphabet * base^0 + “h” rank in alphabet * base^1

so we can make this for other language like German so we can translate between them based on an equation.

I made a function pass the word and the base and return the value. I need your review about this.

Weight[str__, base_] := 
  Module[{w = 0, word, i, temp, int, chars, p = 0},
   chars = CharacterRange["a", "z"];
   word = ToLowerCase[str];
   For[i = StringLength[word], i >= 1, i--,
    temp = StringTake[word, {i}];
    If[ Position[chars, temp] != {}, 
     int = Position[chars, temp][[1]][[1]];, int = 0;];


w += (int base^p ); p += 1;];
Return[w];];

Hi,

this gives slightly different results than your function, but if I understand your project, it might be similar to what you want. First, I create substitution rules, i.e. rules that substitute letters by a digit. Note that there are 26 letters (well in my world) and only 10 standard digits, so I use the first letters of the alphabet to fill the digits up.

substitutions = Join[Rule @@@ Transpose[{CharacterRange["a", "z"], Join[Range[0, 9], Alphabet[][[1 ;; 16]]]}], 
Rule @@@ Transpose[{CharacterRange["A", "Z"], Join[Range[0, 9], Alphabet[][[1 ;; 16]]]}]]

The following function takes a world list and converts that to base 26 numbers that it then prints after conversation to decimal numbers.

  {#, ToExpression["26^^" <> StringJoin[(ToString /@ (Characters[#] /. substitutions))]]} & /@WordList[]

I use the WordList function that contains about 40.000 words. The output looks like this:

There are some symbols that destroy the result, so I will use only words that contain standard letters (and not hyphens etc):

wordnumbers={#, ToExpression["26^^" <> StringJoin[(ToString /@ (# /. substitutions))]]} & /@ 
Select[Characters[WordList[]], ContainsAll[Join[CharacterRange["a", "z"], CharacterRange["A", "Z"]], #] &]

I can then order the words with respect to their “value”:

sortedList= SortBy[wordnumbers, Last]

If we then want to concatenate the letters to form the words we use:

StringJoin /@ SortBy[wordnumbers, Last][[All, 1]]

Is what you require similar to this?

Best wishes,
Marco

PS: It is actually nice to plot this in several different ways:

ListLogPlot[SortBy[wordnumbers, Last][[All, 2]], ImageSize -> Large]

ListLogLogPlot[Reverse@SortBy[wordnumbers, Last][[All, 2]], ImageSize -> Large]

ListLogPlot[wordnumbers[[All, 2]], ImageSize -> Large]

3 Likes

Thank you Marco but I have 3 notes

  1. Why including the decimal digits in your function because numbers has the same meaning and value between people.

  2. you used the base of 26 why not trying another bases?

  3. what if we applied this to another language like German can we translate using equations like EngValue= GermanValue -10 ?

Unfortunately this neat idea is unlikely to work. The parameters are the values of each letter and the base value, which would be 27 variables (or maybe a few more letters used in languages besides English), but the number of equations that would need to be satisfied would be one for every word (with the assumption of direct word for word translation) which would be in the thousands. Generally the number of parameters would need to be at least as many as the number of equations for there to be a solution.

(You should be able to find a set of words in WordData that cannot simultaneously satisfy EnglishValue== a0*GermanValue+a1, if you use Solve)

Marco’s response is more promising. For each language find a picture associated to it instead of trying to find a mathematical relationship between languages.