Commit 1cb8e0eaf48f9b79d97acf566e3a7f8717b6bc02

Authored by Michał Lenart
1 parent b5621fce

- podstawowa praca nad wrapperami do Pythona i Javy

git-svn-id: svn://svn.nlp.ipipan.waw.pl/morfeusz/morfeusz@49 ff4e3ee1-f430-4e82-ade0-24591c43f1fd
CMakeLists.txt
... ... @@ -14,7 +14,7 @@ configure_file (
14 14 "${PROJECT_BINARY_DIR}/morfeusz/MorfeuszConfig.hpp"
15 15 )
16 16  
17   -include_directories("${PROJECT_BINARY_DIR}")
  17 +include_directories("${PROJECT_BINARY_DIR}" )
18 18  
19 19 add_subdirectory (morfeusz)
20 20  
... ...
morfeusz/CMakeLists.txt
... ... @@ -2,9 +2,23 @@
2 2 # Make sure the linker can find the Hello library once it is built.
3 3 #link_directories (${Morfeusz_BINARY_DIR}/Hello)
4 4  
5   -include_directories (.)
6   -
7   -add_library (libmorfeusz SHARED const.cpp data/default_fsa.cpp MorphDeserializer.cpp Tagset.cpp fsa/const.cpp MorphInterpretation.cpp Morfeusz.cpp charset/CharsetConverter.cpp charset/CaseConverter.cpp charset/caseconv.cpp charset/conversion_tables.cpp FlexionGraph.cpp)
  5 +#include_directories (swig)
  6 +
  7 +set(SRC_FILES
  8 + const.cpp
  9 + data/default_fsa.cpp
  10 + MorphDeserializer.cpp
  11 + Tagset.cpp
  12 + fsa/const.cpp
  13 + MorphInterpretation.cpp
  14 + Morfeusz.cpp
  15 + FlexionGraph.cpp
  16 + charset/CharsetConverter.cpp
  17 + charset/CaseConverter.cpp
  18 + charset/caseconv.cpp
  19 + charset/conversion_tables.cpp)
  20 +
  21 +add_library (libmorfeusz SHARED ${SRC_FILES})
8 22 set_target_properties(libmorfeusz PROPERTIES OUTPUT_NAME "morfeusz")
9 23  
10 24 add_executable (morfeusz main.cpp)
... ... @@ -25,3 +39,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
25 39 set (CMAKE_EXE_LINKER_FLAGS "-s -Os -static-libstdc++ -static-libgcc")
26 40 set (CMAKE_CXX_FLAGS "-std=c++0x -Wall -pedantic -Wcast-align -Wextra -Wmissing-noreturn -Wcast-qual -Wcast-align")
27 41 endif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
  42 +
  43 +add_subdirectory (java)
  44 +add_subdirectory (python)
... ...
morfeusz/fsa/CMakeLists.txt
No preview for this file type
morfeusz/java/CMakeLists.txt 0 → 100644
  1 +
  2 +# SWIG
  3 +#set(CMAKE_SWIG_OUTDIR swig)
  4 +FIND_PACKAGE(SWIG REQUIRED)
  5 +FIND_PACKAGE(JNI REQUIRED)
  6 +INCLUDE(${SWIG_USE_FILE})
  7 +include(UseJava)
  8 +
  9 +# SWIG Java
  10 +INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH})
  11 +#INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
  12 +INCLUDE_DIRECTORIES(..)
  13 +
  14 +SET(CMAKE_SWIG_FLAGS "")
  15 +
  16 +SET_SOURCE_FILES_PROPERTIES(../morfeusz.i PROPERTIES CPLUSPLUS ON)
  17 +SWIG_ADD_MODULE(morfeusz-java java ../morfeusz.i)
  18 +SWIG_LINK_LIBRARIES(morfeusz-java ${JAVA_LIBRARIES})
  19 +SWIG_LINK_LIBRARIES(morfeusz-java libmorfeusz)
... ...
morfeusz/morfeusz.i 0 → 100644
  1 +
  2 +%module morfeusz
  3 +%{
  4 +#include "Morfeusz.hpp"
  5 +%}
  6 +
  7 +// Very simple C++ example for linked list
  8 +
  9 +%include "Morfeusz.hpp"
  10 +%include "MorphInterpretation.hpp"
