Run Moses for the first time and create baseline system in Ubuntu 14.04 LTS

This guide assumes that you have successfully installed Moses, and would like to see how to use parallel data to build a real phrase-based translation system. The process requires some familiarity with UNIX and, ideally, access to a Linux server. It can be run on a laptop, but could take about a day and requires at least 2G of RAM, and about 10G of free disk space (these requirements are just educated guesses, so if you have a different experience then please mail support).

If you want to save the effort of typing in all the commands on this page (and see how the pros manage their experiments), then skip straight to the experiment management system instructions below. But I'd recommend that you follow through the process manually, at least once, just to see how it all works [http://www.statmt.org/moses/]

Installation

The minimum software requirements are:

  • Moses (obviously!)
  • GIZA++, for word-aligning your parallel corpus
  • IRSTLM, SRILM, or KenLM for language model estimation.
  • IRSTLM and KenLM are LGPL licensed (like Moses) and therefore available for commercial use. The Moses tool-chain defaults to KenLM.
  • For the purposes of this guide, I will assume that you're going to install all the tools and data in your home directory (i.e. ~/), and that you've already downloaded and compiled Moses into ~/mosesdecoder. And you're going to run Moses from there.


Download the sample models and extract them into your working directory: achchuthan.en-ta.en, achchuthan.en-ta.ta parallel data used.

achchuthan.en-ta.ta


கட்டுரை


ஒரு கட்டுரையினுள் கட்டுரைகளின் இணைப்புகளைச் சொருக ஏதுவான ஒரு பொத்தானைக் காட்டுகிறது. கட்டுரையைத் தேர்ந்தெடுக்க தங்களை அனுமதிக்கும் ஒரு மேல்தோன்று சாளரத்தைக் காட்டுகிறது.

பொத்தான் - கட்டுரை

பொத்தான் - கட்டுரை

ஒரு கட்டுரையினுள் கட்டுரைகளின் இணைப்புகளைச் சொருக ஏதுவான ஒரு பொத்தானைக் காட்டுகிறது. கட்டுரையைத் தேர்ந்தெடுக்க தங்களை அனுமதிக்கும் ஒரு மேல்தோன்று சாளரத்தைக் காட்டுகிறது.
பொத்தான் - படம்

ஒரு கட்டுரையினுள் படங்களைச் சொருக ஏதுவான ஒரு பொத்தானைக் காட்டுகிறது. படத்தின் குணாதிசயங்களை உருவாக்க/மாற்ற மற்றும் புதிய படக் கோப்புகளை பதிவேற்றத் தங்களை அனுமதிக்கும் ஒரு மேல்தோன்று சாளரத்தைக் காட்டுகிறது.

படம்
பொத்தான் - படம்

ஒரு கட்டுரையினுள் படங்களைச் சொருக ஏதுவான ஒரு பொத்தானைக் காட்டுகிறது. படத்தின் குணாதிசயங்களை உருவாக்க/மாற்ற மற்றும் புதிய படக் கோப்புகளை பதிவேற்றத் தங்களை அனுமதிக்கும் ஒரு மேல்தோன்று சாளரத்தைக் காட்டுகிறது.

பொத்தான் - பக்கப்பிரிப்பு
பக்கப்பிரிப்பு

ஒரு கட்டுரையினுள் பக்கப்பிரிப்பு சொருகலை இயலுமைப்படுத்துவதற்கான ஒரு பொத்தானைக் கொடுக்கிறது. ஒரு மேல்தோன்று (சாளரம்) அமைப்புகளை உருவாக்க/மாற்ற தங்களை அனுமதிக்கிறது.

பொத்தான் - மேலும் படிக்க

ஏற்கனவே ஒரு மேலும் படிக்க... இணைப்பானது சொருகப்பட்டுள்ளது. இப்படிப்பட்ட இணைப்பு ஒன்றுக்கு மட்டுமே அனுமதியுள்ளது. பக்கத்தை மேலும் பிரிப்பதற்கு {பக்கப்பிரிப்பு}-வைப் பயன்படுத்துக.

மேலும் படிக்க

