Esempio n. 1
0
 def test_multi_lines(self):
     ospl.process_data("test_multi_lines.txt", "out.txt", True)
     with open("out.txt", 'r') as f:
         f.seek(0)
         output = f.read()
         expected = "This is just one sentence . \nThis is another sentence . \n"
         self.assertEqual(expected, output)
Esempio n. 2
0
 def test_multi_para(self):
     ospl.process_data("test_multi_para.txt", "out.txt", True)
     with open("out.txt", 'r') as f:
         f.seek(0)
         output = f.read()
         expected = "This is just one sentence . \nThis is another sentence . \nThis is the last sentence in this paragraph . \nThis is the first sentence of the second paragraph . \n"
         self.assertEqual(expected, output)
Esempio n. 3
0
 def setUp(self):
     self.test_text = "I have bought this bonnet.\r\nI am Mr. Darcy.\r\nI am.\r\n"
     with open("in.txt",'w') as f:
         f.write(self.test_text)
     self.test_outfile = "out.txt"
     ospl.process_data("in.txt", self.test_outfile, True)
     self.test_markov = Markov(self.test_outfile)
Esempio n. 4
0
 def test_one_line(self):
     ospl.process_data("test_one_line.txt", "out.txt", True)
     with open("out.txt", 'r') as f:
         f.seek(0)
         output = f.read()
         expected = "This , is just ; one sentence . \n"
         self.assertEqual(expected, output)
 def test_multi_para(self):
     ospl.process_data("test_multi_para.txt","out.txt", True)
     with open("out.txt", 'r') as f:
         f.seek(0)
         output = f.read()
         expected = "This is just one sentence . \nThis is another sentence . \nThis is the last sentence in this paragraph . \nThis is the first sentence of the second paragraph . \n"
         self.assertEqual(expected, output)
 def test_multi_lines(self):
     ospl.process_data("test_multi_lines.txt", "out.txt", True)
     with open("out.txt", 'r') as f:
         f.seek(0)
         output = f.read()
         expected = "This is just one sentence . \nThis is another sentence . \n"
         self.assertEqual(expected, output)
 def test_one_line(self):
     ospl.process_data("test_one_line.txt", "out.txt", True)
     with open("out.txt", 'r') as f:
         f.seek(0)
         output = f.read()
         expected = "This , is just ; one sentence . \n"
         self.assertEqual(expected, output)
Esempio n. 8
0
 def setUp(self):
     self.test_text = "I have bought this bonnet.\r\nI am Mr. Darcy.\r\nI am.\r\n"
     with open("in.txt",'w') as f:
         f.write(self.test_text)
     self.test_outfile = "out.txt"
     ospl.process_data("in.txt", self.test_outfile, True)
     self.test_markov = Markov(self.test_outfile)
Esempio n. 9
0
 def setUp(self):
     self.test_text_one = "I have bought this bonnet.\r\nI am Mr. Darcy.\r\nI am.\r\n"
     with open("in_one.txt",'w') as f:
         f.write(self.test_text_one)
     self.test_outfile_one = "out_one.txt"
     ospl.process_data("in_one.txt", self.test_outfile_one, True)
     self.test_markov_one = Markov(self.test_outfile_one)
     
     self.test_text_two = "Stubb is whale.\r\nStarbuck is THE whale.\r\nI am a porpoise.\r\n"
     with open("in_two.txt",'w') as f:
         f.write(self.test_text_two)
     self.test_outfile_two = "out_two.txt"
     ospl.process_data("in_two.txt", self.test_outfile_two, True)
     self.test_markov_two = Markov(self.test_outfile_two)
     
     self.test_markov = DoubleMarkov(self.test_markov_one, self.test_markov_two)