Пример #1
0
 def __init__(self, name, value, request):
     analyzer = WikiAnalyzer(request=request,
                             language=request.cfg.language_default)
     value = ' '.join(
         unicode('%s %s' % (word, stemmed)).strip()
         for word, stemmed in analyzer.tokenize(value))
     super(StemmedField, self).__init__(name, value)
Пример #2
0
class TestWikiAnalyzer(object):

    word = u'HelpOnMoinTesting'
    words = {word.lower(): u'',
             u'help': u'',
             u'on': u'',
             u'moin': u'',
             u'testing': u''}

    def setup_class(self):
        self.analyzer = WikiAnalyzer(request=self.request, language=self.request.cfg.language_default)

    def test_tokenize(self):
        words = self.words
        tokens = list(self.analyzer.tokenize(self.word))

        assert len(tokens) == len(words)

        for token, stemmed in tokens:
            assert token in words
            assert words[token] == stemmed
Пример #3
0
class TestWikiAnalyzer(object):

    word = u'HelpOnMoinTesting'
    words = {
        word.lower(): u'',
        u'help': u'',
        u'on': u'',
        u'moin': u'',
        u'testing': u''
    }

    def setup_class(self):
        self.analyzer = WikiAnalyzer(language=app.cfg.language_default)

    def test_tokenize(self):
        words = self.words
        tokens = list(self.analyzer.tokenize(self.word))

        assert len(tokens) == len(words)

        for token, stemmed in tokens:
            assert token in words
            assert words[token] == stemmed
Пример #4
0
 def setup_class(self):
     self.analyzer = WikiAnalyzer(request=self.request, language=self.request.cfg.language_default)
 def __init__(self, name, value, request):
     analyzer = WikiAnalyzer(request=request, language=request.cfg.language_default)
     value = ' '.join(unicode('%s %s' % (word, stemmed)).strip() for word, stemmed in analyzer.tokenize(value))
     super(StemmedField, self).__init__(name, value)
Пример #6
0
 def setup_class(self):
     self.analyzer = WikiAnalyzer(
         request=self.request, language=self.request.cfg.language_default)
Пример #7
0
 def setup_class(self):
     self.analyzer = WikiAnalyzer(language=app.cfg.language_default)