Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from wangfenjin/jieba
support jieba_query
- Loading branch information
Showing
15 changed files
with
306 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ libsimple.* | |
build/ | ||
*.gch | ||
bin/ | ||
output/ | ||
output/ | ||
output-no-jieba/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# © 2018-2019 Konstantin Gredeskoul, All Rights Reserved. | ||
# MIT License | ||
# | ||
# WARNING: This BASH script is completely optional. You don't need it to build this project. | ||
# | ||
# If you choose to run this script to build the project, run: | ||
# | ||
# $ ./build-and-run | ||
# | ||
# It will clean, build and run the tests. | ||
# | ||
|
||
[[ -z $(which git) ]] && { | ||
echo "You need git installed. Please run 'xcode-select --install' first." | ||
exit 1 | ||
} | ||
|
||
export BashMatic="${HOME}/.bashmatic" | ||
[[ ! -f "${BashMatic}/init.sh" ]] && { | ||
bash -c "$(curl -fsSL https://bashmatic.re1.re); bashmatic-install" | ||
} | ||
source "${BashMatic}/init.sh" | ||
|
||
export ProjectRoot=$(pwd) | ||
export BuildDir="${ProjectRoot}/build/run" | ||
export BashLibRoot="${ProjectRoot}/bin/lib-bash" | ||
export LibBashRepo="https://github.com/kigster/lib-bash" | ||
|
||
simple.header() { | ||
h1.purple "Simple Tokenizer no jieba" | ||
local OIFC=${IFC} | ||
IFS="|" read -r -a gcc_info <<< "$(gcc --version 2>&1 | tr '\n' '|')" | ||
export IFC=${OIFC} | ||
h1 "${bldylw}GCC" "${gcc_info[1]}" "${gcc_info[2]}" "${gcc_info[3]}" "${gcc_info[4]}" | ||
h1 "${bldylw}GIT: ${bldblu}$(git --version)" | ||
h1 "${bldylw}CMAKE: ${bldblu}$(cmake --version | tr '\n' ' ')" | ||
} | ||
|
||
simple.setup() { | ||
hl.subtle "Creating Build Folder..." | ||
run "mkdir -p build/run-no-jieba" | ||
} | ||
|
||
simple.clean() { | ||
hl.subtle "Cleaning output folders..." | ||
run 'rm -rf bin-no-jieba/* include/* lib/* build/*' | ||
} | ||
|
||
simple.build() { | ||
hl.subtle "build..." | ||
run "cd build/run-no-jieba" | ||
find . -name "*.gcda" -print0 | xargs -0 rm | ||
run "cmake -DCODE_COVERAGE=ON -DSIMPLE_WITH_JIEBA=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=${ProjectRoot}/output-no-jieba ../.." | ||
run.set-next show-output-on | ||
run "make -j 12" | ||
run "make install | egrep -v 'gmock|gtest'" | ||
run "cd ${ProjectRoot}" | ||
} | ||
|
||
simple.tests() { | ||
hl.subtle "testing..." | ||
run.set-all show-output-on | ||
run "cd build/run-no-jieba" | ||
run "ctest . -V" | ||
run "cd ${ProjectRoot}" | ||
} | ||
|
||
simple.example() { | ||
[[ ! -f ./output-no-jieba/bin/sqlite3 ]] && { | ||
error "You don't have the cmpiled sqlite3 binary yet". | ||
exit 3 | ||
} | ||
hl.subtle "run example..." | ||
run "cd output-no-jieba/bin/" | ||
run "./sqlite3 < ${ProjectRoot}/example.sql" | ||
run "./simple_cpp_example" | ||
run "cd ${ProjectRoot}" | ||
|
||
} | ||
|
||
main() { | ||
simple.header | ||
simple.setup | ||
simple.build | ||
simple.tests | ||
simple.example | ||
} | ||
|
||
(( $_s_ )) || main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
select '使用jieba分词:'; | ||
-- will match | ||
select ' ', simple_highlight(t1, 0, '[', ']') from t1 where x match simple_query('国中woai'); | ||
select ' ', simple_highlight(t1, 0, '[', ']') from t1 where x match jieba_query('中国woai'); | ||
select ' ', simple_highlight(t1, 0, '[', ']') from t1 where x match jieba_query('中国woai', 0); | ||
-- will not match, in jieba_query, the order matters | ||
select ' ', simple_highlight(t1, 0, '[', ']') from t1 where x match jieba_query('国中woai'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.