-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.sh
More file actions
executable file
·79 lines (69 loc) · 2.45 KB
/
server.sh
File metadata and controls
executable file
·79 lines (69 loc) · 2.45 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
export THIS_DIR=$(cd $(dirname $0); pwd)
source ${THIS_DIR}/path.sh
export CUDA_VISIBLE_DEVICES=''
[ ! -d ${THIS_DIR}/logs ] && mkdir -p ${THIS_DIR}/logs
timestamp=`date +"%Y-%m-%d-%H-%M-%S"`
pathtocorenlp="/eecs/research/asr/Shared/ner-toolkit/CoreNLP"
# ${THIS_DIR}/server.py \
# "${THIS_DIR}/model/1st-pass-train-dev" \
# "${THIS_DIR}/model/reuters256-case-insensitive.wordlist" \
# "${THIS_DIR}/model/reuters256-case-sensitive.wordlist" \
# --model2nd "${THIS_DIR}/model/2nd-pass-train-dev"
# |& tee ${THIS_DIR}/logs/${timestamp}
function NextPort {
netstat -atn | perl -0777 -ne \
'@ports = /tcp.*?\:(\d+)\s+/imsg ;
for $port (32768..61000) {
if (!grep(/^$port$/, @ports)) {
print $port;
last
}
}'
}
portused=$(NextPort)
cd ${pathtocorenlp}
java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port ${portused} -timeout 15000 &
corenlp_pid=$!
trap "kill -9 ${corenlp_pid} &> /dev/null" EXIT
if [[ $1 == 'eng' ]]
then
echo English model being generated...
${THIS_DIR}/server.py \
"${THIS_DIR}/model/eng2017v1-0" \
"${THIS_DIR}/model/eng2017v1-0-case-insensitive.wordlist" \
"${THIS_DIR}/model/eng2017v1-0-case-sensitive.wordlist" \
"/eecs/research/asr/Shared/ner-toolkit/CoreNLP" \
${portused} \
--KBP \
--port 20541 \
--gazetteer "${THIS_DIR}/model/gaz.pkl" \
|& tee ${THIS_DIR}/logs/eng-${timestamp}
elif [[ $1 == 'spa' ]]
then
echo Spanish model being generated...
${THIS_DIR}/server.py \
"${THIS_DIR}/model/spa2017v1-0" \
"${THIS_DIR}/model/spa2017v1-0-case-insensitive.wordlist" \
"${THIS_DIR}/model/spa2017v1-0-case-sensitive.wordlist" \
"/eecs/research/asr/Shared/ner-toolkit/CoreNLP" \
${portused} \
--KBP \
--port 20542 \
--gazetteer "${THIS_DIR}/model/gaz.pkl" \
|& tee ${THIS_DIR}/logs/spa-${timestamp}
else
echo Chinese model being generated...
${THIS_DIR}/server.py \
"${THIS_DIR}/model/cmn2017v1-0" \
"${THIS_DIR}/model/cmn2017v1-0-char.wordlist" \
"${THIS_DIR}/model/cmn2017v1-0-word.wordlist" \
"/eecs/research/asr/Shared/ner-toolkit/CoreNLP" \
${portused} \
--KBP \
--port 20543 \
--gazetteer "${THIS_DIR}/model/gaz.pkl" \
--wubi "${THIS_DIR}/model/cmn2017v1-0.wubi" \
|& tee ${THIS_DIR}/logs/cmn-${timestamp}
fi