... ...
morfeusz/python/CMakeLists.txt 0 → 100644
  1 +
  2 +# SWIG
  3 +#set(CMAKE_SWIG_OUTDIR swig)
  4 +FIND_PACKAGE(SWIG REQUIRED)
  5 +FIND_PACKAGE(PythonLibs)
  6 +INCLUDE(${SWIG_USE_FILE})
  7 +
  8 +# SWIG Java
  9 +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
  10 +#INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
  11 +INCLUDE_DIRECTORIES(..)
  12 +
  13 +SET(CMAKE_SWIG_FLAGS "")
  14 +
  15 +SET_SOURCE_FILES_PROPERTIES(../morfeusz.i PROPERTIES CPLUSPLUS ON)
  16 +SWIG_ADD_MODULE(morfeusz python ../morfeusz.i)
  17 +SWIG_LINK_LIBRARIES(morfeusz ${PYTHON_LIBRARIES})
  18 +SWIG_LINK_LIBRARIES(morfeusz libmorfeusz)
... ...
nbproject/configurations.xml
... ... @@ -26,8 +26,13 @@
26 26 <in>main.cpp</in>
27 27 <in>test_recognize_dict.cpp</in>
28 28 <in>test_result_equals.cpp</in>
29   - <in>test_result_equals_utf16.cpp</in>
30 29 </df>
  30 + <logicalFolder name="morfeusz"
  31 + displayName="morfeusz"
  32 + projectFiles="true"
  33 + root="build/morfeusz">
  34 + <itemPath>build/morfeusz/morfeuszPYTHON_wrap.cxx</itemPath>
  35 + </logicalFolder>
31 36 <logicalFolder name="ExternalFiles"
32 37 displayName="Important Files"
33 38 projectFiles="false"
... ... @@ -38,8 +43,8 @@
38 43 </logicalFolder>
39 44 <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>
40 45 <sourceRootList>
41   - <Elem>fsa</Elem>
42 46 <Elem>morfeusz</Elem>
  47 + <Elem>swig</Elem>
43 48 </sourceRootList>
44 49 <projectmakefile>build/Makefile</projectmakefile>
45 50 <confs>
... ... @@ -59,10 +64,18 @@
59 64 <executablePath>build/morfeusz/test_result_equals</executablePath>
60 65 </makeTool>
61 66 </makefileType>
  67 + <item path="build/morfeusz/morfeuszPYTHON_wrap.cxx"
  68 + ex="false"
  69 + tool="1"
  70 + flavor2="4">
  71 + <ccTool>
  72 + </ccTool>
  73 + </item>
62 74 <folder path="0/charset">
63 75 <ccTool>
64 76 <incDir>
65 77 <pElem>build</pElem>
  78 + <pElem>/usr/include/python2.7</pElem>
66 79 <pElem>morfeusz</pElem>
67 80 <pElem>build/morfeusz</pElem>
68 81 </incDir>
... ... @@ -71,7 +84,7 @@
71 84 <Elem>_OPTIMIZE__=1</Elem>
72 85 <Elem>__PIC__=2</Elem>
73 86 <Elem>__pic__=2</Elem>
74   - <Elem>libmorfeusz_EXPORTS</Elem>
  87 + <Elem>_python_morfeusz_EXPORTS</Elem>
75 88 </preprocessorList>
76 89 <undefinedList>
77 90 <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
... ... @@ -83,6 +96,7 @@
83 96 <ccTool>
84 97 <incDir>
85 98 <pElem>build</pElem>
  99 + <pElem>/usr/include/python2.7</pElem>
