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
|
# File 'lib/libsvm_preprocessor/cli.rb', line 5
def self.parse(args)
options = {}
options[:mode] = :unigram
options[:lang] = :it
options[:stemming] = false
options[:stopwords] = false
options[:testing] = false
options[:numeric_type] = nil
options[:output] = nil
opt_parser = OptionParser.new do |opts|
opts.banner = "libsvm_pp [options] <filename>"
opts.on("-m [TYPE]", "--mode [TYPE]", [:unigram, :bigram],
"Select unigram (default) or bigram") do |mode|
options[:mode] = mode
end
opts.on("-s", "--stemming", "Use this you want stemming") do |s|
options[:stemming] = s
end
opts.on("-w", "--remove-stopwords",
"Use this if you want remove stopwords") do |w|
options[:stopwords] = w
end
opts.on("-t", "--testing",
"Use this to use testing mode") do |t|
options[:testing] = t
end
opts.on("-l [TYPE]", "--language", [:it, :en],
"Select your language it / en") do |l|
options[:lang] = l
end
opts.on("-n N", Integer, "Numeric type") do |n|
options[:numeric_type] = n
end
opts.on("-o [output]", String, "output file") do |o|
options[:output] = o
end
end
opt_parser.parse!(args)
options
end
|