Esempio n. 1
0
    def get(self):
        """Return a MorphologicalAnalyzeResult object"""
        sentence = request.args['sentence']

        if not sentence:
            raise SentenceRequiredError()

        analyzer = MorphologicalSentenceAnalyzer(sentence=sentence)
        analyzer.analyze()

        return self._format_results(analyzer.results())
Esempio n. 2
0
    def test_analyze_results(self):
        analyzer = MorphologicalSentenceAnalyzer(self.TEST_SENTENCE)

        assert analyzer.analyze()
        assert analyzer.results() is not None
Esempio n. 3
0
    def test_analyze_results_size(self):
        analyzer = MorphologicalSentenceAnalyzer(self.TEST_SENTENCE)

        assert analyzer.analyze()
        assert len(analyzer.results()) == 4
        assert len(analyzer.results()[1]) == 2
Esempio n. 4
0
    def test_initialize_results(self):
        analyzer = MorphologicalSentenceAnalyzer(self.TEST_SENTENCE)

        assert analyzer.results() is None