Example #1
0
def solve(inputStr, gram_dict, gram_num):
    after_tokens = sa(inputStr, gram_dict, gram_num)
    after_tokens = add_punc(after_tokens, gram_dict, gram_num)
    # after_tokens = [s for s in after_tokens if s[1] != 'uj']
    import rand_word
    after_strs = rand_word.sub(after_tokens, author)
    return "".join(after_strs)
Example #2
0
def solve(inputStr, gram_dict):
    after_tokens = sa(inputStr, gram_dict)
    after_tokens = add_punc(after_tokens, gram_dict)
    import rand_word
    after_strs = rand_word.sub(after_tokens, author)
    return "".join(after_strs)
Example #3
0
File: tmp.py Project: lauzi/HTC
# -*- encoding: utf-8 -*-

import codecs

import rand_word
import synonym_freq

if __name__ == '__main__':
    words = u'我,覺得,太陽,裡面,沒有,太陽餅,是,一件,很,奇怪,的,事'.split(u',')
    tokens = zip(words, 'w'*100)
    with codecs.open('tmp.txt', 'w', encoding='utf8') as File:
        for _ in range(10):
            for word in rand_word.sub(tokens, 'love0'):
                print >>File, word,
            print >>File