def __init__(self): # Load the initialization file. configuration_filepath = os.path.dirname(os.path.realpath(__file__)) + \ os.sep + 'nlp_pipeline.config' self.models = {} self.load_configuration_file(configuration_filepath) self.turbo_interface = tp.PTurboParser() self.workers = {}
def __init__(self, tagger, lemmatizer, model_file): self.tagger = tagger self.lemmatize = lemmatizer.lemmatize if lemmatizer else lambda w, t: '_' import turboparser self._pturboparser = turboparser.PTurboParser() self.interface = self._pturboparser.create_parser() self.interface.load_parser_model(model_file)
def __init__(self): self.turbo_interface = tp.PTurboParser() self.workers = {}
def __init__(self,configuration_filepath): # Load the initialization file. self.models = {} self.load_configuration_file(configuration_filepath) self.turbo_interface = tp.PTurboParser() self.workers = {}
from settings import * from sys import stderr def print(text): stderr.write(text + '\n') print('PREPARING TURBOPARSER') import turboparser turbo_interface = turboparser.PTurboParser() print('TURBOPARSER PREPARED') print('LOADING TOKENIZERS') import nltk sentence_tokenizer = nltk.data.load(tokenizer_model) word_tokenizer = nltk.TreebankWordTokenizer() print('TOKENIZERS LOADED') if 'TAG' in implemented_methods or 'LEMMATIZE' in implemented_methods: print('LOADING TAGGER') tagger = turbo_interface.create_tagger() tagger.load_tagger_model(b_tagger_model) print('TAGGER LOADED') if 'LEMMATIZE' in implemented_methods or 'TAG' in implemented_methods or 'PARSE' in implemented_methods: print('LOADING LEMMATIZER') from lemmatizer import lemmatize print('LEMMATIZER LOADED') if 'PARSE' in implemented_methods: