コード例 #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"]])
コード例 #2
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"]])
コード例 #3
0
ファイル: test_textprocessing.py プロジェクト: skinn009/rnlp
 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']])
コード例 #4
0
ファイル: test_parse.py プロジェクト: skinn009/rnlp
    def test_makeIdentifiers_1(self):

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

        parse.makeIdentifiers(blocks)
コード例 #5
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"]])
コード例 #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]))