def __init__(self): """Constructor """ super(nalapi, self).__init__() logging.debug('Starting nalapi') """The actions to take when a given url path section is encountered.""" self.__actions = [ SentenceExtraction(), WordExtraction(), WordPosTagging(), PhraseExtraction(), NamedEntityExtraction(), FrequencyCalculation(), UniqueFiltering(), ContentReversal(), Consolidation(), SentimentCalculation() ] self.__url_shortcuts = { 'ne': 'word/pos/ne', 'phrs': 'word/pos/phrs', 'pos': 'word/pos' } self.route('/help', callback=self.help) """Ensures all other url paths are redirected to self.process""" self.route('/:url#.+#', callback=self.process)
def test_pos_unq(self): """Tests the /pos/unq endpoint.""" from action.unique_filtering import UniqueFiltering json = self.__make_request(['pos', 'unq']) assert UniqueFiltering.produced(json)