#!/usr/bin/env python
# coding: utf-8

"""
Trains a model.

Usage:
    yalign-train [options] <corpus> <dictionary> <model_folder>

Options:
  -a --lang-a=<language>      The language of the document A [default: en]
  -b --lang-b=<language>      The language of the document B [default: es]
"""

import os
from docopt import docopt
from yalign import basic_model


if __name__ == "__main__":
    args = docopt(__doc__)
    lang_a = args["--lang-a"]
    lang_b = args["--lang-b"]
    corpus = args["<corpus>"]
    dictionary = args["<dictionary>"]

    output_folder = args["<model_folder>"]
    if not os.path.exists(output_folder):
        os.mkdir(output_folder)

    model = basic_model(corpus, dictionary, lang_a, lang_b)
    model.save(output_folder)
