forked from p46318075/CodePattern
parent
0913eee8af
commit
97ed3a4adf
@ -1,33 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import cppy.cp_util as util
|
||||
|
||||
# 每一列是一个数据元素和一个公式,第一列是输入数据,所以没有公式
|
||||
all_words = [(), None]
|
||||
non_stop_words = [(), util.extract_str_words]
|
||||
frequencies = [(), util.get_frequencies]
|
||||
sorted_data = [(), util.sort_dict]
|
||||
|
||||
# 整个电子表格
|
||||
all_columns = [all_words, non_stop_words,\
|
||||
frequencies, sorted_data]
|
||||
|
||||
# 每次输入数据后调用此方法
|
||||
def update():
|
||||
global all_columns
|
||||
for c in all_columns[1::]:
|
||||
if c[1] == util.extract_str_words:
|
||||
c[0] = c[1](all_words[0])
|
||||
elif c[1] == util.get_frequencies:
|
||||
c[0] = c[1](non_stop_words[0])
|
||||
elif c[1] == util.sort_dict:
|
||||
c[0] = c[1](frequencies[0])
|
||||
|
||||
# 将固定数据加载到第一列中
|
||||
all_words[0] = util.read_file(util.testfilepath)
|
||||
# 调用update函数遍历列表
|
||||
update()
|
||||
|
||||
#打印结果
|
||||
util.print_word_freqs(sorted_data[0])
|
||||
|
||||
|
Loading…
Reference in new issue