Skip to main content

Text Aligner

Project description

Text Aligner

PyPI License

A Python library for aligning texts based on edit distance algorithms. This tool is particularly useful for comparing and aligning reference texts with hypothesis texts, such as in speech recognition evaluation.

Features

  • Edit Distance Alignment: Uses sequence matching algorithms to align texts based on similarity
  • Space Agnostic Mode: Option to ignore differences in spacing during alignment
  • Punctuation Agnostic Mode: Option to ignore differences in punctuation during alignment

Installation

pip install text-aligner

Usage

Command Line Interface

# Align two individual text strings
align-text "AI cannot replace human creativity" "AI can not replace human creativity."
# Output: AI cannot replace human creativity

align-text "AI can not replace human creativity." "AI cannot replace human creativity"
# Output: AI can not replace human creativity.

align-text "He is a well-known writer." "She is a well known writer"
# Output: She is a well-known writer.

align-text "She is a well known writer" "He is a well-known writer."
# Output: He is a well known writer

# Align texts from scp format files (e.g., `utt_id text`)
align-text ref.txt hyp.txt output.txt

Options

  • -s, --space-agnostic: Ignore differences in spacing (default: True)
  • -p, --punctuation-agnostic: Ignore differences in punctuation (default: True)
  • output-file: Optional output file path (default: stdout)

License

Apache License 2.0

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

text_aligner-0.0.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

text_aligner-0.0.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file text_aligner-0.0.2.tar.gz.

File metadata

  • Download URL: text_aligner-0.0.2.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for text_aligner-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8b39b241a5dde7b93e7f39eea2f4c5686b28a23be19047e0a2c829587a0cc41b
MD5 6baead389a4463c1fe4d873929536724
BLAKE2b-256 28d84d29c6cec572d0e3da0ea76093bb48f37498ec67ba6e4f3ef5cce338fd0e

See more details on using hashes here.

File details

Details for the file text_aligner-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: text_aligner-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for text_aligner-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e2601e9679aea90d79e4ecb22f0ba3cb26fcba21c165bfa8575f897cdbe4ea03
MD5 e62516cd919a9667122812faac43861b
BLAKE2b-256 d3b61f8376d49693544780a1c5dcfe97fbd98131a535b973a07fa4a530b4d2f6

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