diff --git a/.gitignore b/.gitignore index 4fc36f4e..8c385f7e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ .settings .DS_Store /analysis/token_filters/cld2/cld2-read-only +/analysis/token_filters/cld2/libcld2_full.a /examples/bleve_index_json/bleve_index_json /examples/bleve_index_json/index.bleve/ /examples/bleve_query/bleve_query diff --git a/analysis/token_filters/cld2/README.md b/analysis/token_filters/cld2/README.md index 3533448c..64d71710 100644 --- a/analysis/token_filters/cld2/README.md +++ b/analysis/token_filters/cld2/README.md @@ -8,21 +8,24 @@ In normal usage, you use this with the "single" tokenizer, so there is only one 1. Acquire the source to cld2 in this directory. - $ svn checkout http://cld2.googlecode.com/svn/trunk/ cld2-read-only + $ svn checkout -r 167 http://cld2.googlecode.com/svn/trunk/ cld2-read-only -2. Build cld2 +2. Build cld2 - $ cd cld2-read-only/internal/ - $ ./compile_libs.sh + As dynamic library + $ cd cld2-read-only/internal/ + $ ./compile_libs.sh + $ cp *.so /usr/local/lib + $ cd ../.. -3. Put the resulting libraries somewhere your dynamic linker can find. + Or static library - $ cp *.so /usr/local/lib + $ ./compile_cld2.sh + $ cp *.a /usr/local/lib -4. Run the unit tests +3. Run the unit tests - $ cd ../.. $ go test -v === RUN TestCld2Filter --- PASS: TestCld2Filter (0.00 seconds) diff --git a/analysis/token_filters/cld2/compile_cld2.sh b/analysis/token_filters/cld2/compile_cld2.sh new file mode 100755 index 00000000..71840bbe --- /dev/null +++ b/analysis/token_filters/cld2/compile_cld2.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +SRC="cldutil cldutil_shared compact_lang_det compact_lang_det_hint_code compact_lang_det_impl debug fixunicodevalue generated_entities generated_language generated_ulscript getonescriptspan lang_script offsetmap scoreonescriptspan tote utf8statetable cld_generated_cjk_uni_prop_80 cld2_generated_cjk_compatible cld_generated_cjk_delta_bi_32 generated_distinct_bi_0 cld2_generated_quad0122 cld2_generated_deltaocta0122 cld2_generated_distinctocta0122 cld_generated_score_quad_octa_0122"; +OBJ=""; +for f in ${SRC}; do + g++ -c -fPIC -O2 -m64 -o "cld2-read-only/internal/${f}.o" "cld2-read-only/internal/${f}.cc"; + OBJ="${OBJ} cld2-read-only/internal/${f}.o"; +done; + +ar rcs libcld2_full.a ${OBJ};