Esempio n. 1
0
    def __init__(self):
        master_dictionary_path = os.path.join(
            os.path.dirname(__file__),
            '../../../resources/master_dictionary.txt')

        mongodb_connection = pymongo.Connection(
            host=ApplicationContext.DB_HOST)
        ngram_collection_map = {
            1:
            mongodb_connection['trnltk']['wordUnigrams{}'.format(
                ApplicationContext.PARSESET_INDEX)],
            2:
            mongodb_connection['trnltk']['wordBigrams{}'.format(
                ApplicationContext.PARSESET_INDEX)],
            3:
            mongodb_connection['trnltk']['wordTrigrams{}'.format(
                ApplicationContext.PARSESET_INDEX)]
        }

        self.contextful_morphological_parser = ContextfulMorphologicalParserFactory.create(
            master_dictionary_path, ngram_collection_map)
        self.contextful_morphological_parser.build_indexes()

        self.dbmanager = DbManager(mongodb_connection)
        self.dbmanager.build_indexes()

        self.parse_context_creator = ParseContextCreator(
            self.contextful_morphological_parser._contextless_parser)

        self.sessions = {}
Esempio n. 2
0
    def create_contextful_morphological_parser(cls, parseset_index):
        master_dictionary_path = os.path.join(os.path.dirname(__file__), '../../../../resources/master_dictionary.txt')

        mongodb_connection = pymongo.Connection(host='127.0.0.1')
        collection_map = {
            1: mongodb_connection['trnltk']['wordUnigrams{}'.format(parseset_index)],
            2: mongodb_connection['trnltk']['wordBigrams{}'.format(parseset_index)],
            3: mongodb_connection['trnltk']['wordTrigrams{}'.format(parseset_index)]
        }

        contextful_morphological_parser = ContextfulMorphologicalParserFactory.create(master_dictionary_path, collection_map)

        return contextful_morphological_parser
Esempio n. 3
0
    def __init__(self):
        master_dictionary_path = os.path.join(os.path.dirname(__file__), "../../../resources/master_dictionary.txt")

        mongodb_connection = pymongo.Connection(host=ApplicationContext.DB_HOST)
        ngram_collection_map = {
            1: mongodb_connection["trnltk"]["wordUnigrams{}".format(ApplicationContext.PARSESET_INDEX)],
            2: mongodb_connection["trnltk"]["wordBigrams{}".format(ApplicationContext.PARSESET_INDEX)],
            3: mongodb_connection["trnltk"]["wordTrigrams{}".format(ApplicationContext.PARSESET_INDEX)],
        }

        self.contextful_morphological_parser = ContextfulMorphologicalParserFactory.create(
            master_dictionary_path, ngram_collection_map
        )
        self.contextful_morphological_parser.build_indexes()

        self.dbmanager = DbManager(mongodb_connection)
        self.dbmanager.build_indexes()

        self.parse_context_creator = ParseContextCreator(self.contextful_morphological_parser._contextless_parser)

        self.sessions = {}
Esempio n. 4
0
    def create_contextful_morphological_parser(cls, parseset_index):
        master_dictionary_path = os.path.join(
            os.path.dirname(__file__),
            '../../../../resources/master_dictionary.txt')

        mongodb_connection = pymongo.Connection(host='127.0.0.1')
        collection_map = {
            1:
            mongodb_connection['trnltk']['wordUnigrams{}'.format(
                parseset_index)],
            2:
            mongodb_connection['trnltk']['wordBigrams{}'.format(
                parseset_index)],
            3:
            mongodb_connection['trnltk']['wordTrigrams{}'.format(
                parseset_index)]
        }

        contextful_morphological_parser = ContextfulMorphologicalParserFactory.create(
            master_dictionary_path, collection_map)

        return contextful_morphological_parser