__author__ = 'Egbert' import pearl from util import all_word_pairs print(pearl.make_density_table(all_word_pairs()))
Command-line script to invoke text file search Usage: 'google' Pearls of Computer Science, Week 2 """ # standard module containing clock function import time # read words from dictionary file import util # module demanded in the pearl assignment import pearl_bonus2 # read in text files start = time.clock() word_pairs = util.all_word_pairs() duration = time.clock() - start print("Time spent reading text files: {}".format(round(duration * 1000000))) # create search table start = time.clock() word_table = pearl_bonus2.make_table(word_pairs) duration = time.clock() - start print("Time spent creating search table: {}".format(round(duration * 1000000))) # search in the table import ordsearch # ask for the first word key = input("Search term: ") # continue as long as a word was typed while key != "":
__author__ = 'Egbert' import util import pearl pearl.make_density_table(util.all_word_pairs()) print(len(util.words("brian.txt")))
__author__ = 'Egbert' import pearl from util import all_word_pairs print(pearl.make_counted_table(all_word_pairs()))
Command-line script to invoke text file search Usage: 'google' Pearls of Computer Science, Week 2 """ # standard module containing clock function import time # read words from dictionary file import util # module demanded in the pearl assignment import pearl # read in text files start = time.clock() word_pairs = util.all_word_pairs() duration = time.clock() - start print("Time spent reading text files: {}".format(round(duration*1000000))) # create search table start = time.clock() word_table = pearl.make_table(word_pairs) duration = time.clock() - start print("Time spent creating search table: {}".format(round(duration*1000000))) # search in the table import ordsearch # ask for the first word key = input("Search term: ") # continue as long as a word was typed while key != "":