-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclassif
executable file
·71 lines (50 loc) · 1.89 KB
/
classif
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
#!/bin/bash
#shopt -s extglob
###################################################################
# Lexicon-based detection of depression language
# - - variable DEPR_DIR sets the PATH for the main folder.
# - - The system contains a tokenizer but it requires Linguakit to be installed. You can dowload Linguakit from:
# https://github.com/citiususc/Linguakit/archive/master.zip
#
# ProLNat Group - CiTIUS - USC
###################################################################
###################################################################
############################
# Config
############################
DEPR_DIR="../depression_classification"
PROGS=$DEPR_DIR"/scripts"
LEX=$DEPR_DIR"/lexicons"
LING="en"
############################
# Functions
############################
help()
{
echo "Syntax: cat input_file |./classif <module> [PoS_tags]
module= tok or tag | you can just use a tokenizer (tok) or a PoS tagger (tag)
PoS_tags= N, V, J | if you use module tag, it is possible to classify using a specific tag: noun (N), verb (V), adj (J), or a combination of them: e.g. NJ, VNJ, JV, ... (by default: NVJ).
example of use:
echo "I hate my life" |./classif tag VJ
"
exit
}
# Parámetros obrigatorios
[ $# -lt 1 ] && help
MODULE=$1
# Parámetros opcionais
TAG="NVJ" #by default
[ "$2" != "" ] && TAG=$2
SENT=$PROGS"/sentences_exe.perl";
TOK=$PROGS"/tokens_exe.perl";
if [ "$MODULE" == "" ] ; then
help;
echo "help" ;
fi
if [ "$MODULE" == "tok" ] ; then
tr -d '\015' | $SENT | $TOK | $PROGS/select_lex.perl $LEX/lexicon.txt | $PROGS/baseline_types.perl
fi
if [ "$MODULE" == "tag" ] && [ "$TAG" != "" ] ; then
cat $LEX/lexicon_lem.txt |grep -P "[$TAG]" > $LEX/temp.txt
tr -d '\015' | $DEPR_DIR/Linguakit-master/linguakit tagger $LING | $PROGS/select_lex_tagged.perl $LEX/temp.txt $TAG | $PROGS/baseline_tagged.perl $TAG
fi