'Finer segmentation for search engines.'

def cut_for_search(self, sentence, HMM=True):

    words = self.cut(sentence, HMM=HMM)
    for w in words:
        if (len(w) > 2):
            for i in xrange((len(w) - 1)):
                gram2 = w[i:(i + 2)]
                if self.FREQ.get(gram2):
                    (yield gram2)
        if (len(w) > 3):
            for i in xrange((len(w) - 2)):
                gram3 = w[i:(i + 3)]
                if self.FREQ.get(gram3):
                    (yield gram3)
        (yield w)
