Group Abstract Group Abstract

Message Boards Message Boards

Equations between Languages

Posted 8 years ago
POSTED BY: Mohammed Ismaeil
3 Replies
POSTED BY: Todd Rowland

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:

enter image description here

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

enter image description here

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]

enter image description here

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

enter image description here

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

enter image description here

POSTED BY: Marco Thiel
POSTED BY: Mohammed Ismaeil
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard