Ejemplo n.º 1
0
def Stylize(therapist, answer):

	tokenized_answer = nltk.word_tokenize(answer)
	answer_tagged = nltk.pos_tag(answer)

	if Therapist.getStyle(therapist)=="NG":

		answer = answer

	else:

		answer = re.sub("ing\W", "in' ", answer)

	return answer
Ejemplo n.º 2
0
def Stylize(therapist, patient, response):

    N_type_replacements = {"ing ":"in' "," are not ":" aren't "," do ":"d'","Do ":"D'","because":"'cause","You ":"ya ","you\b":"ya\b", \
    " is ":"'s ", "\bam\b":"'m ","\bwill\b":"'ll"," are ":"'re ", "\bnot\b":"n't\b","\bhave\b":"'ve\b","\bwould":"'d"}

    if Therapist.getStyle(therapist) == "NG":
        response = response
    else:
        for key in N_type_replacements.keys():
            response = re.sub(key, N_type_replacements[key], response)
        punct = response[-1]
        response = response[:-1]
        response[0].upper()
        petname = Therapist.petname(therapist, patient)
        response = "%s, %s%s" % (response, petname, punct)

    return response
Ejemplo n.º 3
0
def Stylize(therapist, patient, response):

	N_type_replacements = {"ing ":"in' "," are not ":" aren't "," do ":"d'","Do ":"D'","because":"'cause","You ":"ya ","you\b":"ya\b", \
	" is ":"'s ", "\bam\b":"'m ","\bwill\b":"'ll"," are ":"'re ", "\bnot\b":"n't\b","\bhave\b":"'ve\b","\bwould":"'d"}

	if Therapist.getStyle(therapist)=="NG":
		response = response
	else:
		for key in N_type_replacements.keys():
			response = re.sub(key, N_type_replacements[key], response)
		punct = response[-1]
		response = response[:-1]
		response[0].upper()
		petname = Therapist.petname(therapist, patient)
		response = "%s, %s%s"%(response, petname, punct)

	return response
Ejemplo n.º 4
0
def Stylize(therapist, patient, response):

    N_type_replacements = {"ing ":"in' ","You\b":"ya\b","you\b":"ya\b", \
    " is ":"'s ", "\bare\b":"'re\b", "\bhave\b":"'ve\b"}

    if Therapist.getStyle(therapist) == "NG":
        response = response
    else:
        for key in N_type_replacements.keys():
            response = re.sub(key, N_type_replacements[key], response)
        punct = response[-1]
        response = response[:-1]
        response[0].upper()
        petname = Therapist.petname(therapist, patient)
        response = "%s, %s%s" % (response, petname, punct)

    return response