Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for UD_NAIJA #1952

Merged
merged 2 commits into from
Nov 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions flair/datasets/treebanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,33 @@ def __init__(self, base_path: Union[str, Path] = None, in_memory: bool = True):
)

super(UD_GREEK, self).__init__(data_folder, in_memory=in_memory)


class UD_NAIJA(UniversalDependenciesCorpus):
def __init__(self, base_path: Union[str, Path] = None, in_memory: bool = True):

if type(base_path) == str:
base_path: Path = Path(base_path)

# this dataset name
dataset_name = self.__class__.__name__.lower()

# default dataset folder is the cache root
if not base_path:
base_path = Path(flair.cache_root) / "datasets"
data_folder = base_path / dataset_name

# download data if necessary
web_path = "https://raw.githubusercontent.com/UniversalDependencies/UD_Naija-NSC/master"
cached_path(f"{web_path}//pcm_nsc-ud-dev.conllu", Path("datasets") / dataset_name)
cached_path(
f"{web_path}//pcm_nsc-ud-test.conllu", Path("datasets") / dataset_name
)
cached_path(
f"{web_path}//pcm_nsc-ud-train.conllu", Path("datasets") / dataset_name
)

super(UD_NAIJA, self).__init__(data_folder, in_memory=in_memory)


class UD_LIVVI(UniversalDependenciesCorpus):
Expand All @@ -1145,5 +1172,4 @@ def __init__(self, base_path: Union[str, Path] = None, in_memory: bool = True):
cached_path(f"{web_path}/olo_kkpp-ud-test.conllu", Path("datasets") / dataset_name)
cached_path(f"{web_path}/olo_kkpp-ud-train.conllu", Path("datasets") / dataset_name)

super(UD_LIVVI, self).__init__(data_folder, in_memory=in_memory)

super(UD_LIVVI, self).__init__(data_folder, in_memory=in_memory)