BabelNet is an innovative multilingual encyclopedic dictionary, with wide lexicographic and encyclopedic coverage of terms, and a semantic network/ontology which connects concepts and named entities in a very large network of semantic relations, made up of about 20 million entries.
For more information, please refer to the documentation below on how to use this image, and our website (https://babelnet.org) for news, updates and papers.
This image, combined with the Python API, allows you to use offline BabelNet indices in a Python application using the Remote Procedure Call paradigm.
To download the BabelNet indices, follow the procedure on the official website.
To start the RPC server using the TCP protocol, run:
docker run -d --name babelnet -v /home/user/BabelNet-5.3/:/root/babelnet -p 7780:8000 \
-p 7790:1234 babelscape/babelnet-rpc:latest
To start the RPC server using the IPC protocol, run:
docker run -d --name babelnet -v /home/user/BabelNet-5.3/:/root/babelnet -p 7780:8000 \
-v /home/user/your_ipc_dir/:/babelnet_ipc babelscape/babelnet-rpc:latest
To support both protocols, run:
docker run -d --name babelnet -v /home/user/BabelNet-5.3/:/root/babelnet -p 7780:8000 \
-p 7790:1234 -v /home/user/your_ipc_dir/:/babelnet_ipc babelscape/babelnet-rpc:latest
To build the command in an interactive way, run the command help inside the docker:
$ docker run -it --rm babelscape/babelnet-rpc:latest help
BabelNet indices path: /home/user/BabelNet-5.3/
Port for documentation ([7780], -1 to ignore): 8080
RPC mode ([tcp]/ipc/all): all
Port for TCP mode ([7790]):
IPC directory: /home/user/your_ipc_dir
To start the RPC server, run the following command:
docker run -d --name babelnet-rpc -p 8080:8000 -p 7790:1234 -v "/home/user/your_ipc_dir:/babelnet_ipc" -v "/home/user/BabelNet-5.3:/root/babelnet" babelscape/babelnet-rpc:latest
BabelNet Python API documentation will be available at http://localhost:8080
To use BabelNet in RPC mode, add one of these lines in your babelnet_conf.yml file
RPC_URL: "tcp://127.0.0.1:7790"
RPC_URL: "ipc:///home/user/your_ipc_dir/socket"
Once the server is up and running, you can install the client Python API with the following command:
pip install babelnet
Documentation on how to use the API and configure it to use the RPC mode can be found in the BabelNet Python API guide.
In the image can be mounted the following volumes:
/root/babelnet: required, this is used to mount the BabelNet offline indices;/babelnet_ipc: this is the optional directory where will be created the IPC socket for RPC mode, if mounted.There are also two ports exposed:
8000 to access the PyDocs via an embedded web server;1234 to allow the RPC service via TCP.If your BabelNet indices are under /home/user/BabelNet-5.3:
-v /home/user/BabelNet-5.3/:/root/babelnet
If you want to access the documentation at http://localhost:7780:
-p 7780:8000
If you want to expose the RPC service endpoint on TCP via tcp://127.0.0.1:7790:
-p 7790:1234
If you want to expose the RPC service via IPC on /home/user/your_ipc_dir/ add:
-v /home/user/your_ipc_dir/:/babelnet_ipc
The final run command:
docker run --name babelnet-rpc -d [all the options you want] babelscape/babelnet-rpc:latest
Or using a docker_compose.yml:
version: "latest"
services:
babelnet-rpc:
ports:
- "7780:8000"
- "7790:1234"
volumes:
- /home/user/BabelNet-5.3/:/root/babelnet
- /home/user/your_ipc_dir/:/babelnet_ipc
This version uses Python 3.8.13 and cloudpickle 2.1.0. It can be used with BabeNet 4.0 and above.
This version uses Python 3.8.13 and cloudpickle 2.1.0. It can be used with BabeNet 4.0, 5.0, 5.1, 5.2.
BabelNet and its API are licensed under the BabelNet Non-Commercial License.
Content type
Image
Digest
sha256:3ba0c684d…
Size
1 GB
Last updated
over 2 years ago
docker pull babelscape/babelnet-rpc