本文整理汇总了Python中Windows.get_dates方法的典型用法代码示例。如果您正苦于以下问题:Python Windows.get_dates方法的具体用法?Python Windows.get_dates怎么用?Python Windows.get_dates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows
的用法示例。
在下文中一共展示了Windows.get_dates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calc_freq
# 需要导入模块: import Windows [as 别名]
# 或者: from Windows import get_dates [as 别名]
def calc_freq(date_from,date_to,window_size,wanted_list,n,search=[]):
groups,wanted_list = group(wanted_list)
# list of tuples of dates
all_dates = Windows.get_dates(date_from,date_to,365) # these are not windows, smaller problems
# for dates and frequencies
x = []
y = np.empty((len(wanted_list), 0)).tolist()
stevec = 0
print('grem v zanke')
for tup in all_dates:
print('leto')
windows, time = Windows.get_windows(tup[0], tup[1], window_size,search)
print('windows')
x += time
if n==1: grams = count_words(wanted_list,windows)
else: grams, words_per_window = N_grams.list_of_ngrams(windows, n)
print('ngrami narjeni')
for count, i in enumerate(grams):
#words = words_per_window[count] #to calculate frequency
#besede.append(words)
words = besede[stevec]
stevec+=1
for j,wanted in enumerate(wanted_list):
frequency = 0
if wanted in i:
frequency = i[wanted] / words
y[j].append(frequency)
print('ngrami presteti')
#print(besede)
print('plotam')
#print(x,y,wanted_list,groups)
plot(x,y,wanted_list,groups)
return x,y