Skip to main content

A lightweight library for quantifying the similarity between two strings

Project description

TSim

GitHub Created At GitHub commit activity GitHub contributors
GitHub last commit PyPI - Downloads

A lightweight string similarity quantifier, with support for names

What it does

TSim (Text Similarity) is a quantifier for similarity of strings. It reports the extent of similarity of two strings. TSim accounts for errors like OCR errors, different ordering, abbreviation and more.

Features

  • Compensation for OCR errors related to similar looking characters (eg. 5 and S; 0 and O)
  • Compensation for over-detection and under-detection of text by OCR systems
  • Compensation for different ordering of names (eg. FirstName-LastName and LastName-FirstName)
  • Compensation for abbreviation in names (eg. Sanyam Asthana and S. Asthana)

Installation

TSim can be installed via pip:

pip install tsim

You can verify the installation by running:

pip show tsim

Usage

To use TSim, you first need to install it using pip.

To use TSim in a project, you need to import the library in your project using import tsim

Functions

get_confidence()

Returns the confidence/error of similarity of two strings

Parameters:
received_str – The string to compare
expected_str – The string to be expected in the comparison
mode"c" to return confidence, "e" to return the error

Returns: Confidence (0-1)/Error depending on the mode used

get_abbreviated_confidence()

Returns the confidence of similarity of two strings taking into account abbreviated part of the string

Parameters:
received_str – The string to compare
expected_str – The string to be expected in the comparison
mode"c" to return confidence, "e" to return the error

Returns: Confidence (0-1)/Error depending on the mode used

get_name_confidence()

Returns the confidence of similarity between two names

Parameters:
received_name – The name to compare
expected_name – The name to be expected in the comparison

Returns: The confidence level of the similarity of the names (0-1)

Technical Details

  • Python 3.7+
  • Uses an error based confidence system, with different penalties per kind of error.
  • Uses a dictionary for OCR character similarity matching

License

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

tsim-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

tsim-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file tsim-0.1.0.tar.gz.

File metadata

  • Download URL: tsim-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for tsim-0.1.0.tar.gz
Algorithm Hash digest
SHA256 35027df769f26986cd7875cb1616ca7144ade11bf4828743b179253681693770
MD5 4c8d0e72fede820b14d279a86188b2a5
BLAKE2b-256 27f6af38d359436d159728d57ccf9b60590394a2efc58aebe11ded4564470d9b

See more details on using hashes here.

File details

Details for the file tsim-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tsim-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for tsim-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e3fbd26d51a122191a49bfa28c80ea8c1844ca63c9bc169de9760893705843b
MD5 3af5e893973dc55be38c3f39d9d634cd
BLAKE2b-256 a87e1dc75fffb843e135e74f4e101214046d50e85ddd8ba0cd1c2c80c3b77498

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