|
1 | 1 | # Python Semantic Matching Service
|
2 | 2 |
|
3 |
| -This is a proof-of-concept implementation of a semantic matching service |
4 |
| -using Python. |
| 3 | +This is a proof-of-concept implementation of a semantic matching service using Python. |
| 4 | +The idea behind this service is to create a uniform interface for exchanging semantic matches, that are stored |
| 5 | +decentralized across multiple semantic matching services. |
5 | 6 |
|
6 |
| -## Docker |
| 7 | +> [!warning] |
| 8 | +> This project is **not** about finding semantic matches or semantic similarities, it rather requires these as input. |
7 | 9 |
|
| 10 | +## Structure |
| 11 | +The project is structured as follows: |
| 12 | +- `algorithm.py` implements the decentralized match aggregation algorithm |
| 13 | +- `service.py` offers the service implementation using the [FastAPI](https://fastapi.tiangolo.com/) framework. |
| 14 | + Note that you can find a detailed interface description (OpenAPI) by [running](#how-to-use) the server locally and |
| 15 | + navigating to `<endpoint>/docs`. |
| 16 | + |
| 17 | +## How to Use |
| 18 | +There are two main options to run: |
| 19 | + |
| 20 | +### Run `service.py` |
| 21 | +You need a working Python installation (3.11 or higher). |
| 22 | +- Clone this repository |
| 23 | +- Create a new virtual environment: `python3 -m venv venv` (Note that the service is only tested on Linux systems) |
| 24 | +- Activate the virtual environment: `source venv/bin/activate` |
| 25 | +- Install the package: `pip install .` |
| 26 | +- Copy the `config.ini.default` to `config.ini` and adapt the fields as necessary |
| 27 | +- Run the service: `python3 semantic_matcher/service.py` |
| 28 | + |
| 29 | +### Run via Docker |
| 30 | +To run via docker, you obviously need a working docker installation. |
| 31 | +- Clone the repository |
| 32 | +- Copy the `config.ini.default` to `config.ini` and adapt the fields as necessary |
| 33 | +- Choose one of the two options below: |
| 34 | + |
| 35 | +**Option 1:** Build and run manually |
| 36 | + |
| 37 | +In the project root directory: |
8 | 38 | ```commandline
|
9 | 39 | docker build -t semantic_matching_service .
|
10 | 40 | ```
|
11 | 41 | ```commandline
|
12 | 42 | docker run -d -p 8000:8000 semantic_matching_service
|
13 | 43 | ```
|
| 44 | + |
| 45 | +> [!note] |
| 46 | +> You may have to change the port in the run command if you changed it in your `config.ini`. |
| 47 | +
|
| 48 | +**Option 2:** Use the docker compose file |
| 49 | + |
| 50 | +In the project root directory: |
| 51 | +```commandline |
| 52 | +docker compose up |
| 53 | +``` |
| 54 | + |
| 55 | +> [!note] |
| 56 | +> If you changed your `config.ini`, you might need to adapt the respective fields in the `compose.yaml`. |
0 commit comments