#! /usr/bin/env python3

import langid
import fasttext
import sys
sys.path.extend(["custom_fasttext_wrapper", "dict_lang_ident", "ensemble"])
import language_identifier
from language_identifier import LanguageIdentifier
from dict_lang_ident import DictLanguageIdentifier


def main():
    fasttext_model = fasttext.load_model("models/lid.176.bin")
    print("Loading FastText model...")
    our_model = LanguageIdentifier(debug=True)
    print("Loading OfficeBot FastText model...")
    while not our_model.ready():
        pass
    dict_langid = DictLanguageIdentifier("dict_lang_ident/dictionaries", "dict_lang_ident/bigram_dicts")
    while True:
        message = input(">>>")
        print(f"FastText: {fasttext_model.predict(message)}")
        print(f"OfficeBot FastText model: {our_model.classify_single(message)}")
        print(f"Dictionary Identifier: {dict_langid.predict(message)}")


if __name__ == "__main__":
    main()
