Skip to content

LRriver/Text2Gremlin

Repository files navigation

Text2Gremlin

[English] | 中文

This project aims to explore the method of generating Gremlin queries from natural language text and verify its feasibility.

Environment Setup

Python Environment

Make sure you have Python and pip installed, then run:

pip install -r requirements.txt

ANTLR4 Environment

The Gremlin-related grammar files have already been processed using ANTLR4 and are located in the ./gremlin directory. You can directly use them. If you want to process your own .g4 grammar files, you need to install JDK and ANTLR4:

# Update package list
sudo apt update

# Install OpenJDK 21
sudo apt install openjdk-21-jdk

# Verify installation
java -version
javac -version

The ANTLR4 JAR file (antlr-4.13.1-complete.jar) has already been downloaded and is located in the ./gremlin directory.

After that, run the build.sh script to process .g4 files with ANTLR4 and generate parser code:

cd Text2Gremlin
sh ./build.sh

Phase 1: AST-based Text2Gremlin Testing

This stage is only based on testing the implementation of Text2Gremli using AST, and has no practical implementation significance

AST Generation

python ./gremlin_ast_gen.py

Syntax Checking Using AST

python ./gremlin_grammar_test.py

Modifying AST and Generating New Gremlin Queries

python ./gremlin_ast_generator.py

Phase 2: LLM-based Vertical Text2Gremlin Augmentation

Related code is located in ./schema_gremlin.

Phase 3: AST-based General Scenario Text2Gremlin Data Augmentation (Future Plans)

Will be updated soon ...

About

To explore the method of Text2Gremlin and verify its feasibility

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •