Skip to main content
Back to NLP Topics The KG Generator is a command-line tool that automatically extracts terms from your FAQ list, defines a hierarchy, and associates FAQs to the appropriate terms. Use it to bootstrap a KG from an existing Q&A dataset instead of building the structure manually.
Review and adjust the generated output before importing—it is a suggestion, not a final structure.
The generator is available at Kore.ai GitHub.

Prerequisites

RequirementNotes
Python 3.6Download
Virtual environmentRecommended. See Python venv docs.
Microsoft Visual C++ Build Tools (Windows)Tested with v14.0.
Windows 10 SDK (Windows 10)Download. Keep OS up to date for DLL compatibility.
FAQ fileJSON or CSV format. Export from XO Platform or build a CSV with questions in column 1 and answers in column 2.

Setup

  1. Download and extract the KG Generator zip file.
  2. Open a terminal in the extracted folder.
  3. Activate your virtual environment:
    • Windows: <venvs_folder>/<venv_name>/Scripts/activate
    • Unix/macOS: <venvs_folder>/<venv_name>/bin/activate
  4. Install dependencies:
    pip install -r requirements.txt
    
  5. Verify installation: pip list — confirm all packages from requirements.txt are listed.
  6. Download the spaCy English model:
    python -m spacy download en
    

Run the Generator

python KnowledgeGraphGenerator.py --file_path <INPUT_FILE_PATH> --type <INPUT_FILE_TYPE> --language <LANGUAGE_CODE> --v <true/false>
OptionDescriptionRequiredDefault
--file_pathPath to the input file.Yes
--typeFile type: json_export (XO JSON export), csv_export (XO CSV export), or CSV (plain Q&A CSV).Yes
--languageLanguage code of the input data.Noen
--vVerbose mode — shows intermediate progress.Nofalse

Output

The generator creates ao_output.json in the project root directory. This file can be imported directly into your AI Agent’s KG. See Import a Knowledge Graph.
Importing replaces the existing KG. Back up your current KG before importing.