This microservice is designed to support the WOPED/Text2Process service. It exposes several endpoints for various WordNet related functionalities like retrieving the base form of a word, checking a word's hypernym tree, and deriving a verb from a noun.
- Install Docker on your system.
- Navigate to the directory containing the Dockerfile and your application code.
- Run
docker build -t wordnet-microservice .
to build the Docker image.
Run docker run -p 5000:5000 wordnet-microservice
to start the microservice. The service will be available at http://localhost:5000
.
Run the start.sh
. This script builds and runs an instance of the microservice docker container.
This endpoint accepts a JSON payload with a word and its part of speech, and returns the base form of the word.
word
- The word for which you want to find the base form.pos
- The part of speech of the word. It should be one of 'n' (noun), 'v' (verb), 'a' (adjective) or 'r' (adverb).
Request: POST /baseform
Payload:
{
"word": "running",
"pos": "v"
}
Response:
{
"word": "run"
}
This endpoint accepts a JSON payload with a word, its part of speech, and a list of words to check. It checks whether any of the words in the list is a hypernym of the given word.
word
- The word for which you want to check the hypernym tree.pos
- The part of speech of the word. It should be one of 'n' (noun), 'v' (verb), 'a' (adjective) or 'r' (adverb).words_to_check
- The list of words to check in the hypernym tree.
Request: POST /check_hypernym_tree
Payload:
{
"word": "dog",
"pos": "n",
"words_to_check": ["mammal", "insect"]
}
Response:
{
"status": "success"
}
This endpoint accepts a JSON payload with a noun, and returns a verb that is derived from the noun.
word
- The noun from which you want to derive a verb.
Request: POST /derive_verb
Payload:
{
"word": "communication"
}
Response:
{
"word": "communicate"
}
This endpoint returns a success message if the service is reachable
Request: GET /healthcheck
Response:
{
"Success": "Todo bien"
}
Please note that this service uses the WordNet lexical database and the NLTK lemmatizer to process the requests. The returned values are based on the data in WordNet.