The natural language generation service (aka Leolani Reply generator) This service expects structured data and outputs natural language.
This package contains the functionality to transform structure data into natural language. Either by replying to questions or phrasing thoughts. Both answers to questions and thoughts are represented in JSON. Questions are mapped to SPARQL queries and the SPARQL results are mapped to JSON. Thoughts are the results of predefined SPARQL queries reflecting inferencing on the graph.
This repository uses Python >= 3.7
Be sure to run in a virtual python environment (e.g. conda, venv, mkvirtualenv, etc.)
-
In the root directory of this repo run
pip install -e .
For using this repository as a package different project and on a different virtual environment, you may
-
install a published version from PyPI:
pip install cltl.reply_generation
-
or, for the latest snapshot, run:
pip install git+git://github.com/leolani/cltl-languagegeneration.git@main
Then you can import it in a python script as:
import cltl.reply_generation
Please take a look at the example scripts provided to get an idea on how to run and use this package. Each example has a comment at the top of the script describing the behaviour of the script.
For these example scripts, you need
-
To change your current directory to ./examples/
-
Run some examples (e.g. python test_with_triples.py)
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.