ParSentExtract
A BiRNN framework implemented in Python and TensorFlow to extract parallel sentences from aligned comparable corpora.
Install / Use
/learn @FrancisGregoire/ParSentExtractREADME
Extracting Parallel Sentences with Bidirectional Recurrent Neural Networks to Improve Machine Translation
A TensorFlow implementation of the bidirectional RNN model described in the paper Extracting Parallel Sentences with Bidirectional Recurrent Neural Networks to Improve Machine Translation to extract parallel sentences from aligned comparable corpora.
Required packages
- TensorFlow (instructions)
- NumPy (instructions)
- scikit-learn (instructions)
Prepare the training data
We have provided a script to tokenize and clean your datasets using Moses.
./scripts/preprocessing.sh ~/moses/mosesdecoder ../data/train en fr 3 80
mv ../data/train.clean.en ../data/train.en
mv ../data/train.clean.fr ../data/train.fr
Training
Run the training script.
python train.py --source_train_path ../data/train.en --target_train_path ../data/train.fr --source_valid_path ../data/valid.en --target_valid_path ../data/valid.fr --checkpoint_dir ../tflogs
The models are written in checkpoint_dir.
Testing
Run the evaluation script.
python eval.py --checkpoint_dir ../tflogs --source_test_path ../data/test.en --target_test_path ../data/test.fr --reference_test_path ../data/test.ref --source_vocab_path ../data/vocabulary.source --target_vocab_path ../data/vocabulary.target
The evaluation is done on the last model saved in checkpoint_dir.
Extracting sentence pairs
Run the sentence extraction script.
python extract.py --checkpoint_dir ../tflogs --extract_dir ./samples --source_vocab_path ../data/vocabulary.source --target_vocab_path ../data/vocabulary.target --source_output_path ../data/extracted.source --target_output_path ../data/extracted.target --score_output_path ../data/extracted.score --source_language en --target_language fr --decision_threshold 0.99
Related Skills
node-connect
337.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.2kCommit, push, and open a PR
