forked from trep/opentrep
-
Notifications
You must be signed in to change notification settings - Fork 0
Open Travel Request Parser
License
tomspur/opentrep
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Summary: -------- OpenTREP aims at providing a clean API, and the corresponding C++ implementation, for parsing travel-focused requests. It powers the http://search-travel.org Web site. OpenTREP uses Xapian (http://www.xapian.org) for the Information Retrieval part, on freely available travel-related data (e.g., country names and codes, city names and codes, airline names and codes, etc.), mainly to be found in the OpenTravelData project (http://github.com/opentraveldata/optd): http://github.com/opentraveldata/optd/tree/trunk/refdata/ORI OpenTREP exposes a simple, clean and object-oriented, API. For instance, the OPENTREP::interpretTravelRequest() method takes, as input, a string containing the travel request, and yields, as output, the list of the recognized terms as well as their corresponding types. As an example, the travel request 'Washington DC Beijing Monday a/r +AA -UA 1 week 2 adults 1 dog' would give the following list: * Origin airport: Washington, DC, USA * Destination airport: Beijing, China * Date of travel: next Monday * Date of return: 1 week after next Monday * Preferred airline: American Airlines; non-preferred airline: United Airlines * Number of travelers: 2 adults and a dog The output can then be used by other systems, for instance to book the corresponding travel or to visualize it on a map and calendar and to share it with others. OpenTREP makes an extensive use of existing open-source libraries for increased functionality, speed and accuracy. In particular the Boost (C++ Standard Extensions: http://www.boost.org) and SOCI (http://soci.sourceforge.net) libraries are used. Note that OpenTREP currently only recognises points of reference (POR), as to be found in the ori_por_public.csv file: http://github.com/opentraveldata/optd/blob/trunk/refdata/ORI/ori_por_public.csv A good complementary tool is GeoBase (http://opentraveldata.github.io/geobases/), a Python-based software able to access to any travel-related data source. Getting and installing from the Fedora/CentOS/RedHat distribution: ------------------------------------------------------------------ Just use Yum: yum -y install opentrep-devel opentrep-doc You can also get the RPM packages (which may work on Linux distributions like Novel Suse and Mandriva) from the Fedora repository (e.g., for Fedora 21, http://fr2.rpmfind.net/linux/fedora/releases/21/Everything/) Building the library and test binary from Git repository: --------------------------------------------------------- The Sourceforge Git repository may be cloned as following: git clone https://github.com/trep/opentrep.git opentrepgit cd opentrepgit git checkout trunk Then, you need the following packages (Fedora/RedHat/CentOS names here, but names may vary according to distributions): * cmake * gcc-c++ * boost-devel / libboost-dev * python-devel / python-dev * gettext-devel / gettext-dev * sqlite3-devel / libsqlite3-dev * readline-devel / readline-dev * doxygen * tetex-latex (optional) * rpm-build (optional) Building the library and test binary from the tarball: ------------------------------------------------------ The latest stable source tarball (opentrep*.tar.gz or .bz2) can be found here: http://sourceforge.net/project/showfiles.php?group_id=252803 To customise the following to your environment, you can alter the path to the installation directory: export INSTALL_BASEDIR=/home/user/dev/deliveries export TREP_VER=99.99.99 if [ -d /usr/lib64 ]; then LIBSUFFIX=64; fi export LIBSUFFIX_4_CMAKE="-DLIB_SUFFIX=$LIBSUFFIX" Then, as usual: * To configure the project, type something like: mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_BASEDIR}/opentrep-$TREP_VER \ -DCMAKE_BUILD_TYPE:STRING=Debug -DINSTALL_DOC:BOOL=ON \ -DRUN_GCOV:BOOL=OFF ${LIBSUFFIX_4_CMAKE} .. * To build the project, type: make * To test the project, type: make check * To install the library (libopentrep*.so*) and the binary (opentrep), just type: make install * To package the source files, type: make dist * To package the binary and the documentation: make package * To run the local binary version: ./opentrep/opentrep -b * To run the installed version (the first following line must be done once per session): export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INSTALL_BASEDIR/opentrep-$TREP_VER/lib$LIBSUFFIX $INSTALL_BASEDIR/opentrep-$TREP_VER/bin/opentrep -b Checking that the Python module works: -------------------------------------- PYTHONPATH=${INSTALL_BASEDIR}/opentrep-$TREP_VER/lib${LIBSUFFIX}/python/opentrep/ \ python -c "import libpyopentrep; \ openTrepLibrary = libpyopentrep.OpenTrepSearcher(); \ initOK = openTrepLibrary.init ('/tmp/opentrep/xapian_traveldb/', 'nodb', '', 'pyopentrep.log'); \ print openTrepLibrary.search ('S', 'los las')" Running the Django-based application server: -------------------------------------------- export TREP_LIB=${INSTALL_BASEDIR}/opentrep-$TREP_VER/lib$LIBSUFFIX # Optional: export TREP_TRAVELDB=/tmp/opentrep/traveldb export TREP_LOG=django_trep.log cd gui/django/opentrep # The first time, the database must be initialised: #./manage.py syncdb localhost:8000 # Add the Python library directories to PYTHONPATH: export PYTHONPATH=$PYTHONPATH:$INSTALL_BASEDIR/opentrep-$TREP_VER/lib$LIBSUFFIX export PYTHONPATH=$PYTHONPATH:$INSTALL_BASEDIR/opentrep-$TREP_VER/lib$LIBSUFFIX/python/opentrep # Start the Django Web application server ./manage.py runserver localhost:8000 # In another Shell, check that everything went fine with, for instance: midori http://localhost:8000/search?q=rio de janero reykyavik sna francicso ---- Denis Arnaud (February 2014)
About
Open Travel Request Parser
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published