### Install ConceptNet Web Server Sub-package Source: https://github.com/commonsense/conceptnet5/wiki/Build-process Navigate to the 'web' directory and install the sub-package using pip. This is necessary if you did not use the Puppet installation. ```bash cd web pip install -e . ``` -------------------------------- ### Install Ubuntu Dependencies for ConceptNet Source: https://github.com/commonsense/conceptnet5/wiki/Build-process Install essential build tools, Python development headers, and libraries required by ConceptNet on Ubuntu systems. ```bash sudo apt install build-essential python3-pip python3-dev libhdf5-dev libmecab-dev mecab-ipadic-utf8 ``` -------------------------------- ### Install Pytest Dependencies Source: https://github.com/commonsense/conceptnet5/wiki/Build-process Installs the necessary Python packages, pytest and PyLD, for running the ConceptNet test suite. ```bash pip install pytest PyLD ``` -------------------------------- ### Python Example for External Linked Data Source: https://github.com/commonsense/conceptnet5/wiki/API Example of using Python's requests library to get all external Linked Data items connected to a ConceptNet term. ```Python import requests response = requests.get('http://api.conceptnet.io/query?start=/c/en/apple&rel=/r/ExternalURL&limit=1000') obj = response.json() print([edge['end']['@id'] for edge in obj['edges']]) ``` -------------------------------- ### ConceptNet URI Structure Example Source: https://github.com/commonsense/conceptnet5/wiki/API Illustrates the hierarchical structure of ConceptNet URIs, starting from language codes and progressing to specific terms and senses. ```uri /c/it/esempio/n ``` ```uri /c/it/esempio ``` ```uri /c/it ``` -------------------------------- ### Warm Up Disk Cache Source: https://github.com/commonsense/conceptnet5/wiki/Running-your-own-copy Execute this command to pre-load the entire disk into memory, preventing 'cold storage' delays during initial access. ```shell sudo dd if=/dev/xvda of=/dev/null bs=16M ``` -------------------------------- ### Filter related terms by language Source: https://github.com/commonsense/conceptnet5/wiki/API To retrieve related terms in a specific language, use the 'filter' parameter with the URI of the desired language. This example shows how to get English terms related to 'tea kettle'. ```json { "@id": "/related/c/en/tea_kettle?filter=/c/en", "related": [ ... ] } ``` -------------------------------- ### Install PostgreSQL 10 on Ubuntu Source: https://github.com/commonsense/conceptnet5/wiki/Build-process Installs PostgreSQL version 10 on Ubuntu systems. Ensure PostgreSQL is configured to allow user access to create databases. ```bash sudo apt install postgresql-10 ``` -------------------------------- ### Run ConceptNet API Server Source: https://github.com/commonsense/conceptnet5/wiki/Build-process Execute this command from the 'web' subdirectory to start the API using Flask's simple web server. Ensure you are in the correct directory for the script to find its files. ```python python conceptnet_web/api.py ```