This commit is contained in:
parent
1b2fd4868b
commit
b25143cc43
9
main.py
9
main.py
|
@ -44,9 +44,9 @@ def main(argv):
|
||||||
parameter = 'bai vvv vv vvv,012 000 00 000;bai tou er xin,012 010 10 001'
|
parameter = 'bai vvv vv vvv,012 000 00 000;bai tou er xin,012 010 10 001'
|
||||||
mode = '2'
|
mode = '2'
|
||||||
parameter = '1234'
|
parameter = '1234'
|
||||||
mode = '3'
|
# mode = '3'
|
||||||
parameter = '风调雨顺 1234,00 00 00 20 1111;无所不包 2341,00 00 00 00 2121;得心应手 2143,01 00 00 20 2222'
|
# parameter = '风调雨顺 1234,00 00 00 20 1111;无所不包 2341,00 00 00 00 2121;得心应手 2143,01 00 00 20 2222'
|
||||||
num = 100
|
num = 3
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv, "hm:p:n:", ["mode=", "parameter=", "num="])
|
opts, args = getopt.getopt(argv, "hm:p:n:", ["mode=", "parameter=", "num="])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
|
@ -111,10 +111,12 @@ def main(argv):
|
||||||
break
|
break
|
||||||
print_max_group(all_idiom, group, num)
|
print_max_group(all_idiom, group, num)
|
||||||
elif mode == '2':
|
elif mode == '2':
|
||||||
|
all_idiom = all_idiom[all_idiom['word'].str.len() == 4]
|
||||||
all_idiom['pinyin_tone'] = all_idiom.apply(lambda x: get_tone(x['pinyin']), axis=1)
|
all_idiom['pinyin_tone'] = all_idiom.apply(lambda x: get_tone(x['pinyin']), axis=1)
|
||||||
group = all_idiom[all_idiom['pinyin_tone'].str.startswith(parameter)].copy()
|
group = all_idiom[all_idiom['pinyin_tone'].str.startswith(parameter)].copy()
|
||||||
print_max_group(all_idiom, group, num)
|
print_max_group(all_idiom, group, num)
|
||||||
elif mode == '3':
|
elif mode == '3':
|
||||||
|
all_idiom = all_idiom[all_idiom['word'].str.len() == 4]
|
||||||
parameter_rst = parameter.split(';', 1)
|
parameter_rst = parameter.split(';', 1)
|
||||||
if len(parameter_rst) > 1:
|
if len(parameter_rst) > 1:
|
||||||
parameter_rst = parameter_rst[1]
|
parameter_rst = parameter_rst[1]
|
||||||
|
@ -129,7 +131,6 @@ def main(argv):
|
||||||
parameter = parameter[:-5]
|
parameter = parameter[:-5]
|
||||||
hits=hits[:-5]
|
hits=hits[:-5]
|
||||||
|
|
||||||
all_idiom = all_idiom[all_idiom['word'].str.len() == 4]
|
|
||||||
all_idiom['pinyin_tone'] = all_idiom.apply(lambda x: get_tone(x['pinyin']), axis=1)
|
all_idiom['pinyin_tone'] = all_idiom.apply(lambda x: get_tone(x['pinyin']), axis=1)
|
||||||
group = all_idiom.copy()
|
group = all_idiom.copy()
|
||||||
while(True):
|
while(True):
|
||||||
|
|
Loading…
Reference in New Issue