本文整理汇总了Python中DB.incr_occurrence方法的典型用法代码示例。如果您正苦于以下问题:Python DB.incr_occurrence方法的具体用法?Python DB.incr_occurrence怎么用?Python DB.incr_occurrence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB.incr_occurrence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _getSources
# 需要导入模块: import DB [as 别名]
# 或者: from DB import incr_occurrence [as 别名]
def _getSources():
all_word_lists = []
for i,f in enumerate(docs_list):
with open(f, 'r') as file:
text = file.read().lower()
text = removeNonAscii(text)
# text = unicode(text , errors='ignore')
sentences = nltk.sent_tokenize(text)
#print self._generate_word_list(sentences)
current_doc_uniq_word_list = list(set(_generate_word_list(sentences)))
con = DB.get_con()
for w in current_doc_uniq_word_list:
if not isNumeric(w) and len(w)>1:
DB.incr_occurrence(w,con)
DB.incr_total_doc_number(con)
con.close()
file.close()
return all_word_lists