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.1.tar.gz (10.0 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.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: text_aligner-0.0.1.tar.gz
  • Upload date:
  • Size: 10.0 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.1.tar.gz
Algorithm Hash digest
SHA256 3406865787c271326ff65fd933a4c1bd87b2ca830bae519a774bcc736623c226
MD5 cede30582f0fcdfc64bdb1e0cf925ba0
BLAKE2b-256 1d7125bf556c4472e339f18154d5637554d78944b11b16ec25b984bae3b24539

See more details on using hashes here.

File details

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

File metadata

  • Download URL: text_aligner-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1c21328b3f54f11f632fd5f578c68d272a9f5a9cbf5b0d76cbd8f2220839ef67
MD5 8b617cb1023985a1127a09389a925994
BLAKE2b-256 bfb9e0e91d19a4c0bbb0d9f2d5627fabbca1e4da9fb2c48d17de489036df456f

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