Skip to content

Commit

Permalink
GH-457: add deprecation warning to NLPTaskDataLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
aakbik committed May 17, 2019
1 parent 8a4d2a5 commit 73cdaed
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions flair/data_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from enum import Enum
from pathlib import Path

from deprecated import deprecated

import flair
from flair.data import Sentence, Corpus, Token, MultiCorpus
from flair.file_utils import cached_path
Expand Down Expand Up @@ -108,6 +110,7 @@ class NLPTask(Enum):

class NLPTaskDataFetcher:
@staticmethod
@deprecated(version="0.4.1", reason="Use 'flair.datasets' instead.")
def load_corpora(
tasks: List[Union[NLPTask, str]], base_path: Path = None
) -> MultiCorpus:
Expand All @@ -116,6 +119,7 @@ def load_corpora(
)

@staticmethod
@deprecated(version="0.4.1", reason="Use 'flair.datasets' instead.")
def load_corpus(task: Union[NLPTask, str], base_path: [str, Path] = None) -> Corpus:
"""
Helper function to fetch a TaggedCorpus for a specific NLPTask. For this to work you need to first download
Expand Down Expand Up @@ -243,6 +247,7 @@ def load_corpus(task: Union[NLPTask, str], base_path: [str, Path] = None) -> Cor
)

@staticmethod
@deprecated(version="0.4.1", reason="Use 'flair.datasets' instead.")
def load_column_corpus(
data_folder: Union[str, Path],
column_format: Dict[int, str],
Expand Down Expand Up @@ -343,6 +348,7 @@ def load_column_corpus(
)

@staticmethod
@deprecated(version="0.4.1", reason="Use 'flair.datasets' instead.")
def load_ud_corpus(
data_folder: Union[str, Path], train_file=None, test_file=None, dev_file=None
) -> Corpus:
Expand Down Expand Up @@ -384,6 +390,7 @@ def load_ud_corpus(
)

@staticmethod
@deprecated(version="0.4.1", reason="Use 'flair.datasets' instead.")
def load_classification_corpus(
data_folder: Union[str, Path],
train_file=None,
Expand Down Expand Up @@ -465,6 +472,7 @@ def load_classification_corpus(
return Corpus(sentences_train, sentences_dev, sentences_test)

@staticmethod
@deprecated(version="0.4.1", reason="Use 'flair.datasets' instead.")
def read_text_classification_file(
path_to_file: Union[str, Path], max_tokens_per_doc=-1, use_tokenizer=True
) -> List[Sentence]:
Expand Down Expand Up @@ -510,6 +518,7 @@ def read_text_classification_file(
return sentences

@staticmethod
@deprecated(version="0.4.1", reason="Use 'flair.datasets' instead.")
def read_column_data(
path_to_column_file: Path,
column_name_map: Dict[int, str],
Expand Down Expand Up @@ -576,6 +585,7 @@ def read_column_data(
return sentences

@staticmethod
@deprecated(version="0.4.1", reason="Use 'flair.datasets' instead.")
def read_conll_ud(path_to_conll_file: Path) -> List[Sentence]:
"""
Reads a file in CoNLL-U format and produces a list of Sentence with full morphosyntactic annotation
Expand Down

0 comments on commit 73cdaed

Please sign in to comment.