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.
The Natural Language Generation library.
- Configuration of GenText for recruitment letters.
- Small Flask server, containing a Web Interface and a small web API.
- API access to BPP data.
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.
- A Linux system.
- Python 2.7.11
- The python-dev package (
apt-get install python-dev
) - pip
To install in user mode, use pip --user install
. To install in global mode, use sudo pip install
.
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
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
From within this project's root directory.
PYTHONPATH=gentext python -m unittest discover -s gentext/tests/ -p "test_*.py"
PYTHONPATH=gentext:bppgen python -m unittest discover -s bppgen/tests/ -p "test_*.py"
cd bppgen
./runserver.sh
And follow the link. It should work out of the box.
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 keywordprod
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.
The French version does not work. It would require linguistic resources to properly assign gender. Lexicon generation would have to be more complex.