myDocList = [] myDict = {} def tokenizeDoc(myFile): global myDocList file = open(myFile) for line in file: myDocList.extend(line.split()) def bestMatch(word): global myDict if myDict.get(word) == None: return [] else: return myDict[word].split() def addWord(word): global myDict myDict[word] = word