Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 945 Bytes

README.md

File metadata and controls

32 lines (20 loc) · 945 Bytes

Machine-Translation

This repository is made for the NLP course project - May 2018.

  • Translating Persian text to Quran-style Arabic text using OpenNMT-py.

To run, follow these steps:

  1. Clone OpenNMT-py:
    git clone https://github.com/OpenNMT/OpenNMT-py
    cd OpenNMT-py

  2. Intall requirements:
    pip3 install -r requirements.txt

  3. Preprocess the data:
    python3 preprocess.py -train_src data/src-train.txt -train_tgt data/tgt-train.txt -valid_src data/src-val.txt -valid_tgt data/tgt-val.txt -save_data data/demo

  4. Train the model:
    python3 train.py -data data/demo -save_model demo-model

  5. Translate:
    python3 translate.py -model demo-model_XYZ.pt -src data/src-test.txt -output pred.txt -replace_unk -verbose


Sample result:

    input: من شما را دوست دارم
    output: إِنِّي لَكُمْ أَمِينٌ