Alignment tool based on fast_align
Project description
systran-align
systran-align is a small alignment tool that is based on https://github.com/clab/fast_align.
Installation
pip install systran-align
Usage
import systran_align
Generating alignment probabilities
systran_align.generate_alignment_probabilities(
input_path: str,
forward_probs_path: str,
backward_probs_path: str,
verbose: bool = False,
iterations: int = 5,
favor_diagonal: bool = False,
beam_threshold: float = -4,
diagonal_tension: float = 4,
optimize_tension: bool = False,
variational_bayes: bool = False,
alpha: float = 0.01,
no_null_word: bool = False,
prob_align_null: float = 0.08,
thread_buffer_size: int = 10000,
)
Inputs:
input_path
: text file where each line is a source-target example with format:
<source> ||| <target>
Outputs:
forward_probs_path
: binary file containing forward probabilitiesbackward_probs_path
: binary file containing backward probabilities
Computing alignments
aligner = systran_align.Aligner(
forward_probs_path: str,
backward_probs_path: str,
)
# result is a dict with fields:
# * alignments
# * forward_log_prob
# * backward_log_prob
result = aligner.align(
source: List[str],
target: List[str],
)
# Batch alternative:
results = aligner.align_batch(
source: List[List[str]],
target: List[List[str]],
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for systran_align-3.4.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52bb5dce97b4ae7b40e7bc0533dfad14fe9b51597655107300e3c0cc430bfeb5 |
|
MD5 | ae2be784df67f938895ff8f5d7d8fada |
|
BLAKE2b-256 | 1aa9d9f4a41ca95111e190d8152e17f986852d1a9e37de8f4aae6b945be6168c |
Close
Hashes for systran_align-3.4.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a276475b4781337fe9cbffc4c1ab5795ca977ff907648fbc1635d76fff5dd08 |
|
MD5 | c4e45a4e9f75c3935786fac88e6ea278 |
|
BLAKE2b-256 | e294b205296395d40a7c645eee4e754ed0114a2d02d14be2c815aa0023351a7f |
Close
Hashes for systran_align-3.4.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34f0344a6144606f3a8d7aa18a6fba07a9393dd9797eef801d28d5f4a97d84e9 |
|
MD5 | 91fdb99908013679b8e00f7c247f20db |
|
BLAKE2b-256 | 9993ede46fb09f480def0a7e6abbb003c63afe433d4690dccc740f9684fbc6e2 |
Close
Hashes for systran_align-3.4.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0f05fc8b0457a9200b25c796d56d794513034e9f520f766db8274c494b61281 |
|
MD5 | 3ca56e1ffdf33dff7a51b869c9c95f42 |
|
BLAKE2b-256 | 52e70886e524d45701cbf4d44a273d5d5137d63aa32c5aea7f00a657d66dd259 |
Close
Hashes for systran_align-3.4.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9c742a3c7a47b664f83c7b8e90e48c6ce1a7ddba45ef3a1f16b100aed04d70e |
|
MD5 | 8b790dcde95b31cce530aa7d4d834bda |
|
BLAKE2b-256 | fc67897a62f3795a02e0cd9d1f27c270b7924faa556d027efb630d8e4dcf4e29 |