Text Aligner
Project description
Text Aligner
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
Project details
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c931684e88cc658db08cc97dd92e8960a0d055e22a8f0f76d70274fdfc2a5330
|
|
| MD5 |
d7106f9995408faa3ef858f9e36bc501
|
|
| BLAKE2b-256 |
2c22cae61dcdd210f0c5d9249a15e1b958cf5e77632613e4ddac2416aad3d32f
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b6ac1213414cec4e9ac9cc9852f6512bba85b73908d269042f249edce571846
|
|
| MD5 |
7f98f3b944276083cfaf7d1ed4068fe9
|
|
| BLAKE2b-256 |
debe1716815389ff520e533c24479161f4379ee5bd40ebdbe0cbfe9af4608c7f
|