nlp/README.md

75 lines
2.0 KiB
Markdown
Raw Normal View History

2019-03-27 08:40:22 +00:00
# Natural language processing
2019-05-20 10:08:13 +00:00
This repository provides all code that is needed to build a container image for natural language processing utilizing [spaCy](https://spacy.io).
2019-03-27 08:40:22 +00:00
2019-05-20 10:08:13 +00:00
## Build image
2019-03-27 08:40:22 +00:00
2019-05-20 10:08:13 +00:00
1. Clone this repository and navigate into it:
2019-03-27 08:40:22 +00:00
```
2019-05-20 10:08:13 +00:00
git clone https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nlp.git && cd nlp
```
2. Build image:
```
docker build -t sfb1288inf/nlp:latest .
```
Alternatively build from the GitLab repository without cloning:
2019-03-27 08:40:22 +00:00
2019-05-20 10:08:13 +00:00
1. Build image:
```
docker build -t sfb1288inf/nlp:latest https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nlp.git
```
## Download prebuilt image
2019-03-27 08:40:22 +00:00
2019-05-20 10:08:13 +00:00
The GitLab registry provides a prebuilt image. It is automatically created, utilizing the conquaire build servers.
1. Download image:
```
docker pull gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/nlp:latest
2019-03-27 08:40:22 +00:00
```
2019-05-20 10:08:13 +00:00
## Run
2019-03-27 08:40:22 +00:00
2019-05-20 10:08:13 +00:00
1. Create input and output directories for the NLP software:
2019-03-27 08:40:22 +00:00
```
2019-05-20 10:08:13 +00:00
mkdir -p /<mydatalocation>/files_for_nlp /<mydatalocation>/files_from_nlp
```
2. Place your text files inside the `/<mydatalocation>/files_for_nlp` directory. Files should all contain text of the same language.
3. Start the NLP process.
```
docker run \
--rm \
-it \
2019-06-03 11:32:37 +00:00
-u $(id -u $USER):$(id -g $USER) \
2019-06-02 19:38:47 +00:00
-v /<mydatalocation>/files_for_nlp:/input \
-v /<mydatalocation>/files_from_nlp:/output \
2019-05-20 10:08:13 +00:00
sfb1288inf/nlp:latest \
2019-06-02 19:38:47 +00:00
-i /input \
-l <languagecode> \
-o /output
2019-05-20 10:08:13 +00:00
```
The arguments below `sfb1288inf/nlp:latest` are described in the [NLP arguments](#nlp-arguments) part.
If you want to use the prebuilt image, replace `sfb1288inf/nlp:latest` with `gitlab.ub.uni-bielefeld.de:4567/sfb1288inf/nlp:latest`.
4. Check your results in the `/<mydatalocation>/files_from_nlp` directory.
### NLP arguments
`-i path`
* Sets the input directory using the specified path.
* required = True
2019-03-27 08:40:22 +00:00
2019-05-20 10:08:13 +00:00
`-o path`
* Sets the output directory using the specified path.
* required = True
2019-03-27 08:40:22 +00:00
2019-05-20 10:08:13 +00:00
`-l languagecode`
* Tells spaCy which language will be used.
* options = de (German), el (Greek), en (English), es (Spanish), fr (French), it (Italian), nl (Dutch), pt (Portuguese)
* required = True