def readVocabularyFrom(fileName): file = open(fileName, 'rb') vocabulary = Vocabulary(fileName[:-4]) for line in file: if line[0] != '(': continue vocabulary.addSentence(Sentence(line)) file.close() print 'Vocabulary has been read from', fileName, '\n' return vocabulary