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 irish dataset to treebanks #2235

Merged
merged 1 commit into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions flair/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
from .treebanks import UD_BELARUSIAN
from .treebanks import UD_OLD_CHURCH_SLAVONIC
from .treebanks import UD_COPTIC
from .treebanks import UD_IRISH

# Expose all text-text datasets
from .text_text import ParallelTextCorpus
Expand Down
28 changes: 27 additions & 1 deletion flair/datasets/treebanks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1587,4 +1587,30 @@ def __init__(self, base_path: Union[str, Path] = None, in_memory: bool = True, s
f"{web_path}/cop_scriptorium-ud-train.conllu", Path("datasets") / dataset_name
)

super(UD_COPTIC, self).__init__(data_folder, in_memory=in_memory, split_multiwords=split_multiwords)
super(UD_COPTIC, self).__init__(data_folder, in_memory=in_memory, split_multiwords=split_multiwords)

class UD_IRISH(UniversalDependenciesCorpus):
def __init__(self, base_path: Union[str, Path] = None, in_memory: bool = True, split_multiwords: 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_Irish-IDT/master"
cached_path(f"{web_path}/ga_idt-ud-dev.conllu", Path("datasets") / dataset_name)
cached_path(
f"{web_path}/ga_idt-ud-test.conllu", Path("datasets") / dataset_name
)
cached_path(
f"{web_path}/ga_idt-ud-train.conllu", Path("datasets") / dataset_name
)

super(UD_IRISH, self).__init__(data_folder, in_memory=in_memory, split_multiwords=split_multiwords)