def splitTerms(self, text, categories=None): """Split text into terms """ terms = [] for sentence in lexicon.splitSentence(text): if sentence: for mixed in lexicon.iterMixTerms(sentence): # English term if mixed.startswith('E'): terms.append(mixed) # Chinese sentence else: terms.extend(self.db.splitTerms(mixed, categories)) return terms
def splitNgramTerms(self, text): """Split text into 1 to n gram terms """ terms = [] for sentence in lexicon.splitSentence(text): if sentence: for mixed in lexicon.iterMixTerms(sentence): # English term if mixed.startswith('E'): terms.append(mixed) # Chinese sentence else: for n in xrange(1, self.ngram+1): terms.extend(lexicon.iterTerms(n, mixed, False)) return terms
def splitNgramTerms(self, text): """Split text into 1 to n gram terms """ terms = [] for sentence in lexicon.splitSentence(text): if sentence: for mixed in lexicon.iterMixTerms(sentence): # English term if mixed.startswith('E'): terms.append(mixed) # Chinese sentence else: for n in xrange(1, self.ngram + 1): terms.extend(lexicon.iterTerms(n, mixed, False)) return terms
def splitSentence(self, text): """Split text into sentence """ return lexicon.splitSentence(text)
def splitSentence(self, text): '''Split text into sentence ''' return lexicon.splitSentence(text)