Exemple #1
0
    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)
Exemple #2
0
    def test_word_pos_ne_freq(self):
        """Tests the /word/pos/ne/freq endpoint."""

        from action.frequency_calculation import FrequencyCalculation

        json = self.__make_request(['word', 'pos', 'ne', 'freq'])

        assert FrequencyCalculation.produced(json)
Exemple #3
0
    def test_phrs_freq(self):
        """Tests the /phrs/freq endpoint."""

        from action.frequency_calculation import FrequencyCalculation

        json = self.__make_request(['phrs', 'freq'])

        assert FrequencyCalculation.produced(json)