Esempio n. 1
0
class TestBiTermQueryGeneration(unittest.TestCase):
    def setUp(self):
        self.logger = logging.getLogger("TestQueryGeneration")
        self.qg = BiTermQueryGeneration(minlen=4)

    def test_extract_queries_from_html(self):
        self.logger.debug("Extraction of BiTerm (non) duplicate queries")
        html = '<HTML><b>Test</b> <h1>Extract</h2> Queries <b>Test</b> <h1>Extract</h2></HTML>'
        expected = ['test extract', 'extract queries', 'queries test']
        actual = self.qg.extract_queries_from_html(html)
        self.assertItemsEqual(expected, actual)

        counts = {'test extract': 2, 'extract queries': 1, 'queries test': 1}
        self.assertItemsEqual(self.qg.query_count, counts)
Esempio n. 2
0
class TestBiTermQueryGeneration(unittest.TestCase):

    def setUp(self):
        self.logger = logging.getLogger("TestQueryGeneration")
        self.qg = BiTermQueryGeneration(minlen = 4)

    def test_extract_queries_from_html(self):
        self.logger.debug("Extraction of BiTerm (non) duplicate queries")
        html = '<HTML><b>Test</b> <h1>Extract</h2> Queries <b>Test</b> <h1>Extract</h2></HTML>'
        expected = ['test extract','extract queries', 'queries test']
        actual = self.qg.extract_queries_from_html(html)
        self.assertItemsEqual(expected, actual)

        counts = {'test extract':2, 'extract queries': 1, 'queries test':1}
        self.assertItemsEqual(self.qg.query_count, counts)
Esempio n. 3
0
 def setUp(self):
     self.logger = logging.getLogger("TestQueryGeneration")
     self.qg = BiTermQueryGeneration(minlen = 4)
Esempio n. 4
0
 def setUp(self):
     self.logger = logging.getLogger("TestQueryGeneration")
     self.qg = BiTermQueryGeneration(minlen=4)