From f1a77980edcf77bf241dceb864c5f6df812a1f66 Mon Sep 17 00:00:00 2001
From: "johannes.heinecke" <johannes.heinecke@orange.com>
Date: Tue, 15 Nov 2016 15:34:33 +0100
Subject: [PATCH] programme test pour l'export

---
 CMakeLists.txt             |  2 ++
 maca_export/CMakeLists.txt | 25 ++++++++++++++++++++++++
 maca_export/src/test.cc    | 39 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+)
 create mode 100644 maca_export/src/test.cc

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d0d4cca..fddbb11 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,8 @@ if (${CMAKE_C_COMPILER_VERSION} VERSION_LESS 5.3)
 	#set_property(GLOBAL PROPERTY C_STANDARD 11)
 endif()
 
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
+
 # activate with cmake -DMACA_EXPORT=TRUE 
 # to use macaon in python/java (with swig)
 if(MACA_EXPORT)
diff --git a/maca_export/CMakeLists.txt b/maca_export/CMakeLists.txt
index 8ba50a4..8afb0b1 100644
--- a/maca_export/CMakeLists.txt
+++ b/maca_export/CMakeLists.txt
@@ -94,6 +94,31 @@ if(MACA_EXPORT)
   else()
     message("swig >= 3.0 not installed on your system")
   endif()
+
+
+  
+
+  set(TESTSOURCES 
+	src/maca_lemmatizer_export.cc
+	src/maca_trans_parser_export.cc
+	src/maca_trans_tagger_export.cc
+  )
+
+#  #compiling library
+#  include_directories(src)
+#  add_library(swigtransparse ${TESOURCES})
+#target_link_libraries(transparse perceptron)
+
+
+
+   add_executable(testcxx ./src/test.cc ${TESTSOURCES})
+   target_link_libraries(testcxx perceptron)
+   target_link_libraries(testcxx transparse)
+   target_link_libraries(testcxx maca_common)
+#   install (TARGETS testcxx DESTINATION bin)
+
+
+
 endif()
 
 
diff --git a/maca_export/src/test.cc b/maca_export/src/test.cc
new file mode 100644
index 0000000..f8208ee
--- /dev/null
+++ b/maca_export/src/test.cc
@@ -0,0 +1,39 @@
+#include <iostream>
+#include <fstream>
+
+#include "maca_lemmatizer_export.h"
+#include "maca_trans_parser_export.h"
+#include "maca_trans_tagger_export.h"
+
+// test programme to be able using valgrind on the exported part of macaon
+
+using namespace std ;
+
+int main(int argc, char *argv[]) {
+    if (argc < 4) {
+	cerr << "usage: " << argv[0] << " <langue> <mcd-file> <mcf-file>" << endl;
+	return 1;
+    }
+
+    //MacaonTransTagger *mt = new MacaonTransTagger(argv[1], argv[2]);
+    //MacaonTransLemmatizer *ml = new MacaonTransLemmatizer(argv[1], argv[2]);
+    MacaonTransParser *mp = new MacaonTransParser(argv[1], argv[2]);
+
+    ifstream ifp(argv[3]);
+    string text;
+    string line;
+    while (!ifp.eof()) {
+	getline(ifp, line);
+	text += line + "\n";
+    }
+
+    //const char *tags = mt->tagmcf(text.c_str());
+    //const char *lemmas = ml->lemmatizemcf(tags);
+    //const char *deps = mp->parsemcf(lemmas);
+    const char *deps = mp->parsemcf(text.c_str());
+
+    cout << deps << endl;
+    delete mp;
+    //delete ml;
+    //delete mt;
+}
-- 
GitLab