Phonetics algorithms (Soundex and Metaphone) for russian, english, sweden, finnish and estonian languages
Project description
Fonetika
Russian, English, Sweden, Estonian and Finnish Phonetic algorithm based on Soundex/Metaphone.
Package has both implemented phoneme transformation into letter-number sequence and distance engine for comparison of phonetic sequences (based on Levenstein and Hamming distances).
Furthermore, both Russian phonetic algorithms supports preprocessing for specific phoneme cases.
Quick start
- Install this package via
pip
pip install fonetika
- Import Soundex algorithm.
Package supports a lot of opportunities, it's possible to cut a result sequence (like in the original Soundex version) or also code vowels.
from fonetika.soundex import RussianSoundex
soundex = RussianSoundex(delete_first_letter=True)
soundex.transform('ёлочка')
...
J070530
soundex = RussianSoundex(delete_first_letter=True, code_vowels=True)
soundex.transform('ёлочка')
...
JA7A53A
A structure of the library is scalable,
RussianSoundex
class inherits basic classSoundex
(original for English language). In order to extend our algorithm, you need just inherit own class fromSoundex
and override methods.
- Import Soundex distance for usage of string comparision
from fonetika.distance import PhoneticsInnerLanguageDistance
soundex = RussianSoundex(delete_first_letter=True)
phon_distance = PhoneticsInnerLanguageDistance(soundex)
phon_distance.distance('ёлочка', 'йолочка')
...
0
- You can also calculate distance between words of two languages. It would be useful for working with one language family group.
from fonetika.distance import PhoneticsBetweenLanguagesDistance
m1 = FinnishMetaphone(reduce_word=False)
m2 = EstonianMetaphone(reduce_word=False)
phon_distance = PhoneticsBetweenLanguagesDistance(m1, m2)
phon_distance.distance('yö', 'öö')
...
1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file fonetika-1.4.9.tar.gz
.
File metadata
- Download URL: fonetika-1.4.9.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ead843ad492204cbd3577a6ef44a835ea706e859d58b5a963c9fad31a0f7be5 |
|
MD5 | 9620f56f89f66434bb3f164d3c0f0d41 |
|
BLAKE2b-256 | 498d1841acca97ddabe65550b4d5c0aa2c4ed36a77325e039523aaaf66cd38d3 |