Something went wrong. Try again.
Freshman year Python at MSU
Something went wrong. Try again.
123456789101112131415161718192021222324252627
from proj09 import read_data, find_cooccuranceprint("Testing proj09 functions using pimpernel.txt")try: fp = open("pimpernel.txt")except FileNotFoundError: print("You need the file pimpernel.txt for this test.")
print("\nTesting read_data.")print("Dictionary should be:\n {'seek': {1, 2, 3}, 'everywhere': {3}, 'him': {1, 2, 3}, 'those': {3}, 'frenchies': {3}, 'they': {1, 2}, 'here': {1}, 'there': {2}}")
D = read_data(fp)print("Dictionary D:\n",D)
print("\nTesting find_cooccurance.")print("Test 1 should be: [1, 2, 3].")print(find_cooccurance(D,"seek"))
print("\nTest 2 should be: [1, 2].")print(find_cooccurance(D,"seek they"))
print("\nTest 3 should be: [1, 2, 3].")print(find_cooccurance(D,"him seek"))
print("\nTest 4 should be: [1].")print(find_cooccurance(D,"here"))