from zope.interface import implements
from zopyx.txng3.core.interfaces.normalizer import INormalizer
from Utf8Splitter import Utf8Utils


class _Normalizer(object) :
	
	implements(INormalizer)
	
	def availableLanguages(self) :
		return "all"

	def process(self, words, language) :
		""" Normalize a word or a sequence of words. Returned the normalized word
			or a sequence of normalized words. If there is no normalizer available
			for a language then the data is returned unchanged.
		"""
		return Utf8Utils.udesacc(words)

	def translationTable(self, language) :
		""" return the translation table for a given language where the 
			translation table is represented as list of tuples (from_str, repl_str)
		"""
		return Utf8Utils._cache.items()

Normalizer = _Normalizer()