Example #1
0
def is_comment_meaningless(comment):
	comment = util.wash_sentence(comment)
	comment = comment.replace("哈哈", " ")
	comment = comment.replace("test", " ")
	comment = comment.replace("测试", " ")
	comment = comment.replace(".", "")
	comment = comment.replace(" ", "")

	return comment == "" or comment.isdigit()
Example #2
0
def is_comment_meaningless(comment):
    comment = util.wash_sentence(comment)
    comment = comment.replace("哈哈", " ")
    comment = comment.replace("test", " ")
    comment = comment.replace("测试", " ")
    comment = comment.replace(".", "")
    comment = comment.replace(" ", "")

    return comment == "" or comment.isdigit()
Example #3
0
def search_record(userid, notes):
    notes = notes.encode('utf-8', 'ignore').strip()

    search_keyword = notes.replace(MSG.CODE_SEARCH, "")
    search_keyword = search_keyword.replace(MSG.CODE_SEARCH2, "")
    search_keyword = search_keyword.replace(MSG.CODE_SEARCH3, "")
    search_keyword = util.wash_sentence(search_keyword)

    expense_list = Expense.query_obj_by_notes(userid, search_keyword, 15)

    (code, date, category, amount, branding, comment, token_list) \
      = split_expense_word(notes)
    if category != config.DEFAULT_CATEGORY:
        expense_list2 = Expense.query_obj_by_category(userid,
                                                      category.encode("utf8"),
                                                      15)
        expense_list = expense_list + expense_list2

    if search_keyword.replace("-", "").isdigit():
        search_date = search_keyword
        if search_keyword.find("-") == -1:
            search_date = "-%s" % (search_keyword)
        expense_list2 = Expense.query_obj_by_date2(userid, search_date, 15)
        expense_list = expense_list + expense_list2

    message = ""
    for obj in expense_list:
        message = "%s %s%s %s\n" % (message, obj.date[5:10].replace('-', '/'), \
									# str(obj.amount).replace(".0", "")+"元", \
               get_emoji(obj.category.encode("utf8"), "category"), obj.notes)

    if message == "" and search_keyword == "":
        return u"系统里一条记录都没有啵。亲,多记账呀,多记账"

    if message == "":
        message = u"无符合条件的记录。试下只输入: 搜索"
    message = message.rstrip("\n")

    content = MSG.REPLAY_SEARCH % (search_keyword, message, userid)
    return content.encode('utf-8', 'ignore')
Example #4
0
def search_record(userid, notes):
	notes = notes.encode('utf-8', 'ignore').strip()

	search_keyword = notes.replace(MSG.CODE_SEARCH, "")
	search_keyword = search_keyword.replace(MSG.CODE_SEARCH2, "")
	search_keyword = search_keyword.replace(MSG.CODE_SEARCH3, "")
	search_keyword = util.wash_sentence(search_keyword)

	expense_list = Expense.query_obj_by_notes(userid, search_keyword, 15)

	(code, date, category, amount, branding, comment, token_list) \
			= split_expense_word(notes)
	if category != config.DEFAULT_CATEGORY:
		expense_list2 = Expense.query_obj_by_category(userid, category.encode("utf8"), 15)
		expense_list = expense_list + expense_list2

	if search_keyword.replace("-", "").isdigit():
		search_date = search_keyword
		if search_keyword.find("-") == -1:
			search_date = "-%s" % (search_keyword)
		expense_list2 = Expense.query_obj_by_date2(userid, search_date, 15)
		expense_list = expense_list + expense_list2

	message = ""
	for obj in expense_list:
		message = "%s %s%s %s\n" % (message, obj.date[5:10].replace('-', '/'), \
									# str(obj.amount).replace(".0", "")+"元", \
									get_emoji(obj.category.encode("utf8"), "category"), obj.notes)

	if message == "" and search_keyword == "":
		return u"系统里一条记录都没有啵。亲,多记账呀,多记账"

	if message == "":
		message = u"无符合条件的记录。试下只输入: 搜索"
	message = message.rstrip("\n")

	content = MSG.REPLAY_SEARCH % (search_keyword, message, userid)
	return content.encode('utf-8', 'ignore')
Example #5
0
def is_comment_pure_alpha(comment):
	comment = util.wash_sentence(comment)
	return comment.isalpha()
Example #6
0
def is_comment_pure_alpha(comment):
    comment = util.wash_sentence(comment)
    return comment.isalpha()