Sulci is built on top of Django, and therefore you will need Django installed and an active project to be able to use sulci.
Also, a SQL database (we use Postgresql) is needed.
Retrieve the three files of the three tables:
Warning
Be careful to load at last the sulci_triggertodescriptor, as it has FK to the others.
Note
You may have to change the table owner handly in the SQL files.
Load these three files into your database.
A easy way is to use pip:
pip install git+git@github.com:yohanboniface/sulci.git
Note
A very good habit is to use a virtualenv to do so.
Or you can retrieve the code, and “python setup.py install” or put the sulci folder in your PYTHONPATH:
$ export PYTHONPATH=$PYTHONPATH:`pwd`
Then add “sulci” to your INSTALLED_APPS.
Sample usage:
>>> from sulci.textmining import SemanticalTagger
>>> text = u"""«La Russie et la Chine finiront par regretter leur décision qui
les a vues s’aligner sur un dictateur en fin de vie et qui les a
mises en porte-à-faux avec le peuple syrien.»"""
>>> s = SemanticalTagger(text)
>>> s.descriptors
[(<Descriptor: Russie>, 100.0),
(<Descriptor: Chine>, 100.0),
(<Descriptor: diplomatie>, 14.798308089447328),
(<Descriptor: Dmitri Medvedev>, 10.337552742616033)]
A simple view is provided to easily test Sulci. You need to add the url in your urlconfs, for example:
url(r'^sulci/demo$', 'sulci.views.demo', name='sulci_demo'),
Then you’ll have to start the Django runserver and browse the page http://localhost:8000/sulci/demo.
If you plan to train you own Sulci or to use the command line, you have to add these settings (with you own values, of course):
SULCI_CLI_CONTENT_MANAGER_METHOD_NAME = 'objects'
SULCI_CLI_CONTENT_APP_NAME = 'libe'
SULCI_CLI_CONTENT_MODEL_NAME = 'article'
SULCI_CLI_KEYWORDS_PROPERTY = 'keywords'
SULCI_CLI_CONTENT_PROPERTY = "content"