def soundscore_it(form, ar): ''' Sound score words and phrases against input ''' parsed_input = parse_output(form.output, form.wordlist) scores = ss.soundscore_it(parsed_input, form.wordlist, ar=ar, mode=0) scores.extend(ss.soundscore_it(parsed_input, form.phrases, ar=ar, mode=1)) scores = rescore_it(form, scores, weighted=False) return sort_scores(tuple(scores))[:30]
def get_input(): try: user_input = raw_input("Enter a word: ") with open('data/commonwords_dict.pickle', 'rb') as c: commonwords = pickle.load(c) parsed_input = parse_input(user_input, commonwords) del commonwords with open('data/commonwords_list.pickle', 'rb') as c: commonwords = pickle.load(c) ss.soundscore_it(parsed_input, commonwords) except KeyboardInterrupt: print '\nInput Error' return
def get_input(): try: user_input = raw_input("Enter a phrase: ") with open('data/commonwords_dict.pickle', 'rb') as c: commonwords_dict = pickle.load(c) parsed_input = parse_input(user_input, commonwords_dict) del commonwords_dict with open('data/w4.pickle', 'rb') as n: ngrams = pickle.load(n) print ngrams[0] # Score ngrams against input phrase ss.soundscore_it(parsed_input, ngrams) except KeyboardInterrupt: #print '\nInput Error' return