import sys import argparse import textwrap from db_manager import DBManager from services import LanguageServices # ==================================================================================== # Language Detection v1.0.0 # # This is the Language Detection Module using Language Profile Rank Order Distance. # ==================================================================================== if __name__ == '__main__': # Setup the database. DBManager.setup() # Configure the parser. parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent("""\ Language Detection v1.0 ============================================================================= These are the available commands. train_file = Train the language detector with the data from the file. The file name will become the language key. train_folder = Train the language detector with the data from the folder. The file names will become the language keys. test = Test the string with the language models. get_n_grams = Retrieve a list of n-grams. get_languages = Get a list of languages which can be detected. """)) parser.add_argument('command', choices = ["train_file", \