本文整理匯總了Python中Windows.get_windows方法的典型用法代碼示例。如果您正苦於以下問題:Python Windows.get_windows方法的具體用法?Python Windows.get_windows怎麽用?Python Windows.get_windows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows
的用法示例。
在下文中一共展示了Windows.get_windows方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: calc_freq
# 需要導入模塊: import Windows [as 別名]
# 或者: from Windows import get_windows [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