def __init__(self, text_or_tokens): self.tokens = [] if isinstance(text_or_tokens, basestring): words = [camxes.call_vlatai(word) for word in text_or_tokens.split(" ")] for word in words: self.tokens.append(Token(word[1], word[2])) elif isinstance(text_or_tokens, list): self.tokens = text_or_tokens self.pos = 0 self.iterator = iter(self.tokens)
def __init__(self, text_or_tokens): self.tokens = [] if isinstance(text_or_tokens, basestring): words = [ camxes.call_vlatai(word) for word in text_or_tokens.split(" ") ] for word in words: self.tokens.append(Token(word[1], word[2])) elif isinstance(text_or_tokens, list): self.tokens = text_or_tokens self.pos = 0 self.iterator = iter(self.tokens)
def test_vlatai(): assert call_vlatai("jbopre") == ["jbopre", "lujvo", "jbopre"] assert call_vlatai("gerku") == ["gerku", "gismu", "gerku"] assert call_vlatai("hello") == ["hello", "UNMATCHED", "hello"]