API that calculates and returns the similarity between words. Currently only Japanese is supported.
docker-compose up -d- Python 3.10.6
- poetry 1.1.6 or higher
First, you need to install dependencies.
poetry installNext, start and enter the virtual environment.
poetry shellThen you can run application server.
uvicorn main:app --reloadWhen you send requests to POST /word_similarity, with body like this:
{
"target_words": ["銀行"],
"candidates": ["現金", "リース資産", "貸倒引当金", "当座預金"],
"top_n": 3
}Then you can obtain below result
{
"results": [
{
"word": "銀行",
"similar_words": [
{
"word": "現金",
"similarity": 0.8859629034996033
},
{
"word": "リース資産",
"similarity": 0.8650936484336853
},
{
"word": "当座預金",
"similarity": 0.7373276352882385
}
]
}
]
}