The simplest way to use the FreeLing libraries is via the provided analyzer sample main program, which allows the user to process an input text to obtain several linguistic processings.
Since it is impossible to write a program that fits everyone's needs, the analyzer program offers you almost all functionalities included in FreeLing, but if you want it to output more information, or do so in a specific format, or combine the modules in a different way, the right path to follow is building your own main program or adapting one of the existing, as described in section 5.2
The analyzer program is usually called
with an option -f config-file
(if ommitted, it will search
for a file named analyzer.cfg in the current directory).
The given config-file
must be an absolute file name, or a
relative path to the current directory.
You can use the default configuration files (located at /usr/local/share/FreeLing/config if you installed from tarball, or at /usr/share/FreeLing/config if you used a .deb package), or either a config file that suits your needs. Note that the default configuration files require the environment variable FREELINGSHARE to be defined and to point to a directory with valid FreeLing data files (e.g. /usr/local/share/FreeLing).
Environment variables are used for flexibility, but if you don't need them, you can replace FREELINGSHARE in your configuration files with a static path.
The analyzer program provides also a server mode (use option
-server) which expects the input from a socket. The program
analyzer_client can be used to read input files and send
requests to the server. The advantatge is that the server remains
loaded after analyzing each client's request, thus reducing the
start-up overhead if many small files have to be processed. Client
and server communicate via sockets. The client-server approach is
also a good strategy to call FreeLing from a language or platform
for which no API is provided: Just launch a server and use you preferred
language to program a client that behaves like analyzer_client
.
The analyze (no final r) script described below handles all these default paths and variables and makes everything easier if you want to use the defaults.