Skip to main content

NYSIIS phonetic encoding algorithm.

Project description

NYSIIS Python Package Version

The pynysiis package provides a Python implementation of the New York State Identification and Intelligence System (NYSIIS) phonetic encoding algorithm. NYSIIS encodes names based on pronunciation, which is helpful in name-matching and searching applications.

Requirements

Python 2.7 and later.

Setup

You can install this package by using the pip tool and installing:

$ pip install pynysiis

Or:

$ easy_install pynysiis

Usage Example

# Basic Usage
from nysiis import NYSIIS

# Create an instance of the NYSIIS class
nysiis = NYSIIS()

# Encode a string using the NYSIIS instance
name = "Watkins"
coded_name = nysiis.encode(name)
print(coded_name) # Output: "WATCAN"


## Comparing Names
from nysiis import NYSIIS

# Create an instance of the NYSIIS class
nysiis = NYSIIS()

name1 = "John Smith"
name2 = "John Smyth"

coded_name1 = nysiis.encode(name1)
coded_name2 = nysiis.encode(name2)

if coded_name1 == coded_name2:
    print("The names are likely to be the same.")
else:
    print("The names are different.")

# Output:
# The names are likely to be the same.


## Handling different names
from nysiis import NYSIIS

# Create an instance of the NYSIIS class
nysiis = NYSIIS()

names = ["Watkins", "Robert Johnson", "Samantha Williams", "Olanrewaju Akinyele",
        "Obinwanne Obiora", "Abdussalamu Abubakar", "Virat Kohli", "Usman Shah"]

for name in names:
    coded_name = nysiis.encode(name)
    print(f"Original: {name}, NYSIIS: {coded_name}")

    # Output:
    # Original: Watkins, NYSIIS: WATCAN
    # Original: Robert Johnson, NYSIIS: RABART
    # Original: Samantha Williams, NYSIIS: SANANT
    # Original: Olanrewaju Akinyele, NYSIIS: OLANRA
    # Original: Obinwanne Obiora, NYSIIS: OBAWAN
    # Original: Abdussalamu Abubakar, NYSIIS: ABDASA
    # Original: Virat Kohli, NYSIIS: VARATC
    # Original: Usman Shah, NYSIIS: USNANS

Reference

@inproceedings{Rajkovic2007,
  author    = {Petar Rajkovic and Dragan Jankovic},
  title     = {Adaptation and Application of Daitch-Mokotoff Soundex Algorithm on Serbian Names},
  booktitle = {XVII Conference on Applied Mathematics},
  editors   = {D. Herceg and H. Zarin},
  pages     = {193--204},
  year      = {2007},
  publisher = {Department of Mathematics and Informatics, Novi Sad},
  url       = {https://jmp.sh/hukNujCG}
}

Additional References

License

This project is licensed under the MIT License.

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

pynysiis-1.0.4.tar.gz (16.0 kB view hashes)

Uploaded Source

Built Distribution

pynysiis-1.0.4-py3-none-any.whl (14.5 kB view hashes)

Uploaded Python 3

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