Skip to main content

A Python package to facilitate numerological analysis on historical and contemporary texts.

Project description

Gematria

The gematria package makes numerological analysis of texts easy and accessible, and supports multiple gematria systems and alphabets/languages. The package can also translate words and sentences back and forth from numbers to letters, preserving capitalization and punctuation from the original strings.

This photo is an example of isopsephy from the Sanctuary of Artemis Orthia, 2nd century AD.

Supported Systems and Alphabets

The package supports the following systems:

When no system is specified by the user, the package defaults to the Agrippa method. The systems above can be called in functions using the following arguments:

  • Agrippa: 'agrippa'
  • Rudolff: 'rudolff'
  • Hebrew: 'hebrew'
  • Greek isopsephy: 'greek'
  • English Qaballa: 'eq'

Installation

The package can be installed via pip:

pip install gematria

Or by cloning the GitHub repository.

Example Usage

To convert a string (or list of strings) to its numerical value, simply pass the string (or list) to the string_values function:

import gematria

# getting the values of individual letters
gematria.conv.string_values('Hi')
# returns [8, 9]

# getting the values of words by passing a list
gematria.conv.string_values(['Hello', 'world'])
# returns [103, 1054]

We can also specify a different dictionary very easily when calling the function:

gematria.conv.string_values(['Hello', 'world'], 'eq')
# returns [40, 30]

To return both the letters/words and their values as tuples, use the string_and_num_values function:

# getting the values of individual letters
gematria.conv.string_and_num_values('Hi')
# returns  [('H', '8'), ('i', '9')]

# getting the values of words by passing a list
gematria.conv.string_and_num_values(['Hello', 'world'])
# returns  [('Hello', '103'), ('world', '1054')]

Specifying a different dictionary:

gematria.conv.string_and_num_values(['Hello', 'world'], 'rudolff')
# returns  [('Hello', '49'), ('world', '67')]

Full List of Functions

Please note: the examples below default to using the Agrippa dictionary. If you would like to use a different dictionary, specify it where 'dict_name' is indicated in the function call.

string_values('string' or [list], 'dict_name')

Takes either a string or list of strings, and outputs a list of integers with the numerological value of the strings passes--e.g., passing ['This', 'is', 'a', 'test.'] returns [207, 99, 1, 295].

Example:

gematria.conv.string_values('Test.')
# returns [100, 5, 90, 100]

string_and_num_values('string' or [list])

Takes either a string or list of letters or words and returns tuples of the letters or words and their numerical values as a list--e.g., passing ['This', 'is', 'a', 'test.'] returns the following: [('This', '207'), ('is', '99'), ('a', '1'), ('test.', '295')].

Example:

gematria.conv.string_and_num_values('Test')
# returns [('T', '100'), ('e', '5'), ('s', '90'), ('t', '100')]

nums_to_list('string' or [list])

Takes either a string or list of numbers and outputs them to a list for later parsing. For a string, ensure there are only "+" signs between numbers for proper parsing (e.g., '100 + 20'). When passing lists, the function can handle multiple words written as strings like the example above--e.g., ['100 + 8 + 9 + 90', '9 + 90'], which returns as ['100', '8', '9', '90', 'space', '9', '90'].

Example:

gematria.conv.nums_to_list(['100 + 8 + 9 + 90', '9 + 90'])
# returns ['100', '8', '9', '90', 'space', '9', '90']

lets_to_nums('string' or [list])

Takes either a string or a list of letters and converts them to numbers, returning a list.

Example:

gematria.conv.lets_to_nums('Test.')
# returns ['100', '5l', '90l', '100l', '.']

nums_to_lets('string' or [list])

Takes either a string or a list of numbers and converts them to letters, returning a list.

Example:

gematria.conv.lets_to_nums(['100', '5l', '90l', '100l', '.'])
# returns ['Test.']

num_list_to_words([list])

Takes a list of numbers and outputs a list of words--e.g., given ['100', '8l', '9l', '90l'], the function returns 'Test'.

Example:

gematria.conv.num_list_to_words(['100', '8l', '9l', '90l', 'space', '9l', '90l', 'space', '1l', 'space', '100l', '5l', '90l', '100l', '.'])
# returns 'This is a test.'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygematria-0.0.1.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

pygematria-0.0.1-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

File details

Details for the file pygematria-0.0.1.tar.gz.

File metadata

  • Download URL: pygematria-0.0.1.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pygematria-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1886cef996ae32ca4d246efaeba591bb14726a9ff1af66147270aedaeed37e6b
MD5 90bf36b19763884773559d582306f366
BLAKE2b-256 27be23b23b61624b7deaee02cce64789518b05c08fc3a6f2223e5c5a90267560

See more details on using hashes here.

File details

Details for the file pygematria-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pygematria-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for pygematria-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5d961260b743bdac7627922849b538b998c4d100588983fb1005aaac66352489
MD5 07dc4f9588496942e747a15e1b448498
BLAKE2b-256 c0d71aa75330b95bf526fd42c58f7f2dab600e22764f74bf1067d8e1544b855d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page