Git Product home page Git Product logo

fast_align's Introduction

fast_align

fast_align is a simple, fast, unsupervised word aligner.

If you use this software, please cite:

The source code in this repository is provided under the terms of the Apache License, Version 2.0.

Input format

Input to fast_align must be tokenized and aligned into parallel sentences. Each line is a source language sentence and its target language translation, separated by a triple pipe symbol with leading and trailing white space (|||). An example 3-sentence German–English parallel corpus is:

doch jetzt ist der Held gefallen . ||| but now the hero has fallen .
neue Modelle werden erprobt . ||| new models are being tested .
doch fehlen uns neue Ressourcen . ||| but we lack new resources .

Compiling and using fast_align

Building fast_align requires a modern C++ compiler and the CMake build system. Additionally, the following libraries can be used to obtain better performance

  • OpenMP (included with some compilers, such as GCC)
  • libtcmalloc (part of Google's perftools)
  • libsparsehash

To install these on Ubuntu:

sudo apt-get install libgoogle-perftools-dev libsparsehash-dev

To compile, do the following

mkdir build
cd build
cmake ..
make

Run fast_align to see a list of command line options.

fast_align generates asymmetric alignments (i.e., by treating either the left or right language in the parallel corpus as primary language being modeled, slightly different alignments will be generated). The usually recommended way to generate source–target (left language–right language) alignments is:

./fast_align -i text.fr-en -d -o -v > forward.align

The usually recommended way to generate target–source alignments is to just add the -r (“reverse”) option:

./fast_align -i text.fr-en -d -o -v -r > reverse.align

These can be symmetrized using the included atools command using a variety of standard symmetrization heuristics, for example:

./atools -i forward.align -j reverse.align -c grow-diag-final-and

Output

fast_align produces outputs in the widely-used i-j “Pharaoh format,” where a pair i-j indicates that the ith word (zero-indexed) of the left language (by convention, the source language) is aligned to the jth word of the right sentence (by convention, the target language). For example, a good alignment of the above German–English corpus would be:

0-0 1-1 2-4 3-2 4-3 5-5 6-6
0-0 1-1 2-2 2-3 3-4 4-5
0-0 1-2 2-1 3-3 4-4 5-5

Acknowledgements

The development of this software was sponsored in part by the U.S. Army Research Laboratory and the U.S. Army Research Office under contract/grant number W911NF-10-1-0533.

fast_align's People

Contributors

armatthews avatar christianbuck avatar dowobeha avatar graehl avatar mjdenkowski avatar phikoehn avatar redpony avatar romanklinger avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.