def __init__(self, sentences_fl_path, language): if language == "rus" or language == "spa": self.parser = MinLFSParser(open(sentences_fl_path, "rb")) elif language == "eng": self.parser = MinBoxerLFSParser(open(sentences_fl_path, "rb")) else: raise Exception("Unsupported language: %s" % language)
class LFSentenceStream(object): def __init__(self, sentences_fl_path, language): if language == "rus" or language == "spa": self.parser = MinLFSParser(open(sentences_fl_path, "rb")) elif language == "eng": self.parser = MinBoxerLFSParser(open(sentences_fl_path, "rb")) else: raise Exception("Unsupported language: %s" % language) def __iter__(self): return self.parser.__iter__()