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];];