Graph NLU uses graph databases as a means to represent natural language relationships flexibly and dynamically.
The primary motivation for this project is to develop a way to understand natural language dialog in an interactive setting by remembering previous dialog states. Virtual assistants like Siri, Google Assistant, and Alexa have the common problem that they behave like amnesiacs, i.e., they do not remember much about previous interactions.
One proposal to get around the memory problem is by representing the previous dialog states using a persistent graph. Because graphs offer a powerful and interpretable way of encoding high-level representations of entities and their associated relationships, an attractive proposition is to leverage them in processing natural language. Graph databases (e.g., Neo4j) offer a rich suite of tools to quickly construct such graphs and persist them over the long term.
This project is in its research phase, hence all code in this repository is exploratory. The supplied Jupyter (iPython) notebooks do the following:
- Examine several dialog domains
- Explain some of the design considerations for using graphs to process natural language
- Define models for solving a dialog domain
- Evaluate these models for accuracy and usefulness
Explanations behind each code snippet are given where possible. Read the research paper (PDF) discussing a more detailed approach to the personal assistant memory problem.
Get an introduction to this project by viewing the supplied Jupyter notebooks in GitHub under the
- dynamic_memory_1 - Evaluates the bAbI QA tasks using Neo4j queries
Running the Code
The Python code uses the Neo4j graph database to store and query natural language relationships. In addition, several processing steps will require popular Python data processing tools like
- Make sure these are on your system:
- Install the python packages in
requirements.txtif you don't have them already.
pip install -r ./requirements.txt
Running Jupyter Notebooks
- Clone the repository.
git clone https://github.com/Hyperparticle/graph-nlu.git cd ./graph-nlu/notebooks
- Run the iPython notebooks with Jupyter.
- Get an introduction to the project with dynamic_memory_1.
Interested in the project? We'd love to hear your ideas! Open a GitHub issue with your comments.