Commit a2756826c94899d4e40cd0934384cb9823d19724
1 parent
775b3a73
- cross-kompilacja na maca (na razie przynajmniej udaje, że działa)
git-svn-id: svn://svn.nlp.ipipan.waw.pl/morfeusz/morfeusz@62 ff4e3ee1-f430-4e82-ade0-24591c43f1fd
Showing
22 changed files
with
511 additions
and
21 deletions
CMakeLists.txt
@@ -6,7 +6,7 @@ set (Morfeusz_VERSION_MINOR 1) | @@ -6,7 +6,7 @@ set (Morfeusz_VERSION_MINOR 1) | ||
6 | set (CMAKE_BUILD_TYPE "Release") | 6 | set (CMAKE_BUILD_TYPE "Release") |
7 | 7 | ||
8 | set (CMAKE_CXX_FLAGS "-std=c++98 -Wall -pedantic -Wcast-align -Wextra -Wmissing-noreturn -Wconversion -Wcast-qual -Wcast-align") | 8 | set (CMAKE_CXX_FLAGS "-std=c++98 -Wall -pedantic -Wcast-align -Wextra -Wmissing-noreturn -Wconversion -Wcast-qual -Wcast-align") |
9 | -set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") | 9 | +# set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") |
10 | 10 | ||
11 | enable_testing() | 11 | enable_testing() |
12 | 12 | ||
@@ -39,29 +39,31 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | @@ -39,29 +39,31 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
39 | 39 | ||
40 | # copy jmorfeusz to java source tree | 40 | # copy jmorfeusz to java source tree |
41 | add_custom_target (copy-jmorfeusz-libs ALL | 41 | add_custom_target (copy-jmorfeusz-libs ALL |
42 | - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}jmorfeusz${CMAKE_JAVA_LIBRARY_SUFFIX} ${PROJECT_SOURCE_DIR}/jmorfeusz/src/main/native | ||
43 | - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_SHARED_LIBRARY_PREFIX}morfeusz${CMAKE_SHARED_LIBRARY_SUFFIX} ${PROJECT_SOURCE_DIR}/jmorfeusz/src/main/native | 42 | + COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/morfeusz/java/${CMAKE_SHARED_LIBRARY_PREFIX}jmorfeusz${CMAKE_JAVA_LIBRARY_SUFFIX} ${PROJECT_SOURCE_DIR}/jmorfeusz/src/main/native |
43 | + # COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/morfeusz/${CMAKE_SHARED_LIBRARY_PREFIX}morfeusz${CMAKE_SHARED_LIBRARY_SUFFIX} ${PROJECT_SOURCE_DIR}/jmorfeusz/src/main/native | ||
44 | DEPENDS ${JMORFEUSZ}) | 44 | DEPENDS ${JMORFEUSZ}) |
45 | 45 | ||
46 | # build jmorfeusz | 46 | # build jmorfeusz |
47 | # add_custom_command(TARGET all POST_BUILD mvn package -PotherOutputDir -DoutputDir=${PROJECT_BINARY_DIR}/jmorfeusz/target WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/jmorfeusz) | 47 | # add_custom_command(TARGET all POST_BUILD mvn package -PotherOutputDir -DoutputDir=${PROJECT_BINARY_DIR}/jmorfeusz/target WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/jmorfeusz) |
48 | add_custom_target ( jmorfeusz-maven-package ALL | 48 | add_custom_target ( jmorfeusz-maven-package ALL |
49 | - COMMAND mvn package -PotherOutputDir -DoutputDir=${PROJECT_BINARY_DIR}/jmorfeusz | 49 | + COMMAND mvn package -PotherOutputDir -DoutputDir=${PROJECT_BINARY_DIR}/jmorfeusz -DskipTests=true |
50 | DEPENDS copy-jmorfeusz-libs | 50 | DEPENDS copy-jmorfeusz-libs |
51 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/jmorfeusz) | 51 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/jmorfeusz) |
52 | 52 | ||
53 | ########## PYTHON ########## | 53 | ########## PYTHON ########## |
54 | 54 | ||
55 | -# find out library suffix (CMAKE_JAVA_LIBRARY_SUFFIX) | 55 | +# find out library suffix |
56 | if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | 56 | if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
57 | set (CMAKE_PYTHON_LIBRARY_SUFFIX ".so") | 57 | set (CMAKE_PYTHON_LIBRARY_SUFFIX ".so") |
58 | +elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||
59 | + set (CMAKE_PYTHON_LIBRARY_SUFFIX ".pyd") | ||
58 | else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | 60 | else (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
59 | set (CMAKE_PYTHON_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) | 61 | set (CMAKE_PYTHON_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) |
60 | endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | 62 | endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
61 | 63 | ||
62 | # copy python->c++ bindings | 64 | # copy python->c++ bindings |
63 | add_custom_target (copy-pymorfeusz-libs ALL | 65 | add_custom_target (copy-pymorfeusz-libs ALL |
64 | - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${PYMORFEUSZ}${CMAKE_PYTHON_LIBRARY_SUFFIX} ${PROJECT_BINARY_DIR}/pymorfeusz | 66 | + COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/morfeusz/python/${PYMORFEUSZ}${CMAKE_PYTHON_LIBRARY_SUFFIX} ${PROJECT_BINARY_DIR}/pymorfeusz |
65 | DEPENDS ${PYMORFEUSZ}) | 67 | DEPENDS ${PYMORFEUSZ}) |
66 | add_custom_target (copy-pymorfeusz-wrapper ALL | 68 | add_custom_target (copy-pymorfeusz-wrapper ALL |
67 | COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/morfeusz/python/morfeusz.py ${PROJECT_BINARY_DIR}/pymorfeusz | 69 | COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/morfeusz/python/morfeusz.py ${PROJECT_BINARY_DIR}/pymorfeusz |
README
@@ -4,9 +4,11 @@ sudo apt-get install g++-multilib g++-mingw-w64 | @@ -4,9 +4,11 @@ sudo apt-get install g++-multilib g++-mingw-w64 | ||
4 | 4 | ||
5 | For Java and Python bindings: | 5 | For Java and Python bindings: |
6 | 6 | ||
7 | -sudo apt-get install swig default-jdk | 7 | +sudo apt-get install swig default-jdk python |
8 | 8 | ||
9 | +************* | ||
9 | Mac OS X | 10 | Mac OS X |
11 | +************* | ||
10 | 12 | ||
11 | ## install xcode (using apple store) | 13 | ## install xcode (using apple store) |
12 | 14 | ||
@@ -29,3 +31,23 @@ brew install make | @@ -29,3 +31,23 @@ brew install make | ||
29 | # Must say everything is okay ("your system is ready to brew"): | 31 | # Must say everything is okay ("your system is ready to brew"): |
30 | brew doctor | 32 | brew doctor |
31 | 33 | ||
34 | +************* | ||
35 | +Windows | ||
36 | +************* | ||
37 | + | ||
38 | +Install MinGW and make sure it is included in Path system variable (when installed at C:\MinGW then C:\MinGW\bin must be in the Path variable). | ||
39 | +Install CMake. | ||
40 | +Download SWIG. Unpack the .zip contents somewhere (for example C:\swigwin-VERSION) | ||
41 | +Add the unpacked SWIG directory to the Path variable. | ||
42 | +Install latest Java JDK. | ||
43 | +Go to morfeusz sources root. | ||
44 | +mkdir build | ||
45 | +cd build | ||
46 | +cmake | ||
47 | + | ||
48 | +CROSS COMPILE | ||
49 | +------------- | ||
50 | + | ||
51 | +Make your own CMake from sources using this patch: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=19b7a54d | ||
52 | +(or use version > 3.0) | ||
53 | +Add Java and Python libraries to the Toolchain file. Copy python27.dll from C:\Windows\System32 to some shared libs directory. | ||
32 | \ No newline at end of file | 54 | \ No newline at end of file |
cmake-2.8.12.1-patch.diff
0 → 100644
1 | +diff -ru cmake-2.8.12.1-orig/Modules/FindSWIG.cmake cmake-2.8.12.1/Modules/FindSWIG.cmake | ||
2 | +--- cmake-2.8.12.1-orig/Modules/FindSWIG.cmake 2013-11-05 20:07:22.000000000 +0100 | ||
3 | ++++ cmake-2.8.12.1/Modules/FindSWIG.cmake 2013-12-24 23:11:51.561312112 +0100 | ||
4 | +@@ -45,7 +45,7 @@ | ||
5 | + string(REGEX REPLACE "[\n\r]+" ";" SWIG_swiglib_output ${SWIG_swiglib_output}) | ||
6 | + # force the path to be computed each time in case SWIG_EXECUTABLE has changed. | ||
7 | + set(SWIG_DIR SWIG_DIR-NOTFOUND) | ||
8 | +- find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output}) | ||
9 | ++ find_path(SWIG_DIR swig.swg PATHS ${SWIG_swiglib_output} NO_CMAKE_FIND_ROOT_PATH) | ||
10 | + if(SWIG_DIR) | ||
11 | + set(SWIG_USE_FILE ${CMAKE_ROOT}/Modules/UseSWIG.cmake) | ||
12 | + execute_process(COMMAND ${SWIG_EXECUTABLE} -version | ||
13 | +diff -ru cmake-2.8.12.1-orig/Modules/Platform/Darwin.cmake cmake-2.8.12.1/Modules/Platform/Darwin.cmake | ||
14 | +--- cmake-2.8.12.1-orig/Modules/Platform/Darwin.cmake 2013-11-05 20:07:22.000000000 +0100 | ||
15 | ++++ cmake-2.8.12.1/Modules/Platform/Darwin.cmake 2013-12-25 11:16:54.998070493 +0100 | ||
16 | +@@ -341,7 +341,9 @@ | ||
17 | + list(APPEND _apps_paths "${_apps}") | ||
18 | + endif() | ||
19 | + endforeach() | ||
20 | +-list(REMOVE_DUPLICATES _apps_paths) | ||
21 | ++if(_apps_paths) | ||
22 | ++ list(REMOVE_DUPLICATES _apps_paths) | ||
23 | ++endif() | ||
24 | + set(CMAKE_SYSTEM_APPBUNDLE_PATH | ||
25 | + ${_apps_paths}) | ||
26 | + unset(_apps_paths) |
jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/InterpsVector.java
0 → 100644
1 | +/* ---------------------------------------------------------------------------- | ||
2 | + * This file was automatically generated by SWIG (http://www.swig.org). | ||
3 | + * Version 2.0.4 | ||
4 | + * | ||
5 | + * Do not make changes to this file unless you know what you are doing--modify | ||
6 | + * the SWIG interface file instead. | ||
7 | + * ----------------------------------------------------------------------------- */ | ||
8 | + | ||
9 | +package pl.waw.ipipan.morfeusz; | ||
10 | + | ||
11 | +public class InterpsVector { | ||
12 | + private long swigCPtr; | ||
13 | + protected boolean swigCMemOwn; | ||
14 | + | ||
15 | + public InterpsVector(long cPtr, boolean cMemoryOwn) { | ||
16 | + swigCMemOwn = cMemoryOwn; | ||
17 | + swigCPtr = cPtr; | ||
18 | + } | ||
19 | + | ||
20 | + public static long getCPtr(InterpsVector obj) { | ||
21 | + return (obj == null) ? 0 : obj.swigCPtr; | ||
22 | + } | ||
23 | + | ||
24 | + protected void finalize() { | ||
25 | + delete(); | ||
26 | + } | ||
27 | + | ||
28 | + public synchronized void delete() { | ||
29 | + if (swigCPtr != 0) { | ||
30 | + if (swigCMemOwn) { | ||
31 | + swigCMemOwn = false; | ||
32 | + MorfeuszWrapperJNI.delete_InterpsVector(swigCPtr); | ||
33 | + } | ||
34 | + swigCPtr = 0; | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | + public InterpsVector() { | ||
39 | + this(MorfeuszWrapperJNI.new_InterpsVector(), true); | ||
40 | + } | ||
41 | + | ||
42 | + public long size() { | ||
43 | + return MorfeuszWrapperJNI.InterpsVector_size(swigCPtr, this); | ||
44 | + } | ||
45 | + | ||
46 | + public long capacity() { | ||
47 | + return MorfeuszWrapperJNI.InterpsVector_capacity(swigCPtr, this); | ||
48 | + } | ||
49 | + | ||
50 | + public void reserve(long n) { | ||
51 | + MorfeuszWrapperJNI.InterpsVector_reserve(swigCPtr, this, n); | ||
52 | + } | ||
53 | + | ||
54 | + public boolean isEmpty() { | ||
55 | + return MorfeuszWrapperJNI.InterpsVector_isEmpty(swigCPtr, this); | ||
56 | + } | ||
57 | + | ||
58 | + public void clear() { | ||
59 | + MorfeuszWrapperJNI.InterpsVector_clear(swigCPtr, this); | ||
60 | + } | ||
61 | + | ||
62 | + public void add(MorphInterpretation x) { | ||
63 | + MorfeuszWrapperJNI.InterpsVector_add(swigCPtr, this, MorphInterpretation.getCPtr(x), x); | ||
64 | + } | ||
65 | + | ||
66 | + public MorphInterpretation get(int i) { | ||
67 | + return new MorphInterpretation(MorfeuszWrapperJNI.InterpsVector_get(swigCPtr, this, i), false); | ||
68 | + } | ||
69 | + | ||
70 | + public void set(int i, MorphInterpretation val) { | ||
71 | + MorfeuszWrapperJNI.InterpsVector_set(swigCPtr, this, i, MorphInterpretation.getCPtr(val), val); | ||
72 | + } | ||
73 | + | ||
74 | +} |
jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/Morfeusz.java
0 → 100644
1 | +/* ---------------------------------------------------------------------------- | ||
2 | + * This file was automatically generated by SWIG (http://www.swig.org). | ||
3 | + * Version 2.0.4 | ||
4 | + * | ||
5 | + * Do not make changes to this file unless you know what you are doing--modify | ||
6 | + * the SWIG interface file instead. | ||
7 | + * ----------------------------------------------------------------------------- */ | ||
8 | + | ||
9 | +package pl.waw.ipipan.morfeusz; | ||
10 | + | ||
11 | +public class Morfeusz { | ||
12 | + private long swigCPtr; | ||
13 | + protected boolean swigCMemOwn; | ||
14 | + | ||
15 | + public Morfeusz(long cPtr, boolean cMemoryOwn) { | ||
16 | + swigCMemOwn = cMemoryOwn; | ||
17 | + swigCPtr = cPtr; | ||
18 | + } | ||
19 | + | ||
20 | + public static long getCPtr(Morfeusz obj) { | ||
21 | + return (obj == null) ? 0 : obj.swigCPtr; | ||
22 | + } | ||
23 | + | ||
24 | + protected void finalize() { | ||
25 | + delete(); | ||
26 | + } | ||
27 | + | ||
28 | + public synchronized void delete() { | ||
29 | + if (swigCPtr != 0) { | ||
30 | + if (swigCMemOwn) { | ||
31 | + swigCMemOwn = false; | ||
32 | + MorfeuszWrapperJNI.delete_Morfeusz(swigCPtr); | ||
33 | + } | ||
34 | + swigCPtr = 0; | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | + public Morfeusz() { | ||
39 | + this(MorfeuszWrapperJNI.new_Morfeusz__SWIG_0(), true); | ||
40 | + } | ||
41 | + | ||
42 | + public Morfeusz(String filename) { | ||
43 | + this(MorfeuszWrapperJNI.new_Morfeusz__SWIG_1(filename), true); | ||
44 | + } | ||
45 | + | ||
46 | + public ResultsIterator analyze(String text) { | ||
47 | + return new ResultsIterator(MorfeuszWrapperJNI.Morfeusz_analyze__SWIG_0(swigCPtr, this, text), true); | ||
48 | + } | ||
49 | + | ||
50 | + public void analyze(String text, InterpsVector result) { | ||
51 | + MorfeuszWrapperJNI.Morfeusz_analyze__SWIG_1(swigCPtr, this, text, InterpsVector.getCPtr(result), result); | ||
52 | + } | ||
53 | + | ||
54 | + public void setEncoding(MorfeuszCharset encoding) { | ||
55 | + MorfeuszWrapperJNI.Morfeusz_setEncoding(swigCPtr, this, encoding.swigValue()); | ||
56 | + } | ||
57 | + | ||
58 | +} |
jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszCharset.java
0 → 100644
1 | +/* ---------------------------------------------------------------------------- | ||
2 | + * This file was automatically generated by SWIG (http://www.swig.org). | ||
3 | + * Version 2.0.4 | ||
4 | + * | ||
5 | + * Do not make changes to this file unless you know what you are doing--modify | ||
6 | + * the SWIG interface file instead. | ||
7 | + * ----------------------------------------------------------------------------- */ | ||
8 | + | ||
9 | +package pl.waw.ipipan.morfeusz; | ||
10 | + | ||
11 | +public enum MorfeuszCharset { | ||
12 | + UTF8, | ||
13 | + ISO8859_2, | ||
14 | + CP1250, | ||
15 | + CP852; | ||
16 | + | ||
17 | + public final int swigValue() { | ||
18 | + return swigValue; | ||
19 | + } | ||
20 | + | ||
21 | + public static MorfeuszCharset swigToEnum(int swigValue) { | ||
22 | + MorfeuszCharset[] swigValues = MorfeuszCharset.class.getEnumConstants(); | ||
23 | + if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) | ||
24 | + return swigValues[swigValue]; | ||
25 | + for (MorfeuszCharset swigEnum : swigValues) | ||
26 | + if (swigEnum.swigValue == swigValue) | ||
27 | + return swigEnum; | ||
28 | + throw new IllegalArgumentException("No enum " + MorfeuszCharset.class + " with value " + swigValue); | ||
29 | + } | ||
30 | + | ||
31 | + @SuppressWarnings("unused") | ||
32 | + private MorfeuszCharset() { | ||
33 | + this.swigValue = SwigNext.next++; | ||
34 | + } | ||
35 | + | ||
36 | + @SuppressWarnings("unused") | ||
37 | + private MorfeuszCharset(int swigValue) { | ||
38 | + this.swigValue = swigValue; | ||
39 | + SwigNext.next = swigValue+1; | ||
40 | + } | ||
41 | + | ||
42 | + @SuppressWarnings("unused") | ||
43 | + private MorfeuszCharset(MorfeuszCharset swigEnum) { | ||
44 | + this.swigValue = swigEnum.swigValue; | ||
45 | + SwigNext.next = this.swigValue+1; | ||
46 | + } | ||
47 | + | ||
48 | + private final int swigValue; | ||
49 | + | ||
50 | + private static class SwigNext { | ||
51 | + private static int next = 0; | ||
52 | + } | ||
53 | +} | ||
54 | + |
jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszException.java
0 → 100644
1 | +/* ---------------------------------------------------------------------------- | ||
2 | + * This file was automatically generated by SWIG (http://www.swig.org). | ||
3 | + * Version 2.0.4 | ||
4 | + * | ||
5 | + * Do not make changes to this file unless you know what you are doing--modify | ||
6 | + * the SWIG interface file instead. | ||
7 | + * ----------------------------------------------------------------------------- */ | ||
8 | + | ||
9 | +package pl.waw.ipipan.morfeusz; | ||
10 | + | ||
11 | +public class MorfeuszException { | ||
12 | + private long swigCPtr; | ||
13 | + protected boolean swigCMemOwn; | ||
14 | + | ||
15 | + public MorfeuszException(long cPtr, boolean cMemoryOwn) { | ||
16 | + swigCMemOwn = cMemoryOwn; | ||
17 | + swigCPtr = cPtr; | ||
18 | + } | ||
19 | + | ||
20 | + public static long getCPtr(MorfeuszException obj) { | ||
21 | + return (obj == null) ? 0 : obj.swigCPtr; | ||
22 | + } | ||
23 | + | ||
24 | + protected void finalize() { | ||
25 | + delete(); | ||
26 | + } | ||
27 | + | ||
28 | + public synchronized void delete() { | ||
29 | + if (swigCPtr != 0) { | ||
30 | + if (swigCMemOwn) { | ||
31 | + swigCMemOwn = false; | ||
32 | + MorfeuszWrapperJNI.delete_MorfeuszException(swigCPtr); | ||
33 | + } | ||
34 | + swigCPtr = 0; | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | + public MorfeuszException(String what) { | ||
39 | + this(MorfeuszWrapperJNI.new_MorfeuszException(what), true); | ||
40 | + } | ||
41 | + | ||
42 | + public String what() { | ||
43 | + return MorfeuszWrapperJNI.MorfeuszException_what(swigCPtr, this); | ||
44 | + } | ||
45 | + | ||
46 | +} |
jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszWrapper.java
0 → 100644
1 | +/* ---------------------------------------------------------------------------- | ||
2 | + * This file was automatically generated by SWIG (http://www.swig.org). | ||
3 | + * Version 2.0.4 | ||
4 | + * | ||
5 | + * Do not make changes to this file unless you know what you are doing--modify | ||
6 | + * the SWIG interface file instead. | ||
7 | + * ----------------------------------------------------------------------------- */ | ||
8 | + | ||
9 | +package pl.waw.ipipan.morfeusz; | ||
10 | + | ||
11 | +public class MorfeuszWrapper { | ||
12 | + public static MorfeuszCharset getDEFAULT_MORFEUSZ_CHARSET() { | ||
13 | + return MorfeuszCharset.swigToEnum(MorfeuszWrapperJNI.DEFAULT_MORFEUSZ_CHARSET_get()); | ||
14 | + } | ||
15 | + | ||
16 | +} |
jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorfeuszWrapperJNI.java
0 → 100644
1 | +/* ---------------------------------------------------------------------------- | ||
2 | + * This file was automatically generated by SWIG (http://www.swig.org). | ||
3 | + * Version 2.0.4 | ||
4 | + * | ||
5 | + * Do not make changes to this file unless you know what you are doing--modify | ||
6 | + * the SWIG interface file instead. | ||
7 | + * ----------------------------------------------------------------------------- */ | ||
8 | + | ||
9 | +package pl.waw.ipipan.morfeusz; | ||
10 | + | ||
11 | +public class MorfeuszWrapperJNI { | ||
12 | + | ||
13 | + static { | ||
14 | + System.loadLibrary("jmorfeusz"); | ||
15 | + } | ||
16 | + | ||
17 | + public final static native long new_MorfeuszException(String jarg1); | ||
18 | + public final static native void delete_MorfeuszException(long jarg1); | ||
19 | + public final static native String MorfeuszException_what(long jarg1, MorfeuszException jarg1_); | ||
20 | + public final static native long new_Morfeusz__SWIG_0(); | ||
21 | + public final static native long new_Morfeusz__SWIG_1(String jarg1); | ||
22 | + public final static native void delete_Morfeusz(long jarg1); | ||
23 | + public final static native long Morfeusz_analyze__SWIG_0(long jarg1, Morfeusz jarg1_, String jarg2); | ||
24 | + public final static native void Morfeusz_analyze__SWIG_1(long jarg1, Morfeusz jarg1_, String jarg2, long jarg3, InterpsVector jarg3_); | ||
25 | + public final static native void Morfeusz_setEncoding(long jarg1, Morfeusz jarg1_, int jarg2); | ||
26 | + public final static native long ResultsIterator_getNext(long jarg1, ResultsIterator jarg1_); | ||
27 | + public final static native boolean ResultsIterator_hasNext(long jarg1, ResultsIterator jarg1_); | ||
28 | + public final static native void delete_ResultsIterator(long jarg1); | ||
29 | + public final static native int MorphInterpretation_getStartNode(long jarg1, MorphInterpretation jarg1_); | ||
30 | + public final static native int MorphInterpretation_getEndNode(long jarg1, MorphInterpretation jarg1_); | ||
31 | + public final static native String MorphInterpretation_getOrth(long jarg1, MorphInterpretation jarg1_); | ||
32 | + public final static native String MorphInterpretation_getLemma(long jarg1, MorphInterpretation jarg1_); | ||
33 | + public final static native int MorphInterpretation_getTagnum(long jarg1, MorphInterpretation jarg1_); | ||
34 | + public final static native int MorphInterpretation_getNamenum(long jarg1, MorphInterpretation jarg1_); | ||
35 | + public final static native String MorphInterpretation_getTag(long jarg1, MorphInterpretation jarg1_); | ||
36 | + public final static native String MorphInterpretation_getName(long jarg1, MorphInterpretation jarg1_); | ||
37 | + public final static native void delete_MorphInterpretation(long jarg1); | ||
38 | + public final static native int DEFAULT_MORFEUSZ_CHARSET_get(); | ||
39 | + public final static native long new_InterpsVector(); | ||
40 | + public final static native long InterpsVector_size(long jarg1, InterpsVector jarg1_); | ||
41 | + public final static native long InterpsVector_capacity(long jarg1, InterpsVector jarg1_); | ||
42 | + public final static native void InterpsVector_reserve(long jarg1, InterpsVector jarg1_, long jarg2); | ||
43 | + public final static native boolean InterpsVector_isEmpty(long jarg1, InterpsVector jarg1_); | ||
44 | + public final static native void InterpsVector_clear(long jarg1, InterpsVector jarg1_); | ||
45 | + public final static native void InterpsVector_add(long jarg1, InterpsVector jarg1_, long jarg2, MorphInterpretation jarg2_); | ||
46 | + public final static native long InterpsVector_get(long jarg1, InterpsVector jarg1_, int jarg2); | ||
47 | + public final static native void InterpsVector_set(long jarg1, InterpsVector jarg1_, int jarg2, long jarg3, MorphInterpretation jarg3_); | ||
48 | + public final static native void delete_InterpsVector(long jarg1); | ||
49 | +} |
jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/MorphInterpretation.java
0 → 100644
1 | +/* ---------------------------------------------------------------------------- | ||
2 | + * This file was automatically generated by SWIG (http://www.swig.org). | ||
3 | + * Version 2.0.4 | ||
4 | + * | ||
5 | + * Do not make changes to this file unless you know what you are doing--modify | ||
6 | + * the SWIG interface file instead. | ||
7 | + * ----------------------------------------------------------------------------- */ | ||
8 | + | ||
9 | +package pl.waw.ipipan.morfeusz; | ||
10 | + | ||
11 | +public class MorphInterpretation { | ||
12 | + private long swigCPtr; | ||
13 | + protected boolean swigCMemOwn; | ||
14 | + | ||
15 | + public MorphInterpretation(long cPtr, boolean cMemoryOwn) { | ||
16 | + swigCMemOwn = cMemoryOwn; | ||
17 | + swigCPtr = cPtr; | ||
18 | + } | ||
19 | + | ||
20 | + public static long getCPtr(MorphInterpretation obj) { | ||
21 | + return (obj == null) ? 0 : obj.swigCPtr; | ||
22 | + } | ||
23 | + | ||
24 | + protected void finalize() { | ||
25 | + delete(); | ||
26 | + } | ||
27 | + | ||
28 | + public synchronized void delete() { | ||
29 | + if (swigCPtr != 0) { | ||
30 | + if (swigCMemOwn) { | ||
31 | + swigCMemOwn = false; | ||
32 | + MorfeuszWrapperJNI.delete_MorphInterpretation(swigCPtr); | ||
33 | + } | ||
34 | + swigCPtr = 0; | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | + public int getStartNode() { | ||
39 | + return MorfeuszWrapperJNI.MorphInterpretation_getStartNode(swigCPtr, this); | ||
40 | + } | ||
41 | + | ||
42 | + public int getEndNode() { | ||
43 | + return MorfeuszWrapperJNI.MorphInterpretation_getEndNode(swigCPtr, this); | ||
44 | + } | ||
45 | + | ||
46 | + public String getOrth() { | ||
47 | + return MorfeuszWrapperJNI.MorphInterpretation_getOrth(swigCPtr, this); | ||
48 | + } | ||
49 | + | ||
50 | + public String getLemma() { | ||
51 | + return MorfeuszWrapperJNI.MorphInterpretation_getLemma(swigCPtr, this); | ||
52 | + } | ||
53 | + | ||
54 | + public int getTagnum() { | ||
55 | + return MorfeuszWrapperJNI.MorphInterpretation_getTagnum(swigCPtr, this); | ||
56 | + } | ||
57 | + | ||
58 | + public int getNamenum() { | ||
59 | + return MorfeuszWrapperJNI.MorphInterpretation_getNamenum(swigCPtr, this); | ||
60 | + } | ||
61 | + | ||
62 | + public String getTag() { | ||
63 | + return MorfeuszWrapperJNI.MorphInterpretation_getTag(swigCPtr, this); | ||
64 | + } | ||
65 | + | ||
66 | + public String getName() { | ||
67 | + return MorfeuszWrapperJNI.MorphInterpretation_getName(swigCPtr, this); | ||
68 | + } | ||
69 | + | ||
70 | +} |
jmorfeusz/src/main/java/pl/waw/ipipan/morfeusz/ResultsIterator.java
0 → 100644
1 | +/* ---------------------------------------------------------------------------- | ||
2 | + * This file was automatically generated by SWIG (http://www.swig.org). | ||
3 | + * Version 2.0.4 | ||
4 | + * | ||
5 | + * Do not make changes to this file unless you know what you are doing--modify | ||
6 | + * the SWIG interface file instead. | ||
7 | + * ----------------------------------------------------------------------------- */ | ||
8 | + | ||
9 | +package pl.waw.ipipan.morfeusz; | ||
10 | + | ||
11 | +public class ResultsIterator { | ||
12 | + private long swigCPtr; | ||
13 | + protected boolean swigCMemOwn; | ||
14 | + | ||
15 | + public ResultsIterator(long cPtr, boolean cMemoryOwn) { | ||
16 | + swigCMemOwn = cMemoryOwn; | ||
17 | + swigCPtr = cPtr; | ||
18 | + } | ||
19 | + | ||
20 | + public static long getCPtr(ResultsIterator obj) { | ||
21 | + return (obj == null) ? 0 : obj.swigCPtr; | ||
22 | + } | ||
23 | + | ||
24 | + protected void finalize() { | ||
25 | + delete(); | ||
26 | + } | ||
27 | + | ||
28 | + public synchronized void delete() { | ||
29 | + if (swigCPtr != 0) { | ||
30 | + if (swigCMemOwn) { | ||
31 | + swigCMemOwn = false; | ||
32 | + MorfeuszWrapperJNI.delete_ResultsIterator(swigCPtr); | ||
33 | + } | ||
34 | + swigCPtr = 0; | ||
35 | + } | ||
36 | + } | ||
37 | + | ||
38 | + public MorphInterpretation getNext() { | ||
39 | + return new MorphInterpretation(MorfeuszWrapperJNI.ResultsIterator_getNext(swigCPtr, this), true); | ||
40 | + } | ||
41 | + | ||
42 | + public boolean hasNext() { | ||
43 | + return MorfeuszWrapperJNI.ResultsIterator_hasNext(swigCPtr, this); | ||
44 | + } | ||
45 | + | ||
46 | +} |
jmorfeusz/src/main/native/libjmorfeusz.dll
0 → 100755
No preview for this file type
jmorfeusz/src/main/native/libjmorfeusz.jnilib
0 → 100755
No preview for this file type
jmorfeusz/src/main/native/libjmorfeusz.so
No preview for this file type
jmorfeusz/src/main/native/libmorfeusz.so
No preview for this file type
morfeusz/Toolchain-darwin32.cmake
1 | 1 | ||
2 | SET(CMAKE_SYSTEM_NAME Darwin) | 2 | SET(CMAKE_SYSTEM_NAME Darwin) |
3 | -SET(CMAKE_SYSTEM_VERSION 1) | ||
4 | -SET(CMAKE_C_COMPILER /home/mlenart/usr/i686-apple-darwin11/bin/i686-apple-darwin11-gcc-4.6) | ||
5 | -SET(CMAKE_CXX_COMPILER /home/mlenart/usr/i686-apple-darwin11/bin/i686-apple-darwin11-g++-4.6) | ||
6 | -#SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) | 3 | +SET(CMAKE_SYSTEM_VERSION 9) |
4 | +SET(CMAKE_C_COMPILER /mnt/storage/usr/i686-apple-darwin9/i686-apple-darwin9-gcc) | ||
5 | +SET(CMAKE_CXX_COMPILER /mnt/storage/usr/i686-apple-darwin9/i686-apple-darwin9-g++) | ||
7 | 6 | ||
8 | # here is the target environment located | 7 | # here is the target environment located |
9 | -SET(CMAKE_FIND_ROOT_PATH /home/mlenart/usr/i686-apple-darwin11:/home/mlenart/usr/i686-apple-darwin11/lib/gcc/i686-apple-darwin11/4.6.4 ) | 8 | +SET(CMAKE_FIND_ROOT_PATH /mnt/storage/usr/i686-apple-darwin9) |
10 | 9 | ||
11 | # adjust the default behaviour of the FIND_XXX() commands: | 10 | # adjust the default behaviour of the FIND_XXX() commands: |
12 | # search headers and libraries in the target environment, search | 11 | # search headers and libraries in the target environment, search |
13 | # programs in the host environment | 12 | # programs in the host environment |
14 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | 13 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
15 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | 14 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
16 | -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
17 | \ No newline at end of file | 15 | \ No newline at end of file |
16 | +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
morfeusz/Toolchain-darwin64.cmake
0 → 100644
1 | + | ||
2 | +SET(CMAKE_SYSTEM_NAME Darwin) | ||
3 | +set (CMAKE_SYSTEM_VERSION 1) | ||
4 | +set (CMAKE_C_COMPILER /usr/x86_64-apple-darwin9/bin/x86_64-apple-darwin9-gcc) | ||
5 | +set (CMAKE_CXX_COMPILER /usr/x86_64-apple-darwin9/bin/x86_64-apple-darwin9-g++) | ||
6 | + | ||
7 | +# here is the target environment located | ||
8 | +set (CMAKE_FIND_ROOT_PATH /usr/x86_64-apple-darwin9 /mnt/storage/JavaVM.framework) | ||
9 | + | ||
10 | +# adjust the default behaviour of the FIND_XXX() commands: | ||
11 | +# search headers and libraries in the target environment, search | ||
12 | +# programs in the host environment | ||
13 | +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | ||
14 | +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | ||
15 | +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
16 | + | ||
17 | +set (JAVA_JVM_LIBRARY /mnt/storage/JavaVM.framework) | ||
18 | +set (JAVA_AWT_LIBRARY /mnt/storage/JavaVM.framework) | ||
19 | +set (JAVA_INCLUDE_PATH /mnt/storage/JavaVM.framework/Headers) |
morfeusz/Toolchain-win64.cmake
@@ -6,11 +6,11 @@ SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) | @@ -6,11 +6,11 @@ SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) | ||
6 | SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) | 6 | SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) |
7 | 7 | ||
8 | # here is the target environment located | 8 | # here is the target environment located |
9 | -SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 ) | 9 | +SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 /home/lennyn/opt/windupa/Java/jdk1.7.0_45 /opt/windupa/Java/jre7 /home/lennyn/opt/windupa/Python27 /home/lennyn/opt/swig) |
10 | 10 | ||
11 | # adjust the default behaviour of the FIND_XXX() commands: | 11 | # adjust the default behaviour of the FIND_XXX() commands: |
12 | # search headers and libraries in the target environment, search | 12 | # search headers and libraries in the target environment, search |
13 | # programs in the host environment | 13 | # programs in the host environment |
14 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) | 14 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
15 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) | 15 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
16 | -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) | ||
17 | \ No newline at end of file | 16 | \ No newline at end of file |
17 | +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
morfeusz/charset/CaseConverter.cpp
@@ -25,12 +25,14 @@ CaseConverter::CaseConverter() | @@ -25,12 +25,14 @@ CaseConverter::CaseConverter() | ||
25 | extToTitlecaseMap(initializeExtCaseMap(EXT_TO_TITLECASE_TABLE, EXT_TO_TITLECASE_TABLE_SIZE)) { | 25 | extToTitlecaseMap(initializeExtCaseMap(EXT_TO_TITLECASE_TABLE, EXT_TO_TITLECASE_TABLE_SIZE)) { |
26 | } | 26 | } |
27 | 27 | ||
28 | -static uint32_t getFromTables(const uint32_t* table, unsigned int tableSize, const map<uint32_t, uint32_t>& extMap, uint32_t codepoint) { | 28 | +static uint32_t getFromTables(const uint32_t* table, unsigned int tableSize, const map<uint32_t, uint32_t>& extMap, const uint32_t codepoint) { |
29 | if (codepoint < tableSize) { | 29 | if (codepoint < tableSize) { |
30 | return table[codepoint]; | 30 | return table[codepoint]; |
31 | } | 31 | } |
32 | else if (extMap.count(codepoint) != 0) { | 32 | else if (extMap.count(codepoint) != 0) { |
33 | - return extMap.at(codepoint); | 33 | + map<uint32_t, uint32_t>::const_iterator it; |
34 | + it = extMap.find(codepoint); | ||
35 | + return it->second; | ||
34 | } | 36 | } |
35 | else { | 37 | else { |
36 | return codepoint; | 38 | return codepoint; |
morfeusz/java/CMakeLists.txt
@@ -20,4 +20,4 @@ SWIG_LINK_LIBRARIES(jmorfeusz libmorfeusz) | @@ -20,4 +20,4 @@ SWIG_LINK_LIBRARIES(jmorfeusz libmorfeusz) | ||
20 | 20 | ||
21 | set (CMAKE_SHARED_LINKER_FLAGS "") | 21 | set (CMAKE_SHARED_LINKER_FLAGS "") |
22 | set (CMAKE_EXE_LINKER_FLAGS "") | 22 | set (CMAKE_EXE_LINKER_FLAGS "") |
23 | -set (CMAKE_CXX_FLAGS "-std=c++0x") | 23 | +set (CMAKE_CXX_FLAGS "-O2") |
morfeusz/python/CMakeLists.txt
@@ -17,6 +17,10 @@ SWIG_ADD_MODULE(morfeusz python ../morfeusz.i) | @@ -17,6 +17,10 @@ SWIG_ADD_MODULE(morfeusz python ../morfeusz.i) | ||
17 | SWIG_LINK_LIBRARIES(morfeusz ${PYTHON_LIBRARIES}) | 17 | SWIG_LINK_LIBRARIES(morfeusz ${PYTHON_LIBRARIES}) |
18 | SWIG_LINK_LIBRARIES(morfeusz libmorfeusz) | 18 | SWIG_LINK_LIBRARIES(morfeusz libmorfeusz) |
19 | 19 | ||
20 | -set (CMAKE_SHARED_LINKER_FLAGS "") | ||
21 | -set (CMAKE_EXE_LINKER_FLAGS "") | ||
22 | -set (CMAKE_CXX_FLAGS "-std=c++0x") | 20 | +#set (CMAKE_SHARED_LINKER_FLAGS "") |
21 | +#set (CMAKE_EXE_LINKER_FLAGS "") | ||
22 | +if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") | ||
23 | + set (CMAKE_CXX_FLAGS "-D MS_WIN64 -O2") | ||
24 | +else () | ||
25 | + set (CMAKE_CXX_FLAGS "-O2") | ||
26 | +endif () | ||
23 | \ No newline at end of file | 27 | \ No newline at end of file |
nbproject/configurations.xml
@@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
22 | <in>MorphDeserializer.cpp</in> | 22 | <in>MorphDeserializer.cpp</in> |
23 | <in>MorphInterpretation.cpp</in> | 23 | <in>MorphInterpretation.cpp</in> |
24 | <in>Tagset.cpp</in> | 24 | <in>Tagset.cpp</in> |
25 | + <in>Toolchain-darwin64.cmake</in> | ||
25 | <in>const.cpp</in> | 26 | <in>const.cpp</in> |
26 | <in>main.cpp</in> | 27 | <in>main.cpp</in> |
27 | <in>test_recognize_dict.cpp</in> | 28 | <in>test_recognize_dict.cpp</in> |
@@ -245,6 +246,8 @@ | @@ -245,6 +246,8 @@ | ||
245 | </undefinedList> | 246 | </undefinedList> |
246 | </ccTool> | 247 | </ccTool> |
247 | </item> | 248 | </item> |
249 | + <item path="morfeusz/Toolchain-darwin64.cmake" ex="false" tool="3" flavor2="0"> | ||
250 | + </item> | ||
248 | <item path="morfeusz/charset/CaseConverter.cpp" ex="false" tool="1" flavor2="4"> | 251 | <item path="morfeusz/charset/CaseConverter.cpp" ex="false" tool="1" flavor2="4"> |
249 | <ccTool> | 252 | <ccTool> |
250 | </ccTool> | 253 | </ccTool> |