本文整理汇总了Python中histogram.Histogram.process_file方法的典型用法代码示例。如果您正苦于以下问题:Python Histogram.process_file方法的具体用法?Python Histogram.process_file怎么用?Python Histogram.process_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类histogram.Histogram
的用法示例。
在下文中一共展示了Histogram.process_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_histograms
# 需要导入模块: from histogram import Histogram [as 别名]
# 或者: from histogram.Histogram import process_file [as 别名]
def get_histograms(path, bad_words):
histograms = []
names = []
pair = []
for element in os.listdir(path):
temp_path = os.path.join(path, element)
for directory in os.listdir(temp_path):
full_path = os.path.join(temp_path, directory)
# for document in directory create histogram
hist = Histogram(full_path)
# process file
hist.process_file(bad_words)
# full-fill words and numbers table
hist.get_words()
# sort histogram
hist_sort = hist.sort_histogram()
# append histograms table with histogram of current document
histograms.append(hist_sort)
names.append(hist.push_name())
pair = [histograms, names]
return pair