Skip to content

Instantly share code, notes, and snippets.

@danielcarr
Last active May 5, 2016 09:58
Show Gist options
  • Save danielcarr/916e833a469289be4193 to your computer and use it in GitHub Desktop.
Save danielcarr/916e833a469289be4193 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
ALEFPOINT = 0x05D0
TAFPOINT = 0x05EA
VALUES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 20, 30, 40, 40, 50, 50, 60, 70, 80, 80, 90, 90, 100, 200, 300, 400]
FINALS = [u'\u05DA', u'\u05DD', u'\u05DF', u'\u05E3', u'\u05E5']
alefbetrange = [unichr(a) for a in range(ALEFPOINT, TAFPOINT + 1)]
gematrimap = dict(zip(alefbetrange, VALUES))
alefbet = ''.join([u for u in alefbetrange if u not in FINALS])
def gematria(word):
return sum([gematrimap.get(a, 0) for a in list(unicode(word, 'utf-8'))])
if __name__ == '__main__':
import sys
for word in sys.argv[1:]:
gematria(word)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment