Skip to content

Commit

Permalink
@reader to @misc due to config file format
Browse files Browse the repository at this point in the history
  • Loading branch information
apmoore1 committed Mar 31, 2022
1 parent f186803 commit 5042323
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions docs/docs/api/spacy_api/lexicon_collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ spaCy registered functions for reading in a
### lexicon\_collection\_from\_tsv

```python
@spacy.util.registry.readers('pymusas.LexiconCollection.from_tsv')
@spacy.util.registry.misc('pymusas.LexiconCollection.from_tsv')
def lexicon_collection_from_tsv(
tsv_file_path: Union[PathLike, str],
include_pos: bool = True
) -> Dict[str, List[str]]
```

`pymusas.LexiconCollection.from_tsv` is a registered function under the
`@readers` function register. Given a `tsv_file_path` it will return a
`@misc` function register. Given a `tsv_file_path` it will return a
dictionary object that can be used to create a
[`pymusas.lexicon_collection.LexiconCollection`](/pymusas/api/lexicon_collection/#lexiconcollection).

Expand Down Expand Up @@ -54,14 +54,14 @@ dictionary object that can be used to create a
### mwe\_lexicon\_collection\_from\_tsv

```python
@spacy.util.registry.readers('pymusas.MWELexiconCollection.from_tsv')
@spacy.util.registry.misc('pymusas.MWELexiconCollection.from_tsv')
def mwe_lexicon_collection_from_tsv(
tsv_file_path: Union[PathLike, str]
) -> Dict[str, List[str]]
```

`pymusas.MWELexiconCollection.from_tsv` is a registered function under the
`@readers` function register. Given a `tsv_file_path` it will return a
`@misc` function register. Given a `tsv_file_path` it will return a
dictionary object that can be used to create a
[`pymusas.lexicon_collection.MWELexiconCollection`](/pymusas/api/lexicon_collection/#mwelexiconcollection).

Expand Down
8 changes: 4 additions & 4 deletions pymusas/spacy_api/lexicon_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
from ..lexicon_collection import LexiconCollection, MWELexiconCollection


@spacy.util.registry.readers('pymusas.LexiconCollection.from_tsv')
@spacy.util.registry.misc('pymusas.LexiconCollection.from_tsv')
def lexicon_collection_from_tsv(tsv_file_path: Union[PathLike, str],
include_pos: bool = True
) -> Dict[str, List[str]]:
'''
`pymusas.LexiconCollection.from_tsv` is a registered function under the
`@readers` function register. Given a `tsv_file_path` it will return a
`@misc` function register. Given a `tsv_file_path` it will return a
dictionary object that can be used to create a
:class:`pymusas.lexicon_collection.LexiconCollection`.
Expand All @@ -45,12 +45,12 @@ def lexicon_collection_from_tsv(tsv_file_path: Union[PathLike, str],
return LexiconCollection.from_tsv(tsv_file_path, include_pos)


@spacy.util.registry.readers('pymusas.MWELexiconCollection.from_tsv')
@spacy.util.registry.misc('pymusas.MWELexiconCollection.from_tsv')
def mwe_lexicon_collection_from_tsv(tsv_file_path: Union[PathLike, str]
) -> Dict[str, List[str]]:
'''
`pymusas.MWELexiconCollection.from_tsv` is a registered function under the
`@readers` function register. Given a `tsv_file_path` it will return a
`@misc` function register. Given a `tsv_file_path` it will return a
dictionary object that can be used to create a
:class:`pymusas.lexicon_collection.MWELexiconCollection`.
Expand Down
4 changes: 2 additions & 2 deletions tests/spacy_api/test_spacy_api_lexicon_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
def test_lexicon_collection_from_tsv() -> None:
lexicon_collection_from_tsv: Callable[[Union[PathLike, str], bool],
Dict[str, List[str]]] \
= spacy.util.registry.readers.get('pymusas.LexiconCollection.from_tsv')
= spacy.util.registry.misc.get('pymusas.LexiconCollection.from_tsv')
collection = lexicon_collection_from_tsv(LEXICON_FILE_PATH, True)
assert isinstance(collection, dict)
assert 19 == len(collection)
Expand All @@ -33,7 +33,7 @@ def test_lexicon_collection_from_tsv() -> None:
def test_mwe_lexicon_collection_from_tsv() -> None:
mwe_lexicon_collection_from_tsv: Callable[[Union[PathLike, str]],
Dict[str, List[str]]] \
= spacy.util.registry.readers.get('pymusas.MWELexiconCollection.from_tsv')
= spacy.util.registry.misc.get('pymusas.MWELexiconCollection.from_tsv')
collection = mwe_lexicon_collection_from_tsv(MWE_LEXICON_FILE_PATH)
assert isinstance(collection, dict)
assert 9 == len(collection)
Expand Down

0 comments on commit 5042323

Please sign in to comment.