Skip to main content

A Python 3 phonetics library.

Project description

Pyphonetics is a Python 3 library for phonetic algorithms. Right now, the following algorithms are implemented and supported:

  • Soundex

  • Metaphone

  • Refined Soundex

  • Fuzzy Soundex

  • Lein

  • Matching Rating Approach

More will be added in the future.

Instalation

The module is available in PyPI, just use pip install pyphonetics.

Usage

>>> from pyphonetics import Soundex
>>> soundex = Soundex()
>>> soundex.phonetics('Rupert')
'R163'
>>> soundex.phonetics('Robert')
'R163'
>>> soundex.sounds_like('Robert', 'Rupert')
True

The same API applies to every algorithm, e.g:

>>> from pyphonetics import Metaphone
>>> metaphone = Metaphone()
>>> metaphone.phonetics('discrimination')
'TSKRMNXN'

You can also use the distance(word1, word2, metric=’levenshtein’) method to find the distance between 2 phonetic representations.

>>> from pyphonetics import RefinedSoundex
>>> rs = RefinedSoundex()
>>> rs.distance('Rupert', 'Robert')
0
>>> rs.distance('assign', 'assist', metric='hamming')
2

Credits

The module was largely based on the implementation of phonetic algorithms found in the Talisman.js (https://github.com/Yomguithereal/talisman) Node NLP library.

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

pyphonetics-0.5.3.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyphonetics-0.5.3-py2.py3-none-any.whl (10.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyphonetics-0.5.3.tar.gz.

File metadata

  • Download URL: pyphonetics-0.5.3.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.18.4

File hashes

Hashes for pyphonetics-0.5.3.tar.gz
Algorithm Hash digest
SHA256 2d3c2e359fde91a3c57914f0b5468bba7a5daf38e7927fd999992ea68990fbe4
MD5 550d46d06d2f8c07831fca6041d7e6fe
BLAKE2b-256 d67c7c45a9e9bf6ddb57b67e66cf4e8076a7baf3a790a3411daac1a7a2df0c5b

See more details on using hashes here.

File details

Details for the file pyphonetics-0.5.3-py2.py3-none-any.whl.

File metadata

  • Download URL: pyphonetics-0.5.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.18.4

File hashes

Hashes for pyphonetics-0.5.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e6b29671d0d624dda1cac59c0c5a8a7216d8db504bae4941bfc482e04a0621d1
MD5 79f177174b13c77eb737d041f374b3df
BLAKE2b-256 bddda7d0a860efd3d4335d538b4361b8e9af8311f2aba2e8c7e4c7a47d623b6e

See more details on using hashes here.

Supported by

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