தாங்கள் ஒரு கட்டுரையினுள் மேலும் படிக்க... இணைப்பைச் சுலபமாகச் சொருக அனுமதிக்கும் ஒரு பொத்தானை இயலுமைப்படுத்துகிறது.

நீட்சி - Joomla
நீட்சிகளுக்கான புதுப்பிக்கும் தளங்களைப் பராமரிக்கிறது

இந்தச் சொருகி Joomla! பிரிவுகளை சுட்டுவரிசையாக்குகிறது.

தெரியாத தளம்
புத்திசாலித்தனமான தேடல் - பிரிவுகள்

இந்தச் சொருகி Joomla! தொடர்புகளை சுட்டுவரிசையாக்குகிறது.

புத்திசாலித்தனமான தேடல் - தொடர்புகள்

தொடர்பு


achchuthan.en-ta.en


Article


Displays a button to make it possible to insert articles' links into an Article. Displays a popup allowing you to choose the article

Button - Article

Button - Article

Displays a button to make it possible to insert articles' links into an Article. Displays a popup allowing you to choose the article
Button - Image

Displays a button to make it possible to insert images into an Article. Displays a popup allowing you to configure an image's properties and upload new image files.

Image
Button - Image

Displays a button to make it possible to insert images into an Article. Displays a popup allowing you to configure an image's properties and upload new image files.

Button - Pagebreak
Page Break

Provides a button to enable a pagebreak to be inserted into an Article. A popup allows you to configure the settings to be used.

Button - Readmore

There is already a Read more... link that has been inserted. Only one such link is permitted. Use {pagebreak} to split the page up further.

Read More

Enables a button which allows you to easily insert the Read more... link into an Article.

Extension - Joomla

Manage the update sites for extensions

Unknown Site
Smart Search - Categories

Smart Search - Contacts

This plugin indexes Joomla! Categories.
This plugin indexes Joomla! Contacts.

Contact



Baseline System

This guide assumes that you have successfully Installed Moses, and would like to see how to use parallel data to build a real phrase-based translation system. The process requires some familiarity with UNIX and, ideally, access to a Linux server. It can be run on a

Corpus Preparation

To train a translation system we need parallel data (text translated into two different languages) which is aligned at the sentence level. Luckily there’s plenty of this data freely available, and for this system I’m going to use a small (only 214,000 sentences!) data set. To get the data we want, we have to download the tarball and unpack it (into a corpus directory in our home directory) as follows

cd ~/
mkdir corpus
cd corpus

If you look in the ~/corpus/training directory you’ll see that there’s data (i.e: ~/corpus/training/achchuthan.en-ta.en, ~/corpus/training/achchuthan.en-ta.ta) in various languages. We’re going to build a English-Tamil (en-ta) translation system using the collected data set, but feel free to use one of the other language pairs if you prefer.

To prepare the data for training the translation system, we have to perform the following steps:
    • Tokenization
    • Truecasing
    • Cleaning

Tokenisation

This means that spaces have to be inserted between (e.g.) words and punctuation. The tokenisation can be run as follows:
~/mosesdecoder/scripts/training/clean-corpus-n.perl \ 
 ~/corpus/achchuthan.en-ta.true en ta \ 
 ~/corpus/achchuthan.en-ta.clean 1 80 

Truecasing

The initial words in each sentence are converted to their most probable casing. This helps reduce data sparsity.
The truecaser first requires training, in order to extract some statistics about the text:

~/mosesdecoder/scripts/recaser/train-truecaser.perl --model \
~/corpus/truecase-model.en --corpus \
~/corpus/achchuthan.en-ta.tok.en

~/mosesdecoder/scripts/recaser/train-truecaser.perl --model \
~/corpus/truecase-model.ta --corpus \
~/corpus/achchuthan.en-ta.tok.ta

Truecasing uses another script from the Moses distribution:

~/mosesdecoder/scripts/recaser/truecase.perl --model \
~/corpus/truecase-model.en \
< ~/corpus/achchuthan.en-ta.tok.en \
> ~/corpus/achchuthan.en-ta.true.en

