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.3.tar.gz (10.2 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.3-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: text_aligner-0.0.3.tar.gz
  • Upload date:
  • Size: 10.2 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.3.tar.gz
Algorithm Hash digest
SHA256 c931684e88cc658db08cc97dd92e8960a0d055e22a8f0f76d70274fdfc2a5330
MD5 d7106f9995408faa3ef858f9e36bc501
BLAKE2b-256 2c22cae61dcdd210f0c5d9249a15e1b958cf5e77632613e4ddac2416aad3d32f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: text_aligner-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3b6ac1213414cec4e9ac9cc9852f6512bba85b73908d269042f249edce571846
MD5 7f98f3b944276083cfaf7d1ed4068fe9
BLAKE2b-256 debe1716815389ff520e533c24479161f4379ee5bd40ebdbe0cbfe9af4608c7f

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