Browse Source

Prep getopt for finale round

master
sipp11 10 years ago
parent
commit
06e4581e2a
  1. 1
      raw/oct/LO_DataFor_Search.csv
  2. 1
      raw/oct/keyword_level.csv
  3. 1
      raw/oct/keyword_weight.csv
  4. 49
      s10.py
  5. 58
      s11.py

1
raw/oct/LO_DataFor_Search.csv

File diff suppressed because one or more lines are too long

1
raw/oct/keyword_level.csv

@ -0,0 +1 @@
K_search,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S A,1,1,2,3,2,0,0,0,0,3,0,0,0,0,0,0,0,0,0 B,1,1,1,2,1,3,3,3,3,2,3,3,3,3,0,0,0,0,0 C,2,1,1,3,2,0,0,0,0,3,0,0,0,0,0,0,0,0,0 D,3,2,3,1,1,1,1,1,1,2,3,3,3,3,0,0,0,0,0 E,2,1,2,1,1,2,2,2,2,1,2,2,2,2,3,3,3,0,0 F,0,3,0,1,2,1,1,2,2,3,0,0,0,0,0,0,0,0,0 G,0,3,0,1,2,1,1,1,1,3,0,0,0,0,0,0,0,0,0 H,0,3,0,1,2,1,1,1,1,3,0,0,0,0,0,0,0,0,0 I,0,3,0,1,2,1,1,1,1,3,0,0,0,0,0,0,0,0,0 J,3,2,3,2,1,3,3,3,3,1,1,1,1,1,2,2,2,0,3 K,0,3,0,3,2,0,0,0,0,1,1,1,2,2,3,3,3,0,0 L,0,3,0,3,2,0,0,0,0,1,1,1,2,2,3,3,3,0,0 M,0,3,0,3,2,0,0,0,0,1,2,2,1,1,1,1,2,0,3 N,0,3,0,3,2,0,0,0,0,1,2,2,1,1,2,2,1,3,2 O,0,0,0,0,3,0,0,0,0,2,3,3,1,2,1,1,3,0,0 P,0,0,0,0,3,0,0,0,0,2,3,3,1,2,1,1,3,0,0 Q,0,0,0,0,3,0,0,0,0,2,3,3,2,1,3,3,1,2,1 R,0,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,2,1,1 S,0,0,0,0,0,0,0,0,0,3,0,0,3,2,0,0,1,1,1
1 K_search A B C D E F G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000,0.0000,0.0000,0.0000 C,0.1111,0.3333,0.6667,0.0741,0.2222,0.0000,0.0000,0.0000,0.0000,0.1481,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000 D,0.0079,0.0159,0.0079,0.2857,0.0476,0.1667,0.1667,0.1667,0.1667,0.0317,0.0079,0.0079,0.0079,0.0079,0.0000,0.0000,0.0000,0.0000,0.0000 E,0.1000,0.2000,0.1000,0.1000,0.4000,0.0250,0.0250,0.0250,0.0250,0.3000,0.0750,0.0750,0.0750,0.0750,0.0375,0.0375,0.0750,0.0000,0.0000 F,0.0000,0.0556,0.0000,0.1667,0.1667,0.4167,0.4167,0.2083,0.2083,0.1111,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000 G,0.0000,0.0667,0.0000,0.2000,0.2000,0.3000,0.3000,0.1000,0.1000,0.1333,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000 H,0.0000,0.0667,0.0000,0.2000,0.2000,0.1000,0.1000,0.3000,0.3000,0.1333,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000 I,0.0000,0.0667,0.0000,0.2000,0.2000,0.1000,0.1000,0.3000,0.3000,0.1333,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000 J,0.0119,0.0238,0.0119,0.0238,0.0476,0.0060,0.0060,0.0060,0.0060,0.2857,0.1667,0.1667,0.1667,0.1667,0.0833,0.0833,0.1667,0.0000,0.1667 K,0.0000,0.0370,0.0000,0.0185,0.0556,0.0000,0.0000,0.0000,0.0000,0.3333,0.5000,0.1667,0.1389,0.1389,0.0694,0.0694,0.1389,0.0000,0.0000 L,0.0000,0.0370,0.0000,0.0185,0.0556,0.0000,0.0000,0.0000,0.0000,0.3333,0.1667,0.5000,0.1389,0.1389,0.2083,0.2083,0.1389,0.0000,0.0000 M,0.0000,0.0196,0.0000,0.0098,0.0294,0.0000,0.0000,0.0000,0.0000,0.1765,0.0735,0.0735,0.2941,0.1176,0.2059,0.2059,0.1176,0.0000,0.1176 N,0.0000,0.0222,0.0000,0.0111,0.0333,0.0000,0.0000,0.0000,0.0000,0.2000,0.0833,0.0833,0.1000,0.4000,0.0500,0.0500,0.3000,0.3000,0.3000 O,0.0000,0.0000,0.0000,0.0000,0.0370,0.0000,0.0000,0.0000,0.0000,0.2222,0.0926,0.0926,0.3333,0.1111,0.5000,0.1667,0.1111,0.0000,0.0000 P,0.0000,0.0000,0.0000,0.0000,0.0370,0.0000,0.0000,0.0000,0.0000,0.2222,0.0926,0.0926,0.3333,0.1111,0.1667,0.5000,0.1111,0.0000,0.0000 Q,0.0000,0.0000,0.0000,0.0000,0.0185,0.0000,0.0000,0.0000,0.0000,0.1111,0.0463,0.0463,0.0556,0.1667,0.0278,0.0278,0.5000,0.3333,0.3333 R,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.3333,0.0000,0.0000,0.3333,0.6667,0.3333 S,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.0000,0.2222,0.0000,0.0000,0.1111,0.3333,0.0000,0.0000,0.3333,0.1667,0.5000
1 K_search A B C D E F G H I J K L M N O P Q R S A 0.6667 0.3333 0.1111 0.0741 0.2222 0.0000 0.0000 0.0000 0.0000 0.1481 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 B 0.1500 0.4000 0.1500 0.1000 0.3000 0.0250 0.0250 0.0250 0.0250 0.2000 0.0500 0.0500 0.0500 0.0500 0.0000 0.0000 0.0000 0.0000 0.0000 C 0.1111 0.3333 0.6667 0.0741 0.2222 0.0000 0.0000 0.0000 0.0000 0.1481 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 D 0.0079 0.0159 0.0079 0.2857 0.0476 0.1667 0.1667 0.1667 0.1667 0.0317 0.0079 0.0079 0.0079 0.0079 0.0000 0.0000 0.0000 0.0000 0.0000 E 0.1000 0.2000 0.1000 0.1000 0.4000 0.0250 0.0250 0.0250 0.0250 0.3000 0.0750 0.0750 0.0750 0.0750 0.0375 0.0375 0.0750 0.0000 0.0000 F 0.0000 0.0556 0.0000 0.1667 0.1667 0.4167 0.4167 0.2083 0.2083 0.1111 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 G 0.0000 0.0667 0.0000 0.2000 0.2000 0.3000 0.3000 0.1000 0.1000 0.1333 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 H 0.0000 0.0667 0.0000 0.2000 0.2000 0.1000 0.1000 0.3000 0.3000 0.1333 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 I 0.0000 0.0667 0.0000 0.2000 0.2000 0.1000 0.1000 0.3000 0.3000 0.1333 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 J 0.0119 0.0238 0.0119 0.0238 0.0476 0.0060 0.0060 0.0060 0.0060 0.2857 0.1667 0.1667 0.1667 0.1667 0.0833 0.0833 0.1667 0.0000 0.1667 K 0.0000 0.0370 0.0000 0.0185 0.0556 0.0000 0.0000 0.0000 0.0000 0.3333 0.5000 0.1667 0.1389 0.1389 0.0694 0.0694 0.1389 0.0000 0.0000 L 0.0000 0.0370 0.0000 0.0185 0.0556 0.0000 0.0000 0.0000 0.0000 0.3333 0.1667 0.5000 0.1389 0.1389 0.2083 0.2083 0.1389 0.0000 0.0000 M 0.0000 0.0196 0.0000 0.0098 0.0294 0.0000 0.0000 0.0000 0.0000 0.1765 0.0735 0.0735 0.2941 0.1176 0.2059 0.2059 0.1176 0.0000 0.1176 N 0.0000 0.0222 0.0000 0.0111 0.0333 0.0000 0.0000 0.0000 0.0000 0.2000 0.0833 0.0833 0.1000 0.4000 0.0500 0.0500 0.3000 0.3000 0.3000 O 0.0000 0.0000 0.0000 0.0000 0.0370 0.0000 0.0000 0.0000 0.0000 0.2222 0.0926 0.0926 0.3333 0.1111 0.5000 0.1667 0.1111 0.0000 0.0000 P 0.0000 0.0000 0.0000 0.0000 0.0370 0.0000 0.0000 0.0000 0.0000 0.2222 0.0926 0.0926 0.3333 0.1111 0.1667 0.5000 0.1111 0.0000 0.0000 Q 0.0000 0.0000 0.0000 0.0000 0.0185 0.0000 0.0000 0.0000 0.0000 0.1111 0.0463 0.0463 0.0556 0.1667 0.0278 0.0278 0.5000 0.3333 0.3333 R 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.3333 0.0000 0.0000 0.3333 0.6667 0.3333 S 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.2222 0.0000 0.0000 0.1111 0.3333 0.0000 0.0000 0.3333 0.1667 0.5000