~/mosesdecoder/scripts/recaser/truecase.perl --model \
~/corpus/truecase-model.ta \
< ~/corpus/achchuthan.en-ta.tok.ta \
> ~/corpus/achchuthan.en-ta.true.ta

Cleaning

Long sentences and empty sentences are removed as they can cause problems with the training pipeline, and obviously mis-aligned sentences are removed.

Finally we clean, limiting sentence length to 80:

~/mosesdecoder/scripts/recaser/truecase.perl --model \
~/corpus/truecase-model.en \
< ~/corpus/achchuthan.en-ta.tok.en \
> ~/corpus/achchuthan.en-ta.true.en

~/mosesdecoder/scripts/recaser/truecase.perl --model \
~/corpus/truecase-model.ta \
< ~/corpus/achchuthan.en-ta.tok.ta \
> ~/corpus/achchuthan.en-ta.true.ta

Language Model Training

The language model (LM) is used to ensure fluent output, so it is built with the target language (i.e Tamil in this case). The IRSTLM documentation gives a full explanation of the command line options, but the following will build an appropriate 3-gram language model, removing singletons, smoothing with improved Kneser-Ney, and adding sentence boundary symbols:

mkdir ~/lm
cd ~/lm
~/irstlm-5.80.03/bin/add-start-end.sh \
<~/corpus/achchuthan.en-ta.true.ta \
> achchuthan.en-ta.sb.ta

export IRSTLM=$HOME/irstlm-5.80.03; ~/irstlm-5.80.03/bin/build-lm.sh \
-i achchuthan.en-ta.sb.ta \
-t ./tmp -p -s improved-kneser-ney -o achchuthan.en-ta.lm.ta

~/irstlm-5.80.03/bin/compile-lm --text=yes \
achchuthan.en-ta.lm.ta.gz achchuthan.en-ta.arpa.ta

You can directly create an IRSTLM binary LM (for faster loading in Moses) by replacing the last
command with the following:

~/irstlm/bin/compile-lm achchuthan.en-ta.lm.ta.gz \
achchuthan.en-ta.blm.ta

You can transform an arpa LM (*.arpa.en file) into an IRSTLM binary LM as follows:

~/irstlm/bin/compile-lm achchuthan.en-ta.arpa.ta \
achchuthan.en-ta.blm.ta

This instead binaries (for faster loading) the *.arpa.en file using KenLM:

~/mosesdecoder/bin/build_binary achchuthan.en-ta.arpa.ta \
achchuthan.en-ta.blm.ta

You can check the language model by querying it, e.g.

echo "பயனர் பதிவு நிறுத்தப்பட்டுள்ளது " | ~/mosesdecoder/bin/query achchuthan.en-ta.blm.ta

பயனர்=6868 2 -3.78027
பதிவு=11044 1 -4.80475
நிறுத்தப்பட்டுள்ளது=58944 1 -6.21282
=3 1 -1.70948 Total: -16.5073 OOV: 0 Perplexity 13391.5 Total time including destruction: Name:query VmPeak:79248 kB VmRSS:1548 kB RSSMax:63076 kB user:0 sys:0.010489 CPU:0.010489 real:0.00835619

Training the Translation System

Finally we come to the main event - training the translation model. To do this, we run word alignment (using GIZA++), phrase extraction and scoring, create lexicalised reordering tables and create your Moses configuration file, all with a single command. I recommend that you create an appropriate directory as follows, and then run the training command, catching logs:

mkdir ~/working
cd ~/working

nohup nice ~/mosesdecoder/scripts/training/train-model.perl \
-root-dir train \
-corpus ~/corpus/achchuthan.en-ta.clean \
-f en -e ta -alignment grow-diag-final-and \
-reordering msd-bidirectional-fe
-lm 0:3:$HOME/lm/achchuthan.en-ta.blm.ta:8 \
-external-bin-dir ~/mosesdecoder/tools >& training.out

If you have a multi-core machine it’s worth using the -cores argument to encourage as much parallelisation as possible.

Post a Comment

Thank you for vising

Previous Post Next Post