-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
38 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,20 @@ | ||
# Spacy NLP Service | ||
|
||
The spaCy NLP tool wrapped as a CLAMS service, spaCy is distributed under the [MIT license](https://github.com/explosion/spaCy/blob/master/LICENSE). | ||
## Description | ||
The spaCy NLP wrapped as a CLAMS service, spaCy is distributed under the [MIT license](https://github.com/explosion/spaCy/blob/master/LICENSE). | ||
|
||
This requires Python 3.8 or higher. For local install of required Python modules see [requirements.txt](requirements.txt). | ||
|
||
## Using this service | ||
|
||
Use `python app.py -t example-mmif.json out.json` just to test the wrapping code without using a server. To test this using a server you run the app as a service in one terminal: | ||
## User instruction | ||
|
||
```bash | ||
$ python app.py | ||
``` | ||
General user instructions for CLAMS apps is available at [CLAMS Apps documentation](https://apps.clams.ai/clamsapp). | ||
|
||
And poke at it from another: | ||
### System requirements | ||
|
||
```bash | ||
$ curl http://0.0.0.0:5000/ | ||
$ curl -H "Accept: application/json" -X POST [email protected] http://0.0.0.0:5000/ | ||
``` | ||
|
||
In CLAMS you usually run this in a container. To create an image | ||
|
||
```bash | ||
$ docker build -f Containerfile -t clams-spacy-wrapper . | ||
``` | ||
This requires Python 3.8 or higher. For local install of required Python modules see [requirements.txt](requirements.txt). | ||
|
||
And to run it as a container: | ||
#### Using as local python programe | ||
|
||
```bash | ||
$ docker run --rm -d -p 5000:5000 clams-spacy-wrapper | ||
$ curl -H "Accept: application/json" -X POST [email protected] http://0.0.0.0:5000/ | ||
``` | ||
Use `python app.py -t example-mmif.json out.json` just to test the wrapping code without using a server. | ||
|
||
The spaCy code will run on each text document in the input MMIF file. The file `example-mmif.json` has one text document in the top level `documents` property and two text documents in one of the views. The text documents all look as follows: | ||
### Configurable runtime parameter | ||
|
||
```json | ||
{ | ||
"@type": "http://mmif.clams.ai/0.4.0/vocabulary/TextDocument", | ||
"properties": { | ||
"id": "m2", | ||
"text": { | ||
"@value": "Hello, this is Jim Lehrer with the NewsHour on PBS...." | ||
} | ||
} | ||
} | ||
``` | ||
Instead of a `text:@value` property the text could in an external file, which would be given as a URI in the `location` property. See the readme file in [https://github.com/clamsproject/app-nlp-example](https://github.com/clamsproject/app-nlp-example) on how to do this. | ||
For the full list of parameters, please refer to the app metadata from [CLAMS App Directory](https://apps.clams.ai/clamsapp/) or [`metadata.py`](metadata.py) file in this repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
# Make sure clams-python version is explicitly specified, at least the lower bound | ||
clams-python==1.0.7 | ||
spacy==3.1.2 | ||
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.1.0/en_core_web_sm-3.1.0.tar.gz#egg=en_core_web_sm | ||
clams-python==1.0.9 | ||
spacy==3.6 |