49
s10.py

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
#!/usr/bin/env python
from __future__ import absolute_import, print_function
import sys
import getopt
import time
def usage():
print('Help:')
def main():
override = False
try:
opts, args = getopt.getopt(sys.argv[1:], 'm:r:v', ['model=', 'rtype='])
except getopt.GetoptError:
usage()
sys.exit(2)
verbose = False
model_value = rtype_value = None
for opt, arg in opts:
if opt == "-v":
verbose = True
elif opt in ('-m', '--model'):
## TODO: filter model availabel and throw exception if invalid
if len(arg) != 4:
usage()
sys.exit(2)
model_value = arg.upper()
elif opt in ('-r', '--rtype'):
if arg not in '1234':
usage()
sys.exit(2)
rtype_value = arg
print('model: %s | r_type: %s | verbose: %s' % (
model_value, rtype_value, verbose))
if __name__ == '__main__':
main()

58
s11.py

@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
#!/usr/bin/env python
from __future__ import absolute_import, print_function
import sys
import getopt
import time
def usage():
print('Help:')
def main():
override = False
try:
opts, args = getopt.getopt(sys.argv[1:], 'm:r:k:v', ['model=', 'rtype=', 'ksearch='])
except getopt.GetoptError:
usage()
sys.exit(2)
verbose = False
model_value = rtype_value = k_value = None
for opt, arg in opts:
if opt == "-v":
verbose = True
elif opt in ('-m', '--model'):
## TODO: filter model availabel and throw exception if invalid
if len(arg) != 4:
usage()
sys.exit(2)
model_value = arg.upper()
elif opt in ('-r', '--rtype'):
if arg not in '1234':
usage()
sys.exit(2)
rtype_value = arg
elif opt in ('-k', '--ksearch'):
if arg.upper() not in 'ABCDEFGHIJKLMNOPQRS':
usage()
sys.exit(2)
k_value = arg.upper()
if not (model_value and rtype_value and k_value):
usage()
sys.exit(2)
print('model: %s | r_type: %s | k_search: %s | verbose: %s' % (
model_value, rtype_value, k_value, verbose))
if __name__ == '__main__':
main()
Loading…
Cancel
Save