rali-udem / bppcode

Master's Degree Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BPPCode

This repository contains the code used to generate letters in Philippe Grand'Maison's master's thesis. Not all parts of the packages are intended to be portable.

Subprojects

GenText

The Natural Language Generation library.

BPPGen

  • Configuration of GenText for recruitment letters.
  • Small Flask server, containing a Web Interface and a small web API.
  • API access to BPP data.

BPPGenBuild

This project contains the code that built the resources for BPPGen. This project is much more flaky: it depends on such things as a comptatible MongoDB. All resources generated by BPPGenBuild can be found in the appropriate language's letter_data folder.

HOWTO

Requirements

  • A Linux system.
  • Python 2.7.11
  • The python-dev package (apt-get install python-dev)
  • pip

Install dependencies

To install in user mode, use pip --user install. To install in global mode, use sudo pip install.

For GenText

You need nodejs and python-dev. On Debian, that's:

apt-get install python-dev nodejs

Then you can get the python dependencies.

pip install nltk mock==1.0.1

For BPPGen

You need python-lxml. On Debian, that's:

apt-get install python-lxml

Then you can get the python dependencies.

pip install sklearn six certifi flask pymongo langid bs4 lxml urllib3

You might experience problems with Flask on some installations. The package had incorrect dependency management in older versions. Simply do the following:

pip install werkzeug click itsdangerous jinja2

Test installation

From within this project's root directory.

For GenText

PYTHONPATH=gentext python -m unittest discover -s gentext/tests/ -p "test_*.py"

For BPPGen

PYTHONPATH=gentext:bppgen python -m unittest discover -s bppgen/tests/ -p "test_*.py"

Test Server

cd bppgen
./runserver.sh

And follow the link. It should work out of the box.

Make the application public

The application is configured to run locally. You may want to make it available to the Web.

  • One option is to use Flask's ability to act as a stand-alone server. You simply have to modify .runserver.sh and add the keyword prod after "application.py". This option requires apache2 to be stopped. This NOT recommended, but really easy.

  • The recommended option is to configure apache2 properly. To configure apache2 to serve a Flask application, follow the instructions at http://flask.pocoo.org/docs/0.12/deploying/mod_wsgi/. Pay special attention to WSGIDaemonProcess/WSGIProcessGroup to avoid problems with the Global Interpreter Lock.

Warning

The French version does not work. It would require linguistic resources to properly assign gender. Lexicon generation would have to be more complex.

About

Master's Degree Code


Languages

Language:JavaScript 81.9%Language:Python 17.4%Language:HTML 0.7%Language:CSS 0.0%Language:Shell 0.0%