You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_dataset_loader.py 896 B

1234567891011121314151617181920212223242526
  1. import unittest
  2. from fastNLP.io.dataset_loader import Conll2003Loader, PeopleDailyCorpusLoader, \
  3. CSVLoader, SNLILoader
  4. class TestDatasetLoader(unittest.TestCase):
  5. def test_Conll2003Loader(self):
  6. """
  7. Test the the loader of Conll2003 dataset
  8. """
  9. dataset_path = "test/data_for_tests/conll_2003_example.txt"
  10. loader = Conll2003Loader()
  11. dataset_2003 = loader.load(dataset_path)
  12. def test_PeopleDailyCorpusLoader(self):
  13. data_set = PeopleDailyCorpusLoader().load("test/data_for_tests/people_daily_raw.txt")
  14. def test_CSVLoader(self):
  15. ds = CSVLoader(sep='\t', headers=['words', 'label'])\
  16. .load('test/data_for_tests/tutorial_sample_dataset.csv')
  17. assert len(ds) > 0
  18. def test_SNLILoader(self):
  19. ds = SNLILoader().load('test/data_for_tests/sample_snli.jsonl')
  20. assert len(ds) == 3