Skip to content

Instantly share code, notes, and snippets.

@eva0919
Last active December 16, 2015 02:29
Show Gist options
  • Save eva0919/5363086 to your computer and use it in GitHub Desktop.
Save eva0919/5363086 to your computer and use it in GitHub Desktop.
$ chmod +x execute.sh 
$ ./execute.sh -r -i tmp2/queries/query-5.xml -o ans -m tmp2/model-files -d tmp2/CIRB010
tar -zxvf text-processing-toolkit.tar.gz
cd src
make
cd ..
mkdir tmp
chmod +rwx tmp
#當做command line 操作
FEEDBACK=false
while getopts ri:o:m:d: option
do
case "${option}" in
r) FEEDBACK=true;;
i) INPUT=${OPTARG};;
o) OUTPUT=${OPTARG};;
m) MODEL=${OPTARG};;
d) NTCIR=${OPTARG};;
esac
done
if $FEEDBACK
then
#echo "yo"
ruby k1-2b0-75.rb -r-i $INPUT -o $OUTPUT -m $MODEL -d $NTCIR
else
#echo "hi"
ruby k1-2b0-75.rb -i $INPUT -o $OUTPUT -m $MODEL -d $NTCIR
fi
#Bash shell 有吃空格 所以 不能亂空格
#特殊的require 可以輕鬆使用參數
### read argument
require 'optparse'
$options = {}
OptionParser.new do |opts|
opts.on("-r") { |s| $options[:r] = true }
opts.on("-i", '-i INPUT', "input ") { |s| $options[:i] = s } # ./queries/origin/query-5.xml
opts.on("-o", '-o OUTPUT',"output") { |s| $options[:o] = s } # ans
opts.on("-m", '-m MODEL', "model ") { |s| $options[:m] = s } # ./model-files
opts.on("-d", '-d NTCIR', "ntcir ") { |s| $options[:d] = s } # /tmp2/CIRB010
end.parse!
$dir_queryfile = File.dirname($options[:i])
puts $options
### end read argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment