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_conll_loader.py 1.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import unittest
  2. import os
  3. from fastNLP.io.loader.conll import MsraNERLoader, PeopleDailyNERLoader, WeiboNERLoader, \
  4. Conll2003Loader, ConllLoader
  5. class TestMSRANER(unittest.TestCase):
  6. @unittest.skipIf('TRAVIS' in os.environ, "Skip in travis")
  7. def test_download(self):
  8. MsraNERLoader().download(re_download=False)
  9. data_bundle = MsraNERLoader().load()
  10. print(data_bundle)
  11. class TestPeopleDaily(unittest.TestCase):
  12. @unittest.skipIf('TRAVIS' in os.environ, "Skip in travis")
  13. def test_download(self):
  14. PeopleDailyNERLoader().download()
  15. class TestWeiboNER(unittest.TestCase):
  16. @unittest.skipIf('TRAVIS' in os.environ, "Skip in travis")
  17. def test_download(self):
  18. WeiboNERLoader().download()
  19. class TestConll2003Loader(unittest.TestCase):
  20. def test_load(self):
  21. Conll2003Loader()._load('test/data_for_tests/conll_2003_example.txt')
  22. class TestConllLoader(unittest.TestCase):
  23. def test_conll(self):
  24. db = Conll2003Loader().load('test/data_for_tests/io/conll2003')
  25. print(db)
  26. class TestConllLoader(unittest.TestCase):
  27. def test_sep(self):
  28. headers = [
  29. 'raw_words', 'ner',
  30. ]
  31. db = ConllLoader(headers = headers,sep="\n").load('test/data_for_tests/io/MSRA_NER')
  32. print(db)