コード例 #1
0
    def test___getitem__(self):
        file = os.path.join(os.path.dirname(__file__), "sample_dbpedia.csv")
        sut = DbpediaDataset(file)
        expected_y = 1
        expected_x = " This is  a sample abstract for my sample title 2 - example 1"

        # Act
        actual_x, actual_y = sut.__getitem__(0)

        # Assert
        self.assertEqual(expected_y, actual_y)
        self.assertEqual(expected_x, actual_x)
コード例 #2
0
    def get_train_dataset(self):
        if self._train_dataset is None:
            self._train_dataset = DbpediaDataset(self.train_data, preprocessor=self.get_preprocessor())

        return self._train_dataset