Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.assertEqual(
get_corpus_db_detail("XXX"), {}
) # corpus does not exist
self.assertTrue(download("test")) # download the first time
self.assertTrue(download(name="test", force=True)) # force download
self.assertTrue(download(name="test")) # try download existing
self.assertFalse(
download(name="test", url="wrongurl")
) # URL not exist
self.assertFalse(
download(name="XxxXXxxx817d37sf")
) # corpus name not exist
self.assertIsNotNone(get_corpus_db_detail("test")) # corpus exists
self.assertTrue(remove("test")) # remove existing
self.assertFalse(remove("test")) # remove non-existing
self.assertTrue(download(name="test", version="0.1"))
self.assertTrue(remove("test"))
self.assertIsInstance(thai_male_names(), frozenset)
self.assertEqual(
get_corpus_db_detail("XXX"), {}
) # corpus does not exist
self.assertTrue(download("test")) # download the first time
self.assertTrue(download(name="test", force=True)) # force download
self.assertTrue(download(name="test")) # try download existing
self.assertFalse(
download(name="test", url="wrongurl")
) # URL not exist
self.assertFalse(
download(name="XxxXXxxx817d37sf")
) # corpus name not exist
self.assertIsNotNone(get_corpus_db_detail("test")) # corpus exists
self.assertTrue(remove("test")) # remove existing
self.assertFalse(remove("test")) # remove non-existing
self.assertTrue(download(name="test", version="0.1"))
self.assertTrue(remove("test"))
def rm(self, argv):
parser = argparse.ArgumentParser(
description="Remove a dataset",
usage="thainlp data rm ",
)
parser.add_argument(
"dataset_name", type=str, help="dataset/corpus's name",
)
args = parser.parse_args(argv[3:])
if corpus.remove(args.dataset_name):
print("Removed successfully.")
else:
print("Not found.")
def remove(args):
corpus.remove(args.name)