-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-ik.sh
executable file
·38 lines (29 loc) · 1.08 KB
/
init-ik.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# 复制繁体词典
docker cp dict/big_chinese.dic ibbd-elasticsearch:/usr/share/elasticsearch/plugins/ik/config/ik/custom/
# stop words
docker cp dict/stopwords.dic ibbd-elasticsearch:/usr/share/elasticsearch/plugins/ik/config/ik/custom/ext_stopword.dic
# 量词
docker cp dict/quantifier.dic ibbd-elasticsearch:/usr/share/elasticsearch/plugins/ik/config/ik/quantifier.dic
if [ ! -d tmp ]; then
mkdir tmp
fi
# 修改IK配置
cnf_file=IKAnalyzer.cfg.xml
docker cp ibbd-elasticsearch:/usr/share/elasticsearch/plugins/ik/config/ik/$cnf_file tmp/
# cp 繁体中文词库
if grep big_chinese.dic tmp/$cnf_file;
then
echo 'big_chinese.dic in '$cnf_file
else
sed -i 's/<entry key="ext_dict">/<entry key="ext_dict">custom\/big_chinese.dic;/' tmp/$cnf_file
fi
# 量词
if grep quantifier.dic tmp/$cnf_file;
then
echo 'quantifier.dic in '$cnf_file
else
sed -i 's/<entry key="ext_stopwords">/<entry key="ext_stopwords">quantifier.dic;/' tmp/$cnf_file
fi
docker cp tmp/$cnf_file ibbd-elasticsearch:/usr/share/elasticsearch/plugins/ik/config/ik/$cnf_file
echo '===> Over!!'