Exemplo n.º 1
0
 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"]])
Exemplo n.º 2
0
    def test_makeIdentifiers_1(self):

        example = "Hello there. How are you? I am fine."
        sentences = getSentences(example)
        blocks = getBlocks(sentences, 2)

        parse.makeIdentifiers(blocks)
Exemplo n.º 3
0
 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"]])
Exemplo n.º 4
0
 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"]])
Exemplo n.º 5
0
 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']])
Exemplo n.º 6
0
    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]))
Exemplo n.º 7
0
 def test_getSentences_3(self):
     sents = "One. Two three. Three. Four"
     self.assertEqual(textprocessing.getSentences(sents),
                      ["One", "Two three", "Three", "Four"])
Exemplo n.º 8
0
 def test_getSentences_2(self):
     sents = "We hold these truths to be self evident."
     self.assertEqual(textprocessing.getSentences(sents),
                      ["We hold these truths to be self evident"])
Exemplo n.º 9
0
 def test_getSentences_1(self):
     sents = "Hi there. Hello there. Bye now."
     self.assertEqual(textprocessing.getSentences(sents),
                      ["Hi there", "Hello there", "Bye now"])
Exemplo n.º 10
0
 def test_getSentences_3(self):
     sents = 'One. Two three. Three. Four'
     self.assertEqual(textprocessing.getSentences(sents),
                      ['One', 'Two three', 'Three', 'Four'])
Exemplo n.º 11
0
 def test_getSentences_1(self):
     sents = 'Hi there. Hello there. Bye now.'
     self.assertEqual(textprocessing.getSentences(sents),
                      ['Hi there', 'Hello there', 'Bye now'])