本文整理汇总了Python中analyzer.Analyzer.parse_text方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.parse_text方法的具体用法?Python Analyzer.parse_text怎么用?Python Analyzer.parse_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.parse_text方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_analyze
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import parse_text [as 别名]
def create_analyze():
text = request.POST.get('text', '').strip()
if len(text) == 0:
return {'message': 'error, you must provide `text` parameter'}
analyze = Analyzer(text)
analyzed = analyze.parse_text()
graphic_fabric = Graphic(analyzed.letters_occur, analyzed.most_used_words, analyzed.letters_count)
graphic_fabric.graph_letter_occurrence()
graphic_fabric.graph_words_occurrence()
analyzed = analyze.format_before_save()
conn = sqlite3.connect('analyzes.db')
c = conn.cursor()
c.execute("INSERT INTO analyzes (analyzed_text, creation_date, words_occur, letters_count, letters_occur, most_used_words, letter_occur_graph_name, words_occur_graph_name) VALUES(?,?,?,?,?,?,?,?)", (analyzed.text, analyzed.creation_date, analyzed.words_occur, analyzed.letters_count, analyzed.letters_occur, analyzed.most_used_words, graphic_fabric.letter_occur_graph_name, graphic_fabric.words_occur_graph_name))
conn.commit()
c.close()
return analyzed.to_json()