def test_getBlocks_3(self): sents = textprocessing.getSentences( "RENT. How do you write a song when the chords sound wrong?") self.assertEqual(textprocessing.getBlocks(sents, 1), [["RENT"], ["How do you write a song when the chords sound wrong"]]) self.assertEqual(textprocessing.getBlocks(sents, 2), [["RENT", "How do you write a song when the chords sound wrong"]])
def test_getBlocks_1(self): sents = textprocessing.getSentences("Hello. How are you? I am fine.") self.assertEqual(textprocessing.getBlocks(sents, 1), [["Hello"], ["How are you"], ["I am fine"]]) self.assertEqual(textprocessing.getBlocks(sents, 2), [["Hello", "How are you"], ["I am fine"]]) self.assertEqual(textprocessing.getBlocks(sents, 3), [["Hello", "How are you", "I am fine"]])
def test_getBlocks_1(self): sents = textprocessing.getSentences('Hello. How are you? I am fine.') self.assertEqual(textprocessing.getBlocks(sents, 1), [['Hello'], ['How are you'], ['I am fine']]) self.assertEqual(textprocessing.getBlocks(sents, 2), [['Hello', 'How are you'], ['I am fine']]) self.assertEqual(textprocessing.getBlocks(sents, 3), [['Hello', 'How are you', 'I am fine']])
def test_makeIdentifiers_1(self): example = "Hello there. How are you? I am fine." sentences = getSentences(example) blocks = getBlocks(sentences, 2) parse.makeIdentifiers(blocks)
def test_getBlocks_2(self): sents = textprocessing.getSentences("""How do you document real life? When real life's getting more like fiction each day? Headlines, breadlines blow my mind, and now this deadline.""") self.assertEqual(textprocessing.getBlocks(sents, 1), [["How do you document real life"], ["When real lifes getting more like fiction each day"], ["Headlines\n breadlines blow my mind and now this deadline"]])
def runner(self, example, blockLength, hashlist): """ Creates identifiers with makeIdentifiers, and asserts that the md5 hashes match. example: str. blockLength: int. hashlist: list of five hash values. """ sentences = getSentences(example) blocks = getBlocks(sentences, blockLength) makeIdentifiers(blocks, outputDir=self._path) for index, fileName in enumerate(self._fileSet): fileName = os.path.join(self._path, fileName) self.assertTrue(self.EqualFileContents(fileName, hashlist[index]))