86 100 <pElem>morfeusz</pElem>
87 101 <pElem>build/morfeusz</pElem>
88 102 </incDir>
... ... @@ -91,7 +105,27 @@
91 105 <Elem>_OPTIMIZE__=1</Elem>
92 106 <Elem>__PIC__=2</Elem>
93 107 <Elem>__pic__=2</Elem>
94   - <Elem>libmorfeusz_EXPORTS</Elem>
  108 + <Elem>_python_morfeusz_EXPORTS</Elem>
  109 + </preprocessorList>
  110 + <undefinedList>
  111 + <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
  112 + <Elem>__NO_INLINE__</Elem>
  113 + </undefinedList>
  114 + </ccTool>
  115 + </folder>
  116 + <folder path="morfeusz">
  117 + <ccTool>
  118 + <incDir>
  119 + <pElem>build</pElem>
  120 + <pElem>/usr/include/python2.7</pElem>
  121 + <pElem>morfeusz</pElem>
  122 + </incDir>
  123 + <preprocessorList>
  124 + <Elem>NDEBUG</Elem>
  125 + <Elem>_OPTIMIZE__=1</Elem>
  126 + <Elem>__PIC__=2</Elem>
  127 + <Elem>__pic__=2</Elem>
  128 + <Elem>_python_morfeusz_EXPORTS</Elem>
95 129 </preprocessorList>
96 130 <undefinedList>
97 131 <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
... ... @@ -99,10 +133,11 @@
99 133 </undefinedList>
100 134 </ccTool>
101 135 </folder>
102   - <item path="morfeusz/FlexionGraph.cpp" ex="false" tool="1" flavor2="8">
  136 + <item path="morfeusz/FlexionGraph.cpp" ex="false" tool="1" flavor2="4">
103 137 <ccTool>
104 138 <incDir>
105 139 <pElem>build</pElem>
  140 + <pElem>/usr/include/python2.7</pElem>
106 141 <pElem>morfeusz</pElem>
107 142 <pElem>build/morfeusz</pElem>
108 143 </incDir>
... ... @@ -111,7 +146,7 @@
111 146 <Elem>_OPTIMIZE__=1</Elem>
112 147 <Elem>__PIC__=2</Elem>
113 148 <Elem>__pic__=2</Elem>
114   - <Elem>libmorfeusz_EXPORTS</Elem>
  149 + <Elem>_python_morfeusz_EXPORTS</Elem>
115 150 </preprocessorList>
116 151 <undefinedList>
117 152 <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
... ... @@ -119,10 +154,11 @@
119 154 </undefinedList>
120 155 </ccTool>
121 156 </item>
122   - <item path="morfeusz/Morfeusz.cpp" ex="false" tool="1" flavor2="8">
  157 + <item path="morfeusz/Morfeusz.cpp" ex="false" tool="1" flavor2="4">
123 158 <ccTool>
124 159 <incDir>
125 160 <pElem>build</pElem>
  161 + <pElem>/usr/include/python2.7</pElem>
126 162 <pElem>morfeusz</pElem>
127 163 <pElem>build/morfeusz</pElem>
128 164 </incDir>
... ... @@ -131,7 +167,7 @@
131 167 <Elem>_OPTIMIZE__=1</Elem>
132 168 <Elem>__PIC__=2</Elem>
133 169 <Elem>__pic__=2</Elem>
134   - <Elem>libmorfeusz_EXPORTS</Elem>
  170 + <Elem>_python_morfeusz_EXPORTS</Elem>
135 171 </preprocessorList>
136 172 <undefinedList>
137 173 <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
... ... @@ -139,10 +175,11 @@
139 175 </undefinedList>
140 176 </ccTool>
141 177 </item>
142   - <item path="morfeusz/MorphDeserializer.cpp" ex="false" tool="1" flavor2="8">
  178 + <item path="morfeusz/MorphDeserializer.cpp" ex="false" tool="1" flavor2="4">
143 179 <ccTool>
144 180 <incDir>
145 181 <pElem>build</pElem>
  182 + <pElem>/usr/include/python2.7</pElem>
146 183 <pElem>morfeusz</pElem>
147 184 <pElem>build/morfeusz</pElem>
148 185 </incDir>
... ... @@ -151,7 +188,7 @@
151 188 <Elem>_OPTIMIZE__=1</Elem>
152 189 <Elem>__PIC__=2</Elem>
153 190 <Elem>__pic__=2</Elem>
154   - <Elem>libmorfeusz_EXPORTS</Elem>
  191 + <Elem>_python_morfeusz_EXPORTS</Elem>
155 192 </preprocessorList>
156 193 <undefinedList>
157 194 <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
... ... @@ -159,10 +196,11 @@
159 196 </undefinedList>
160 197 </ccTool>
161 198 </item>
162   - <item path="morfeusz/MorphInterpretation.cpp" ex="false" tool="1" flavor2="8">
  199 + <item path="morfeusz/MorphInterpretation.cpp" ex="false" tool="1" flavor2="4">
