Skip to content

Question Answering over Multiple and Heterogeneous Knowledge Bases

License

Notifications You must be signed in to change notification settings

librairy/MuHeQA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Question Answering over Multiple and Heterogeneous Knowledge Bases

                                        Docker Python Task License

The MuHeQA (Multiple and Heterogeneous Question-Answering) system creates natural language answers from natural language questions using knowledge base from both structured (KG) and unstructured (documents) data sources.

Quick Start!

Install the muheqa package:

pip install muheqa

Create a new connection to Wikidata, or DBpedia, or D4C (Drugs4Covid). The first time it may take a few minutes to download the required models:

import muheqa.connector as mhqa

wikidata = mhqa.connect(wikidata=True)

And finally, make a question in natural language!:

response = wikidata.query("Who is the father of Barack Obama")
print("Response:",response)

Preparation

  1. Prepare a Python 3 environment and install the Conda framework.
  2. Clone this repo:
    git clone https://github.com/librairy/MuHeQA.git
    
  3. Move into the root directory:
    cd MuHeQA
    
  4. Create an environment (if it does not already exist):
    conda create --name .muheqa python=3.9
    
  5. Activate the environment:
    conda activate .muheqa
    
  6. Download the answer classifier and unzip into the root project directory. The folder resources_dir/ is created.
    wget -O resources.zip https://delicias.dia.fi.upm.es/nextcloud/index.php/s/Jp5FeoBn57c8k4M/download
    unzip resources.zip
    
  7. Install dependencies
    pip install -r requirements.txt
    

M1 Environments (only for Apple's M1 devices)

  1. Install TensorFlow dependencies
    conda install -c apple tensorflow-deps
    
  2. Install base TensorFlow
    pip install tensorflow-macos
    
  3. Install tensorflow-metal plugin
    pip install tensorflow-metal