示例#1
0
import logging
import re
# Import app modules
import answerVote
from configAutocomplete import const as conf
from constants import Constants
import question
import stats
import text

# Constants
const = Constants()
const.MAX_RETRY = 3
const.MAX_VOTE_RETRY = 3
const.CHAR_LENGTH_UNIT = 100
const.MAX_ANSWER_SUGGESTIONS = 3
const.NUM_FREQ_ANSWER_SUGGESTIONS = min(
    1, const.MAX_ANSWER_SUGGESTIONS -
    1)  # Should be less than MAX_ANSWER_SUGGESTIONS
const.SEARCH_INDEX_NAME = 'answersearchindex'
const.MAX_SEARCH_RESULTS = 100
const.USE_SEARCH_INDEX = False
const.MAX_SEARCH_QUERY_WORDS = 10

conf.ANSWER_REASON_DELIMITER = '\t'


def standardizeContent(content):
    content = text.formTextToStored(content) if content else None
    content = content.strip(
        ' \n\r\x0b\x0c'