163 200 <ccTool>
164 201 <incDir>
165 202 <pElem>build</pElem>
  203 + <pElem>/usr/include/python2.7</pElem>
166 204 <pElem>morfeusz</pElem>
167 205 <pElem>build/morfeusz</pElem>
168 206 </incDir>
... ... @@ -171,7 +209,7 @@
171 209 <Elem>_OPTIMIZE__=1</Elem>
172 210 <Elem>__PIC__=2</Elem>
173 211 <Elem>__pic__=2</Elem>
174   - <Elem>libmorfeusz_EXPORTS</Elem>
  212 + <Elem>_python_morfeusz_EXPORTS</Elem>
175 213 </preprocessorList>
176 214 <undefinedList>
177 215 <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
... ... @@ -179,10 +217,11 @@
179 217 </undefinedList>
180 218 </ccTool>
181 219 </item>
182   - <item path="morfeusz/Tagset.cpp" ex="false" tool="1" flavor2="8">
  220 + <item path="morfeusz/Tagset.cpp" ex="false" tool="1" flavor2="4">
183 221 <ccTool>
184 222 <incDir>
185 223 <pElem>build</pElem>
  224 + <pElem>/usr/include/python2.7</pElem>
186 225 <pElem>morfeusz</pElem>
187 226 <pElem>build/morfeusz</pElem>
188 227 </incDir>
... ... @@ -191,7 +230,7 @@
191 230 <Elem>_OPTIMIZE__=1</Elem>
192 231 <Elem>__PIC__=2</Elem>
193 232 <Elem>__pic__=2</Elem>
194   - <Elem>libmorfeusz_EXPORTS</Elem>
  233 + <Elem>_python_morfeusz_EXPORTS</Elem>
195 234 </preprocessorList>
196 235 <undefinedList>
197 236 <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
... ... @@ -199,18 +238,18 @@
199 238 </undefinedList>
200 239 </ccTool>
201 240 </item>
202   - <item path="morfeusz/charset/CaseConverter.cpp" ex="false" tool="1" flavor2="8">
  241 + <item path="morfeusz/charset/CaseConverter.cpp" ex="false" tool="1" flavor2="4">
203 242 <ccTool>
204 243 </ccTool>
205 244 </item>
206 245 <item path="morfeusz/charset/CharsetConverter.cpp"
207 246 ex="false"
208 247 tool="1"
209   - flavor2="8">
  248 + flavor2="4">
210 249 <ccTool>
211 250 </ccTool>
212 251 </item>
213   - <item path="morfeusz/charset/caseconv.cpp" ex="false" tool="1" flavor2="8">
  252 + <item path="morfeusz/charset/caseconv.cpp" ex="false" tool="1" flavor2="4">
214 253 <ccTool>
215 254 </ccTool>
216 255 </item>
... ... @@ -221,10 +260,11 @@
221 260 <ccTool>
222 261 </ccTool>
223 262 </item>
224   - <item path="morfeusz/const.cpp" ex="false" tool="1" flavor2="8">
  263 + <item path="morfeusz/const.cpp" ex="false" tool="1" flavor2="4">
225 264 <ccTool>
226 265 <incDir>
227 266 <pElem>build</pElem>
  267 + <pElem>/usr/include/python2.7</pElem>
228 268 <pElem>morfeusz</pElem>
229 269 <pElem>build/morfeusz</pElem>
230 270 </incDir>
... ... @@ -233,7 +273,7 @@
233 273 <Elem>_OPTIMIZE__=1</Elem>
234 274 <Elem>__PIC__=2</Elem>
235 275 <Elem>__pic__=2</Elem>
236   - <Elem>libmorfeusz_EXPORTS</Elem>
  276 + <Elem>_python_morfeusz_EXPORTS</Elem>
237 277 </preprocessorList>
238 278 <undefinedList>
239 279 <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
... ... @@ -241,14 +281,15 @@
241 281 </undefinedList>
242 282 </ccTool>
243 283 </item>
244   - <item path="morfeusz/data/default_fsa.cpp" ex="false" tool="1" flavor2="8">
  284 + <item path="morfeusz/data/default_fsa.cpp" ex="false" tool="1" flavor2="4">
