1 from zope
.interface
import implements
2 from zopyx
.txng3
.core
.interfaces
.normalizer
import INormalizer
3 from Utf8Splitter
import Utf8Utils
6 class _Normalizer(object) :
8 implements(INormalizer
)
10 def availableLanguages(self
) :
13 def process(self
, words
, language
) :
14 """ Normalize a word or a sequence of words. Returned the normalized word
15 or a sequence of normalized words. If there is no normalizer available
16 for a language then the data is returned unchanged.
18 return Utf8Utils
.udesacc(words
)
20 def translationTable(self
, language
) :
21 """ return the translation table for a given language where the
22 translation table is represented as list of tuples (from_str, repl_str)
24 return Utf8Utils
._cache
.items()
26 Normalizer
= _Normalizer()