| Gematria is a system for assigning a number to a word by summing the numeric values of each of the characters [18]. In the standard encoding (Mispar hechrechi), each characters of the Hebrew alphabet is assigned a numeric values ranging from 1 to 400, but there are more than a dozen other methods for calculating the numeric value for the letters. To encode a word, these values are added together. Revelation 13:18 from the Christian Bible says "Let the one who has insight calculate the number of the wild beast, for it is a man’s number, and its number is 666." Some scholars believe that number is derived from the encoding of the characters representing Nero Caesar’s name and title and was used as a way of writing about the Roman emperor without naming him. |
|
We will write a program called gematria.py that will numerically encode each word in a given text by similarly adding numeric values for the characters in each word. There are many ways we could assign these values; for instance, we could start by given "a" the value 1, "b" the value 2, and so forth. Instead, we will use the ASCII table [19] to derive a numeric for English alphabet characters. For non-English characters, we could consider using a Unicode value, but this exercise will stick to ASCII letters.
The input text may be given on the command line:
$ ./gematria.py 'foo bar baz' 324 309 317
Or in a file: