Exemplo 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())
Exemplo n.º 2
0
    def test_analyze_results(self):
        analyzer = MorphologicalSentenceAnalyzer(self.TEST_SENTENCE)

        assert analyzer.analyze()
        assert analyzer.results() is not None
Exemplo 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
Exemplo n.º 4
0
    def test_initialize_results(self):
        analyzer = MorphologicalSentenceAnalyzer(self.TEST_SENTENCE)

        assert analyzer.results() is None