I’ve added link-grammar
as a submodule to this repository. To fetch its
sources you’ll need to:
git submodule init
git submodule update
after you’ve cloned the repository.
- Make sure you’ve fetched the submodules from this repo.
- You will need
SWIG
library installed to compile Python bindings. - This should get the project compiled and installed. Read the notes after
the code before you run it.
cd ./link-grammar ./autogen.sh ./configure --enable-python-bindings \ --prefix=$(readlink -f ..) \ --includedir=$(readlink -f ../includes) make make install
On my machine, even after
SWIG
is installed, thelink-grammar
misses theax_pkg_swig.m4
macro definition file. In case you need it, I’ve copied it to ./etc/ax_pkg_swig.m4. The same goes for ./etc/ax_python_devel.m4. You will need to copy them to ./link-grammar/m4 directory.Before you run
make install
you will also need to edit the ./link-grammar/bindings/Makefile: search for mentions of Perl and remove them. There are two places all in all. First is whereSUBDIRS
is defined, remove the$(am__append_3)
bit. Another one is whereDIST_SUBDIRS
is defined, removeperl
from it.
There’s a file ./requirements.txt which lists all dependencies for
this project. Before you can run it, you will need to make sure
that you have the headers needed to build lxml
package. You will
also need Postgresql headers. This is unfortunate because pip
,
cannot install binary packages. So, for example, you could run:
dnf install libxml2-devel libxslt-devel postgresql-devel
or use your favourite package manager.
Then, run
pip install -r ./requirements.txt
to install the rest.
I’ve added a simple configuration file ./etc/ngircd.conf for ngircd
(this should be available from the package manager). To run it:
ngircd -f /etc/ngircd.conf
After that, connect to the server from, ERC for example and create a
channel #testing
. Once that is done, you can run the bot by doing:
cd ./auntie-rem
./testbot.py localhost '#testing' bot
First, you will need to install it, of course. Once that is done, you will need to intialize ./pg directory to be the data directoy:
initdb ./pg
Notice that you will need to restore ./pg/postgresql.conf file after you intialized the database (but you will only need to do this once). start the server, for example:
postgres -D ./pg
Notice that I had to make a modification to ./pg/postgresql.conf to specify
the directory where the database creates a lock file (by default it tries
to create it in /var/run/postgresql
which requires elevated permissions to
access. This also means that whenever you run other Postgres utilities, you
will need to specify this directory too, for example, to start the Postgres
command-line client you would need to:
psql -h /tmp -U auntie
I’ve also created a user and a database:
user | database | password |
---|---|---|
auntie | auntie-rem | auntie-password |
This is the one that will be used by the application, but you can, of course add your own user.
After you are done working with the database:
pg_dumpall -U auntie -h /tmp -f ./pg/db.sql
tar -zcf ./pg/db.tar.gz ./pg/db.sql --remove-files
You should be able to import this database later with:
tar -x ./pg/db.tar.gz
psql -h /tmp -d auntie-rem -U auntie -f ./pg/db.sql
You can run this script interactively to examine the contents of the database.
To do this, start the script giving it --test
argument:
./log_import.py -t
This will launch IPython
console. Here you can do things like:
In [1]: first_user = session.query(User).first() In [2]: first_user? Type: User String form: <user ukari> File: ~/Projects/auntie-rem/auntie-rem/log_import.py Docstring: <no docstring> Init docstring: A simple constructor that allows initialization from kwargs. Sets attributes on the constructed instance using the names and values in ``kwargs``. Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.