def _initialize_templates(templates, dictionary): if not templates: templatespath = '%s/data/templates/twitter_templates0' % installpath templates = loadtxt(templatespath) templates = [tuple(template.split()) for template in templates] single_words = [(pos, ) for pos in dictionary._pos2words if not (pos in tagset)] templates += [ template for template in single_words if not template in templates ] return templates
def _load_customized_tagger(self): templatespath = '%s/data/templates/twitter_templates0' % installpath templates = loadtxt(templatespath) templates = [tuple(template.split()) for template in templates] return SimpleTemplateTagger(templates, self._dictionary, SimpleSelector())
def _load_default_dictionary(self): josapath = '%s/data/twitter/josa.txt' % installpath modifierpath = '%s/data/twitter/modifier.txt' % installpath self._dictionary.add_dictionary(loadtxt(josapath), 'Josa') self._dictionary.add_dictionary(loadtxt(modifierpath), 'Modifier')