Skip to content

Commit

Permalink
Feature/spacy requirements (#29)
Browse files Browse the repository at this point in the history
* Update requirements 📌

* Bump version 🔖

* 🎨

* Update readme file 📝

* ✅
  • Loading branch information
asajatovic committed Oct 18, 2020
1 parent b7cf1a9 commit 8b36d38
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ pip install spacy-udpipe

After installation, use `spacy_udpipe.download()` to download the pre-trained model for the desired language.

A full list of pre-trained UDPipe models for supported languages can be found in [`languages.json`](https://github.com/TakeLab/spacy-udpipe/blob/master/spacy_udpipe/languages.json).

## Usage
The loaded UDPipeLanguage class returns a spaCy [`Language` object](https://spacy.io/api/language), i.e., the object you can use to process text and create a [`Doc` object](https://spacy.io/api/doc).

Expand All @@ -39,7 +41,7 @@ The type of `text` can be one of the following:
* presegmented: `List[str]`,
* pretokenized: `List[List[str]]`.

#### Loading a custom model
### Loading a custom model
The following code snippet demonstrates how to load a custom `UDPipe` model (for the Croatian language):
```python
import spacy_udpipe
Expand All @@ -55,25 +57,20 @@ for token in doc:
```
This can be done for any of the languages supported by spaCy. For an exhaustive list, see [spaCy languages](https://spacy.io/usage/models#languages).

## Authors and acknowledgment
Created by [Antonio Šajatović](http://github.com/asajatovic) during an internship at [Text Analysis and Knowledge Engineering Lab (TakeLab)](http://takelab.fer.hr/).

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update the tests as appropriate. Tests are run automatically for each pull request on the master branch.
To start the tests locally, first, install the package with `pip install -e .`, then run [`pytest`](https://docs.pytest.org/en/latest/contents.html) in the root source directory.

## License
[MIT](https://choosealicense.com/licenses/mit/) © Text Analysis and Knowledge Engineering Lab (TakeLab)
* Source code: [MIT](https://choosealicense.com/licenses/mit/) © Text Analysis and Knowledge Engineering Lab (TakeLab)
* Available pre-trained models: [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)

## Project status
Maintained by [Text Analysis and Knowledge Engineering Lab (TakeLab)](http://takelab.fer.hr/).

## Notes
* All available pre-trained models are licensed under [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/).

* A full list of pre-trained models for supported languages is available in [`languages.json`](https://github.com/TakeLab/spacy-udpipe/blob/master/spacy_udpipe/languages.json).

* This package exposes a `spacy_languages` entry point in its [`setup.py`](https://github.com/TakeLab/spacy-udpipe/blob/master/setup.py) so full suport for serialization is enabled:
```python
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spacy>=2.1.0
spacy>=2.1.0,<3.0.0
ufal.udpipe>=1.2.0
# Development dependencies
pytest>=5.0.0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_version(fname: str) -> str:
license="MIT",
keywords="nlp udpipe spacy python",
packages=setuptools.find_packages(),
install_requires=["spacy>=2.1.0", "ufal.udpipe>=1.2.0"],
install_requires=["spacy>=2.1.0,<3.0.0", "ufal.udpipe>=1.2.0"],
python_requires=">=3.6",
entry_points=ENTRY_POINTS,
tests_require=["pytest>=5.0.0"],
Expand Down
2 changes: 1 addition & 1 deletion spacy_udpipe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.3.1"
__version__ = "0.3.2"
__all__ = ["UDPipeLanguage", "UDPipeModel",
"load", "load_from_path", "download"]

Expand Down
2 changes: 1 addition & 1 deletion spacy_udpipe/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

def _check_language(lang: str) -> None:
if lang not in LANGUAGES:
raise Exception("'{}' language not available".format(lang))
raise Exception(f"'{lang}' language not available")


def _check_models_dir(lang: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_spacy_udpipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

EN = "en"
RO = "ro"
SPACY_VERSION = "2.2.4"
SPACY_VERSION = "3.0.0"


@pytest.fixture
Expand Down

0 comments on commit 8b36d38

Please sign in to comment.