245 285 <ccTool>
246 286 </ccTool>
247 287 </item>
248   - <item path="morfeusz/fsa/const.cpp" ex="false" tool="1" flavor2="8">
  288 + <item path="morfeusz/fsa/const.cpp" ex="false" tool="1" flavor2="4">
249 289 <ccTool>
250 290 <incDir>
251 291 <pElem>build</pElem>
  292 + <pElem>/usr/include/python2.7</pElem>
252 293 <pElem>morfeusz</pElem>
253 294 <pElem>build/morfeusz</pElem>
254 295 </incDir>
... ... @@ -257,7 +298,7 @@
257 298 <Elem>_OPTIMIZE__=1</Elem>
258 299 <Elem>__PIC__=2</Elem>
259 300 <Elem>__pic__=2</Elem>
260   - <Elem>libmorfeusz_EXPORTS</Elem>
  301 + <Elem>_python_morfeusz_EXPORTS</Elem>
261 302 </preprocessorList>
262 303 <undefinedList>
263 304 <Elem>__GCC_HAVE_DWARF2_CFI_ASM=1</Elem>
... ... @@ -289,11 +330,10 @@
289 330 </incDir>
290 331 </ccTool>
291 332 </item>
292   - <item path="morfeusz/main.cpp" ex="false" tool="1" flavor2="8">
  333 + <item path="morfeusz/main.cpp" ex="false" tool="1" flavor2="4">
293 334 <ccTool>
294 335 <incDir>
295 336 <pElem>build</pElem>
296   - <pElem>morfeusz</pElem>
297 337 <pElem>build/morfeusz</pElem>
298 338 </incDir>
299 339 <preprocessorList>
... ... @@ -305,11 +345,10 @@
305 345 </undefinedList>
306 346 </ccTool>
307 347 </item>
308   - <item path="morfeusz/test_recognize_dict.cpp" ex="false" tool="1" flavor2="8">
  348 + <item path="morfeusz/test_recognize_dict.cpp" ex="false" tool="1" flavor2="4">
309 349 <ccTool>
310 350 <incDir>
311 351 <pElem>build</pElem>
312   - <pElem>morfeusz</pElem>
313 352 <pElem>build/morfeusz</pElem>
314 353 </incDir>
315 354 <preprocessorList>
... ... @@ -321,11 +360,10 @@
321 360 </undefinedList>
322 361 </ccTool>
323 362 </item>
324   - <item path="morfeusz/test_result_equals.cpp" ex="false" tool="1" flavor2="8">
  363 + <item path="morfeusz/test_result_equals.cpp" ex="false" tool="1" flavor2="4">
325 364 <ccTool>
326 365 <incDir>
327 366 <pElem>build</pElem>
328   - <pElem>morfeusz</pElem>
329 367 <pElem>build/morfeusz</pElem>
330 368 </incDir>
331 369 <preprocessorList>
... ... @@ -337,11 +375,6 @@
337 375 </undefinedList>
338 376 </ccTool>
339 377 </item>
340   - <item path="morfeusz/test_result_equals_utf16.cpp"
341   - ex="false"
342   - tool="1"
343   - flavor2="0">
344   - </item>
345 378 </conf>
346 379 </confs>
347 380 </configurationDescriptor>
... ...
nbproject/project.xml
... ... @@ -4,14 +4,14 @@
4 4 <configuration>
5 5 <data xmlns="http://www.netbeans.org/ns/make-project/1">
6 6 <name>morfeusz</name>
7   - <c-extensions/>
8   - <cpp-extensions>cpp</cpp-extensions>
  7 + <c-extensions>i</c-extensions>
  8 + <cpp-extensions>cpp,cxx</cpp-extensions>
9 9 <header-extensions>h,hpp,in</header-extensions>
10 10 <sourceEncoding>UTF-8</sourceEncoding>
11 11 <make-dep-projects/>
12 12 <sourceRootList>
13   - <sourceRootElem>fsa</sourceRootElem>
14 13 <sourceRootElem>morfeusz</sourceRootElem>
  14 + <sourceRootElem>swig</sourceRootElem>
15 15 </sourceRootList>
16 16 <confList>
17 17 <confElem>
... ...