Exemplo n.º 1
0
 def __init__(self, session, config, parent):
     SimpleNormalizer.__init__(self, session, config, parent)
     # Load types from config
     types = self.get_setting(session, 'posTypes')
     if types:
         self.types = types.split()
     else:
         # Default to nouns
         self.types = ['NN', 'NNP', 'NNS']
     # Should we keep the /POS tag or strip it
     self.keepPos = self.get_setting(session, 'pos', 0)
Exemplo n.º 2
0
 def __init__(self, session, config, parent):
     SimpleNormalizer.__init__(self, session, config, parent)
     # Load types from config
     types = self.get_setting(session, 'posTypes')
     if types:
         self.types = types.split()
     else:
         # Default to nouns
         self.types = ['NN', 'NNP', 'NNS']
     # Should we keep the /POS tag or strip it
     self.keepPos = self.get_setting(session, 'pos', 0)
Exemplo n.º 3
0
 def assoc_rgx_with_types(self, index=None):
     '''Associate a rgx with action categories.
     '''
     if index is not None:
         index = int(index)
         regex = sorted(self.game_state['regexes'], key=hash)[index]
     else:
         regex = self.game_state['current_rgx']
     self.categories()
     types = raw_input('Type numbers of categories to apply: ')
     types = map(categories.__getitem__, map(int, types.split()))
     types = set(map(itemgetter(0), types))
     self.game_state['types'][regex] |= types
     types = ', '.join(types)
     puts(green(regex) + ' --> ' + yellow(types))
Exemplo n.º 4
0
 def assoc_rgx_with_types(self, index=None):
     '''Associate a rgx with action categories.
     '''
     if index is not None:
         index = int(index)
         regex = sorted(self.game_state['regexes'], key=hash)[index]
     else:
         regex = self.game_state['current_rgx']
     self.categories()
     types = raw_input('Type numbers of categories to apply: ')
     types = map(categories.__getitem__, map(int, types.split()))
     types = set(map(itemgetter(0), types))
     self.game_state['types'][regex] |= types
     types = ', '.join(types)
     puts(green(regex) + ' --> ' + yellow(types))
Exemplo n.º 5
0
 def file_types(self):
     types = self._rfcindex.file_formats
     types = types.replace("ascii","txt")
     return ["."+x for x in types.split(",")]
Exemplo n.º 6
0
 def getQuotaTypes(self):
     """ Returns a list of valid quota types """
     types = self.conf.get("cyrus", "quota_types")
     types = types.split(",")
     return types
Exemplo n.º 7
0
 def file_types(self):
     types = self._rfcindex.file_formats
     types = types.replace("ascii", "txt")
     return ["." + x for x in types.split(",")]
Exemplo n.º 8
0
 def getQuotaTypes(self):
     """ Returns a list of valid quota types """
     types = self.conf.get("cyrus", "quota_types")
     types = types.split(",")
     return types