init
This commit is contained in:
commit
b484958412
163
CMakeLists.txt
Normal file
163
CMakeLists.txt
Normal file
@ -0,0 +1,163 @@
|
||||
# Tutorial: http://www.cmake.org/cmake/help/cmake_tutorial.html
|
||||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(concordia CXX)
|
||||
|
||||
set (CONCORDIA_VERSION_MAJOR 0)
|
||||
set (CONCORDIA_VERSION_MINOR 1)
|
||||
|
||||
# ============================== #
|
||||
# Production paths
|
||||
# ============================== #
|
||||
|
||||
set (PROD_RESOURCES_DIRECTORY "${concordia_SOURCE_DIR}/prod/resources")
|
||||
|
||||
set (PROD_PUDDLE_TAGSET_PATH "${PROD_RESOURCES_DIRECTORY}/puddle/tagset.txt")
|
||||
|
||||
# ============================== #
|
||||
# Testing paths
|
||||
# ============================== #
|
||||
|
||||
set (TEST_RESOURCES_DIRECTORY "${concordia_SOURCE_DIR}/tests/resources")
|
||||
set (TEST_PUDDLE_TAGSET_PATH "${TEST_RESOURCES_DIRECTORY}/puddle/basic-tagset.txt")
|
||||
|
||||
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
set(BASE_TARGETS concordia)
|
||||
|
||||
# ================================================
|
||||
# Third-party libraries
|
||||
# ================================================
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Regular expression libraries
|
||||
# ----------------------------------------------------
|
||||
option(WITH_RE2 "Using RE2 regular expression library" OFF)
|
||||
message(STATUS "Using RE2 regular expression library ${WITH_RE2}")
|
||||
|
||||
if(WITH_RE2)
|
||||
set(HAVE_RE2 1)
|
||||
endif(WITH_RE2)
|
||||
|
||||
option(WITH_PCRE "Using PCRE regular expression library" ON)
|
||||
message(STATUS "Using PCRE regular expression library ${WITH_PCRE}")
|
||||
|
||||
if(WITH_PCRE)
|
||||
set(HAVE_PCRE 1)
|
||||
endif(WITH_PCRE)
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Boost
|
||||
# ----------------------------------------------------
|
||||
set(Boost_USE_STATIC_LIBS OFF)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
find_package(Boost COMPONENTS
|
||||
serialization unit_test_framework system filesystem program_options iostreams REQUIRED)
|
||||
|
||||
# ----------------------------------------------------
|
||||
# libconfig
|
||||
# ----------------------------------------------------
|
||||
find_library(LIBCONFIG_LIB NAMES config++ REQUIRED)
|
||||
find_path(LIBCONFIG_INCLUDE libconfig.h++)
|
||||
|
||||
if(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE})
|
||||
message(STATUS "Found Libconfig")
|
||||
include_directories(${LIBCONFIG_INCLUDE})
|
||||
link_directories(${LIBCONFIG_LIB})
|
||||
endif(EXISTS ${LIBCONFIG_LIB} AND EXISTS ${LIBCONFIG_INCLUDE})
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Snowball stemmer
|
||||
# ----------------------------------------------------
|
||||
find_library(LIBSTEMMER_LIB NAMES stemmer REQUIRED)
|
||||
find_path(LIBSTEMMER_INCLUDE libstemmer.h)
|
||||
|
||||
if(EXISTS ${LIBSTEMMER_LIB} AND EXISTS ${LIBSTEMMER_INCLUDE})
|
||||
message(STATUS "Found libstemmer")
|
||||
include_directories(${LIBSTEMMER_INCLUDE})
|
||||
link_directories(${LIBSTEMMER_LIB})
|
||||
endif(EXISTS ${LIBSTEMMER_LIB} AND EXISTS ${LIBSTEMMER_INCLUDE})
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Logging
|
||||
# ----------------------------------------------------
|
||||
find_library(LOG4CPP_LIB NAMES log4cpp REQUIRED)
|
||||
find_path(LOG4CPP_INCLUDE log4cpp/Appender.hh)
|
||||
|
||||
if(EXISTS ${LOG4CPP_LIB} AND EXISTS ${LOG4CPP_INCLUDE})
|
||||
message(STATUS "Found Log4cpp")
|
||||
include_directories(${LOG4CPP_INCLUDE})
|
||||
link_directories(${LOG4CPP_LIB})
|
||||
endif(EXISTS ${LOG4CPP_LIB} AND EXISTS ${LOG4CPP_INCLUDE})
|
||||
|
||||
# ================================================
|
||||
# Concordia: Configuration
|
||||
# ================================================
|
||||
|
||||
configure_file (
|
||||
"${concordia_SOURCE_DIR}/concordia/common/config.hpp.in"
|
||||
"${concordia_SOURCE_DIR}/concordia/common/config.hpp"
|
||||
)
|
||||
|
||||
configure_file (
|
||||
"${concordia_SOURCE_DIR}/prod/resources/concordia-config/concordia.cfg.in"
|
||||
"${concordia_SOURCE_DIR}/prod/resources/concordia-config/concordia.cfg"
|
||||
)
|
||||
|
||||
configure_file (
|
||||
"${concordia_SOURCE_DIR}/tests/resources/concordia-config/concordia.cfg.in"
|
||||
"${concordia_SOURCE_DIR}/tests/resources/concordia-config/concordia.cfg"
|
||||
)
|
||||
|
||||
|
||||
# ================================================
|
||||
# Concordia: sub-projects
|
||||
# ================================================
|
||||
|
||||
set(ALL_DIRECTORIES concordia concordia-console)
|
||||
|
||||
include_directories("${concordia_SOURCE_DIR}")
|
||||
|
||||
foreach(dir ${ALL_DIRECTORIES})
|
||||
link_directories("${concordia_BINARY_DIR}/${dir}")
|
||||
add_subdirectory(${dir})
|
||||
endforeach(dir)
|
||||
|
||||
|
||||
|
||||
# ================================================
|
||||
# Tests
|
||||
# ================================================
|
||||
|
||||
set(TESTS_TARGETS concordia-tests)
|
||||
|
||||
add_subdirectory(tests)
|
||||
|
||||
ENABLE_TESTING()
|
||||
ADD_TEST(FullTest ${CMAKE_CURRENT_BINARY_DIR}/tests/unit-tests/test_runner)
|
||||
|
||||
# Doxygen
|
||||
find_package(Doxygen)
|
||||
if(DOXYGEN_FOUND)
|
||||
FIND_PROGRAM(DOT_TOOL dot DOC "Dot tool from graphviz")
|
||||
SET(DOXYFILE_LATEX ON)
|
||||
SET(DOXYGEN_HAVE_DOT NO)
|
||||
SET(DOXYGEN_QUIET YES)
|
||||
|
||||
SET(INPUT_FILES)
|
||||
SET(INPUT_FILES "${INPUT_FILES} ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
if(DOT_TOOL)
|
||||
SET(DOXYGEN_HAVE_DOT YES)
|
||||
message(STATUS "Graphviz found")
|
||||
else(DOT_TOOL)
|
||||
message(STATUS "Consider installing Graphviz for call and caller graphs in the documentation")
|
||||
endif(DOT_TOOL)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||
add_custom_target(doc ALL ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen" VERBATIM)
|
||||
|
||||
endif(DOXYGEN_FOUND)
|
||||
|
||||
|
1759
Doxyfile.in
Normal file
1759
Doxyfile.in
Normal file
File diff suppressed because it is too large
Load Diff
69
INSTALL.txt
Normal file
69
INSTALL.txt
Normal file
@ -0,0 +1,69 @@
|
||||
Concordia Installation & Build Manual
|
||||
=================================
|
||||
|
||||
This file describes how to compile, build
|
||||
and install Concordia library.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
* cmake
|
||||
* Boost library
|
||||
* Log4cpp
|
||||
* libstemmer (Snowball stemming library)
|
||||
* (optional) Doxygen
|
||||
|
||||
Boost Ubuntu installation
|
||||
=========================
|
||||
|
||||
sudo apt-get install libboost-dev libboost-serialization-dev libboost-test-dev libboost-filesystem-dev libboost-system-de libboost-program-options-dev libboost-iostreams-dev
|
||||
|
||||
Log4cpp Ubuntu installation
|
||||
===========================
|
||||
|
||||
sudo apt-get install liblog4cpp5-dev
|
||||
|
||||
libconfig Ubuntu installation
|
||||
=============================
|
||||
|
||||
sudo apt-get install libconfig++-dev
|
||||
sudo apt-get install libconfig-dev
|
||||
|
||||
libstemmer Ubuntu installation
|
||||
==============================
|
||||
sudo apt-get install libstemmer-dev
|
||||
|
||||
Perl-compatible regular expressions (PCRE) Ubuntu installation
|
||||
=======================================================
|
||||
|
||||
sudo apt-get install libpcre3-dev
|
||||
|
||||
Doxygen Ubuntu installation
|
||||
=======================================================
|
||||
|
||||
sudo apt-get install doxygen
|
||||
|
||||
Installation procedure
|
||||
======================
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=RELEASE ..
|
||||
make
|
||||
make test
|
||||
make install
|
||||
|
||||
Documentation
|
||||
=============
|
||||
|
||||
If Doxygen is available, a successful compilation generates documentation data in three
|
||||
formats in the build/doc directory.
|
||||
|
||||
The man files in doc/man will be installed during installation. Open doc/html/index.html for
|
||||
a HTML version of the same documentation. The latex directory contains uncompiled latex
|
||||
files. To generate a single pdf file run
|
||||
|
||||
cd doc/latex
|
||||
make
|
||||
|
||||
This should generate a single file called refman.pdf in the same directory.
|
1
README.txt
Normal file
1
README.txt
Normal file
@ -0,0 +1 @@
|
||||
To generate the full documentation follow the steps in INSTALL
|
6
concordia-runner.sh
Executable file
6
concordia-runner.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Running Concordia"
|
||||
|
||||
./build/concordia-console/concordia-console -c prod/resources/concordia-config/concordia.cfg
|
||||
|
3993
cpplint.py
vendored
Executable file
3993
cpplint.py
vendored
Executable file
File diff suppressed because it is too large
Load Diff
7
run-checkers.sh
Executable file
7
run-checkers.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
TARGET_DIR=build
|
||||
|
||||
./cpplint.py --filter=-legal,-build/namespaces,-whitespace/labels,-build/include_what_you_use,-runtime/int,-readability/streams,-build/include_order `find concordia concordia-console -type f -regextype posix-extended -regex '.*\.(cpp|hpp|h|c)' ! -regex '.*\./build.*' ! -regex '.*concordia/common/config.hpp' ! -regex '.*/(t|tests)/.*'` 2> cpplint-result.txt
|
||||
|
||||
cppcheck -D__cplusplus -D__GNUC__=3 -f --enable=all echo `find . -type d ! -path './.git*' ! -path "./${TARGET_DIR}"'*' | perl -ne 'chomp; print "-I$_ "'` `find . -type f -regextype posix-extended -regex '.*\.(cpp|hpp|h|c)' ! -regex '.*\./build.*'` 2> cppcheck-result.txt
|
5
tests/CMakeLists.txt
Normal file
5
tests/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
set(ALL_TESTS_METHODS_DIRS unit-tests common)
|
||||
|
||||
foreach(dir ${ALL_TESTS_METHODS_DIRS})
|
||||
add_subdirectory(${dir})
|
||||
endforeach(dir)
|
3
tests/common/CMakeLists.txt
Normal file
3
tests/common/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
add_library(concordia-tests-common SHARED
|
||||
test_resources_manager.cpp
|
||||
)
|
22
tests/common/test_resources_manager.cpp
Normal file
22
tests/common/test_resources_manager.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "test_resources_manager.hpp"
|
||||
|
||||
#define PUDDLE_TEST_DIRECTORY "puddle"
|
||||
#define CONCORDIA_TAGSET_DIRECTORY "concordia-tagset"
|
||||
#define CONCORDIA_CONFIG_DIRECTORY "concordia-config"
|
||||
|
||||
string TestResourcesManager::getPuddleFilePath(const string & filename) {
|
||||
string result = string(TEST_RESOURCES_DIRECTORY);
|
||||
return result + "/" + PUDDLE_TEST_DIRECTORY + "/" + filename;
|
||||
}
|
||||
|
||||
|
||||
string TestResourcesManager::getTestConcordiaConfigFilePath(const string & filename) {
|
||||
string result = string(TEST_RESOURCES_DIRECTORY);
|
||||
return result + "/" + CONCORDIA_CONFIG_DIRECTORY + "/" + filename;
|
||||
}
|
||||
|
||||
string TestResourcesManager::getProdConcordiaConfigFilePath(const string & filename) {
|
||||
string result = string(PROD_RESOURCES_DIRECTORY);
|
||||
return result + "/" + CONCORDIA_CONFIG_DIRECTORY + "/" + filename;
|
||||
}
|
||||
|
21
tests/common/test_resources_manager.hpp
Normal file
21
tests/common/test_resources_manager.hpp
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef TEST_RESOURCES_MANAGER_HDR
|
||||
#define TEST_RESOURCES_MANAGER_HDR
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <string>
|
||||
|
||||
#include "concordia/common/config.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class TestResourcesManager {
|
||||
public:
|
||||
static string getPuddleFilePath(const string & filename);
|
||||
|
||||
static string getTestConcordiaConfigFilePath(const string & filename);
|
||||
|
||||
static string getProdConcordiaConfigFilePath(const string & filename);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
9
tests/resources/concordia-config/concordia-test.cfg
Normal file
9
tests/resources/concordia-config/concordia-test.cfg
Normal file
@ -0,0 +1,9 @@
|
||||
#----------------------------
|
||||
# Concordia configuration file
|
||||
#---------------------------
|
||||
#
|
||||
|
||||
#Path to the Puddle tagset
|
||||
puddle_tagset_path = "puddle/tagset.txt";
|
||||
|
||||
### eof
|
9
tests/resources/concordia-config/concordia.cfg
Normal file
9
tests/resources/concordia-config/concordia.cfg
Normal file
@ -0,0 +1,9 @@
|
||||
#----------------------------
|
||||
# Concordia configuration file
|
||||
#---------------------------
|
||||
#
|
||||
|
||||
#Path to the Puddle tagset
|
||||
puddle_tagset_path = "/home/rafalj/projects/concordia/tests/resources/puddle/basic-tagset.txt";
|
||||
|
||||
### eof
|
9
tests/resources/concordia-config/concordia.cfg.in
Normal file
9
tests/resources/concordia-config/concordia.cfg.in
Normal file
@ -0,0 +1,9 @@
|
||||
#----------------------------
|
||||
# Concordia configuration file
|
||||
#---------------------------
|
||||
#
|
||||
|
||||
#Path to the Puddle tagset
|
||||
puddle_tagset_path = "@TEST_PUDDLE_TAGSET_PATH@";
|
||||
|
||||
### eof
|
10
tests/resources/concordia-config/invalid.cfg
Normal file
10
tests/resources/concordia-config/invalid.cfg
Normal file
@ -0,0 +1,10 @@
|
||||
#----------------------------
|
||||
# invalid Concordia configuration file
|
||||
#---------------------------
|
||||
#
|
||||
|
||||
|
||||
#Path to the Puddle tagset
|
||||
puddle_tagset_path = "pudlle/tagset.txt" = 1;
|
||||
|
||||
### eof
|
44
tests/resources/puddle/basic-rules.en.txt
Normal file
44
tests/resources/puddle/basic-rules.en.txt
Normal file
@ -0,0 +1,44 @@
|
||||
# ======================================
|
||||
# TIME
|
||||
# ======================================
|
||||
|
||||
Rule "test 17:00"
|
||||
Match: [orth~"([012][0-9]|[1-9]):([0-6][0-9])"];
|
||||
Eval: group(ne_TIME, 1);
|
||||
|
||||
# ======================================
|
||||
# DATES
|
||||
# ======================================
|
||||
|
||||
Rule "day number two digits"
|
||||
Match: [orth~"(0?[1-9]|[12][0-9]|3[01])"];
|
||||
Eval: group(at_DAY_OF_MONTH_NUMBER, 1);
|
||||
|
||||
Rule "ORDINAL as day number"
|
||||
Match: [orth~"(0?[1-9]|[12][0-9]|3[01]).*" && type~"ORDINAL"];
|
||||
Eval: group(at_DAY_OF_MONTH_NUMBER, 1);
|
||||
|
||||
Rule "year number four digits"
|
||||
Match: [orth~"(19[0-9][0-9]|2[01][0-9][0-9])"];
|
||||
Eval: group(at_YEAR_NUMBER, 1);
|
||||
|
||||
Rule "date: number MONTH_NAME year"
|
||||
Match: [type~"at_DAY_OF_MONTH_NUMBER"] [type~"MONTH_NAME"] [type~"at_YEAR_NUMBER"]?;
|
||||
Eval: group(ne_DATE, 1);
|
||||
|
||||
# =======================================
|
||||
# PERSON
|
||||
# =======================================
|
||||
|
||||
Rule "person: first_name and upper case"
|
||||
Match: [type~"FIRST_NAME"] [orth~"[A-Z].*"];
|
||||
Eval: group(ne_PERSON, 1);
|
||||
|
||||
# =======================================
|
||||
# Testing purposes
|
||||
# =======================================
|
||||
|
||||
Rule "city: city of XXX"
|
||||
Match: [orth~"city"/i] [orth~"of"/i] [type~"CITY"];
|
||||
Eval: group(ne_CITY, 3);
|
||||
|
7
tests/resources/puddle/basic-tagset.txt
Normal file
7
tests/resources/puddle/basic-tagset.txt
Normal file
@ -0,0 +1,7 @@
|
||||
[ATTR]
|
||||
|
||||
case = nom gen dat acc inst loc voc
|
||||
|
||||
[POS]
|
||||
|
||||
subst = case
|
3
tests/resources/puddle/test-rules-bug-1433.en.txt
Normal file
3
tests/resources/puddle/test-rules-bug-1433.en.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Rule "street"
|
||||
Match: [orth~"[P]ort.*"]+;
|
||||
Eval: group(ne_ADDRESS, 1);
|
15
tests/resources/puddle/test-rules.en.txt
Normal file
15
tests/resources/puddle/test-rules.en.txt
Normal file
@ -0,0 +1,15 @@
|
||||
Rule "test 17:00"
|
||||
Match: [orth~"([012][0-9]|[1-9]):([0-6][0-9])"];
|
||||
Eval: group(ne_TIME, 1);
|
||||
|
||||
Rule "test date"
|
||||
Match: [orth~"(0?[1-9]|[012][0-9]|3[01])"] [orth~"jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec"/i] [orth~"[12][0-9][0-9][0-9]"];
|
||||
Eval: group(ne_DATE, 1);
|
||||
|
||||
Rule "date: MONTH_NAME year"
|
||||
Match: [type~"MONTH_NAME"] [orth~"(19[0-9][0-9]|2[01][0-9][0-9])"];
|
||||
Eval: group(ne_DATE, 1);
|
||||
|
||||
Rule "street"
|
||||
Match: [orth~"\d+"] [orth~","]? [orth~"[A-Z].*"]+ [orth~"(St|Rd|Street|Avenue|Lane)"];
|
||||
Eval: group(ne_ADDRESS, 1);
|
7
tests/unit-tests/CMakeLists.txt
Normal file
7
tests/unit-tests/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
# executable test_runner
|
||||
add_executable(test_runner
|
||||
test_runner.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(test_runner -Wl,-whole-archive ${TESTS_TARGETS} -Wl,-no-whole-archive ${Boost_LIBRARIES} ${BASE_TARGETS})
|
9
tests/unit-tests/test_runner.cpp
Normal file
9
tests/unit-tests/test_runner.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#define BOOST_TEST_MODULE Main
|
||||
#define BOOST_TEST_MAIN
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
#include "concordia/common/logging.hpp"
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TestRunnerMain) {
|
||||
SET_LOGGING_LEVEL("DEBUG");
|
||||
}
|
10
tests/unit-tests/unit_tests_globals.hpp
Normal file
10
tests/unit-tests/unit_tests_globals.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef UNIT_TESTS_HDR
|
||||
#define UNIT_TESTS_HDR
|
||||
|
||||
#define BOOST_TEST_NO_MAIN
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "concordia/common/config.hpp"
|
||||
#include "concordia/common/logging.hpp"
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user