Skip to main content

simsoword

simsoword is a lightweight Python package for comparing words using phonetic-aware and edit-distance-based similarity metrics.

The package is designed to determine whether two words are similar based on configurable similarity boundaries and threshold scores.

It provides:

  • Jaro-Winkler similarity scoring
  • Levenshtein similarity scoring
  • configurable threshold matching
  • optional text normalization
  • simple and intuitive APIs

Motivation

Different similarity algorithms behave differently depending on the use case.

For example:

  • "nite" and "night" sound similar phonetically
  • "color" and "colour" are spelling variants
  • "book" and "back" are structurally different

A single similarity metric is often insufficient.

simsoword provides two comparison boundaries:

Boundary Algorithm Behavior
easy Jaro-Winkler More liberal and pronunciation-aware
hard Levenshtein More strict and spelling-sensitive

This allows users to choose the type of similarity comparison required for their application.


Features

  • Lightweight and fast
  • Simple API design
  • Optional preprocessing pipeline
  • Percentage-based similarity scoring
  • Threshold-based boolean matching
  • Jaro-Winkler similarity
  • Levenshtein similarity
  • PyPI-ready architecture
  • Easy integration into NLP and phonetic applications

Installation

Install from PyPI

pip install simsoword

Local Development Installation

Clone the repository:

git clone https://github.com/yourusername/simsoword.git

Move into the project directory:

cd simsoword

Install in editable mode:

pip install -e .

Dependencies

simsoword currently depends on:

  • jellyfish

Install manually if needed:

pip install jellyfish

Package Structure

simsoword/
│
├── simsoword/
│   ├── __init__.py
│   ├── core.py
│   ├── metrics.py
│   ├── preprocess.py
│   ├── exceptions.py
│   └── utils.py
│
├── tests/
│   ├── test_preprocess.py
│   ├── test_score.py
│   └── test_match.py
│
├── README.md
├── LICENSE
├── pyproject.toml
└── requirements.txt

Supported Similarity Algorithms

1. Jaro-Winkler Similarity

Used when:

boundary="easy"

Characteristics:

  • More liberal
  • Better for realistic pronunciation matching
  • Good for fuzzy matching
  • Useful for phonetic similarity

Example:

"nite" vs "night"

May produce a relatively high similarity score.


2. Levenshtein Similarity

Used when:

boundary="hard"

Characteristics:

  • More strict
  • Based on edit distance
  • Sensitive to spelling changes
  • Better for exact structural similarity

Text Normalization

By default:

normalize=True

Normalization performs:

  • lowercase conversion
  • removal of non a-z characters
  • validation against spaces

Example

Input

"HeLLo123!!"

Output

"hello"

Public APIs

The package currently exposes two primary functions:

get_score()
is_similar()

Function Documentation


1. get_score()

Computes similarity score between two words.


Syntax

get_score(
    word1: str,
    word2: str,
    boundary: str = "easy",
    normalize: bool = True
) -> float

Parameters

Parameter Type Description
word1 str First input word
word2 str Second input word
boundary str "easy" or "hard"
normalize bool Apply preprocessing or not

Returns

float

Similarity score between 0 and 100.


Example

from simsoword import get_score

score = get_score(
    "nite",
    "night"
)

print(score)

Example Output

84.72

2. is_similar()

Checks whether similarity score exceeds threshold.


Syntax

is_similar(
    word1: str,
    word2: str,
    threshold: float = 80.0,
    boundary: str = "easy",
    normalize: bool = True
) -> bool

Parameters

Parameter Type Description
word1 str First input word
word2 str Second input word
threshold float Matching threshold
boundary str "easy" or "hard"
normalize bool Apply preprocessing or not

Returns

bool

Example

from simsoword import is_similar

result = is_similar(
    "nite",
    "night",
    threshold=75
)

print(result)

Example Output

True

Boundary Modes

Easy Boundary

boundary="easy"

Uses:

  • Jaro-Winkler similarity

Recommended for:

  • phonetic similarity
  • fuzzy matching
  • pronunciation-aware comparisons

Hard Boundary

boundary="hard"

Uses:

  • Levenshtein similarity

Recommended for:

  • strict spelling comparison
  • typo-sensitive matching
  • exact textual similarity

Examples


Example 1: Default Comparison

from simsoword import get_score

score = get_score(
    "nite",
    "night"
)

print(score)

Example 2: Strict Comparison

from simsoword import get_score

score = get_score(
    "nite",
    "night",
    boundary="hard"
)

print(score)

Example 3: Disable Normalization

from simsoword import get_score

score = get_score(
    "Hello!!",
    "hello",
    normalize=False
)

Example 4: Boolean Similarity Check

from simsoword import is_similar

result = is_similar(
    "colour",
    "color",
    threshold=70
)

print(result)

Invalid Input Types

TypeError:
Input must be a string

Version

Current version:

0.1.0

Future Roadmap

Planned future features include:

  • Soundex support
  • Metaphone support
  • Double Metaphone support
  • multilingual normalization
  • configurable preprocessing pipelines
  • sentence-level similarity
  • CLI support
  • custom scoring strategies

Contributing

Contributions are welcome.

Possible contribution areas:

  • additional phonetic algorithms
  • optimization
  • multilingual support
  • benchmark datasets
  • documentation improvements
  • testing improvements

License

This project is licensed under the MIT License.

See the LICENSE file for more information.


Author

Developed by Manish Prajapati.

Contact

For suggestions, improvements, bug reports, or collaboration opportunities, feel free to reach out.


Acknowledgements

This package uses:

  • jellyfish for similarity algorithms

Keywords

phonetics, fuzzy matching, jaro winkler, levenshtein distance, string similarity, NLP, speech processing, text similarity, pronunciation matching

Metadata

Release files for simsoword 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simsoword 0.1.0
File Size Uploaded Provenance Actions
simsoword-0.1.0.tar.gz 5.8 kB Without provenance Details for simsoword-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simsoword 0.1.0
File Interpreter ABI Platform Actions
simsoword-0.1.0-py3-none-any.whl Python 3 none any Details for simsoword-0.1.0-py3-none-any.whl

Total release size: 12.6 kB

Release files / simsoword-0.1.0.tar.gz

Download URL simsoword-0.1.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
20e2356255a79023515423245337c853ba982ce1e1813194cf4d2628e4726703
BLAKE2b-256 checksum
How to use checksums
5309fd8409ca321895170a26ad26852d5708b366d44bff53f42a52843f753718
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release files / simsoword-0.1.0-py3-none-any.whl

Download URL simsoword-0.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32e74cfb66e039c92252005b0e6b64a9a4369bdaeb532dbd6ddc930d66e684c5
BLAKE2b-256 checksum
How to use checksums
41fa3be12b79f4ba83fbd8cde5361192039219b5e2bd1b6922fce7f6c21b1756
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Security for simsoword 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page