Skip to content

BERT-based Multilingual Question Answering through Machine Translation

Notifications You must be signed in to change notification settings

mbastakis/Tiresias

Repository files navigation

Tiresias


Website GitHub code size in bytes PyPI - Python Version GitHub branch checks state

A Bilingual Question Answering over DBpedia Abstracts through Machine Translation and BERT.

Description: Tiresias is a research prototype that supports bilingual Question Answering (QA) over DBpedia abstracts. In particular, it retrieves a question either in Greek or in English language, and by exploiting popular Named Entity Recognition models for recognizing the entity of the question, the DBpedia abstracts written in the mentioned languages for the identified entity, Machine Translation (MT) tools, and popular BERT QA models (pretrained in English corpus), it produces the final answer.

Visit the web application here

Technology Stack:

  • HTML
  • CSS
  • JavaScript
  • Tailwind

Screenshot:

webapp-screenshot.png

Requirements

In order to modify the web application you have to clone the repository and use one of the python versions listed above and download the dependencies. It is recommended to create and use a python environment and install the dependencies in the environment.

To create a python environment type:

$ python -m venv $environment_path

And to activate this environment:

$ source $environment_path/bin/activate

Then you can install the dependencies like this:

$ pip install -r requirement.txt

Deployment

The deployment of the web app was done with the help of Nginx and Gunicorn.

NOTE: Before you continue make sure you have installed the requirements.

First of all we have to install Nginx so type:

$ sudo apt update
$ sudo apt install nginx

Now we need to create a configuration for our nginx web server allowing nginx to set up a reverse proxy for our flask application.

$ sudo nano /etc/nginx/sites-enabled/$flask_application_name

Inside the file write this:

server {
	listen 80;
	locaction / {
		proxy_pass http://127.0.0.1:8000;
		proxy_set_header Host $host;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}
}

Then you need to remove the default site of nginx to enable yours:

$ sudo unlink /etc/nginx/sites-enabled/default

Finally we can start workers for our app to make the web app go live:

NOTE: Running as a background process

$ gunicorn --workers=3 app:app --timeout 120 --daemon

NOTE: Running as a process

$ gunicorn --workers=3 app:app --timeout 120

Folder Structure

├── app.py // This is the web application
├── controller.py // Main functions that use the utility scripts
├── README.md
├── requirements.txt // Pip requirements
├── resources // Logo of tiresias 
│   └── tiresias logo.svg
├── static
│   ├── css
│   │   └── style.css // Css of the frontend
│   └── js
│       └── main.js // Controlling the dom, and calling the backend
├── templates
│   └── index.html // frontend
└── utils
    ├── erm.py // Entity Recognition Models retrieve 
    |		    // main entity from a sentence.
    ├── __init__.py
    ├── text_splitter.py // Used for spliting the context to sentences.
    └── translator.py // Used for translating contexts and sentences.

Credits and references

About

BERT-based Multilingual Question Answering through Machine Translation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published