adds longer statements prior to if answer is long
@@ -34,10 +34,14 @@ tell_me_template = re.compile(tell_me)
full_template = re.compile(tell_me + r" (who|where|when|what|why)")
partial_template = re.compile(r"(who|where|when|what|why)")
-pre_statements = ["Hmm, this is what I've found on Wikipedia: ",
+short_pre_statements = ["Hmm, this is what I've found on Wikipedia: ",
"Here's what Wikipedia says: ",
"Hope this is it: ",
- "It is the impractical things in this tumultuous hellscape"
+ "It is what it is. Or is it? Here we go: ",
+ "Wikipedia says that: ",
+ "Technology advances, but humans not. Here's what my technology found: "]
+
+long_pre_stmts = ["It is the impractical things in this tumultuous hellscape"
" of a world that matter most. A book, a name, chicken soup. "
"They help us remember that even in our darkest hour, "
"life is still to be savored. Oh, my goodness. This is what I've found: ",
@@ -55,7 +59,6 @@ pre_statements = ["Hmm, this is what I've found on Wikipedia: ",
"Back to your question, here's what Wikipedia says: ",
"Take what is offered and that must sometimes be enough. What a thought isn't it?"
" Here's what I've found: ",
- "It is what it is. Or is it? Here we go: ",
"The past is relevant only as data. Here's what that data says: ",
"I will not squander what time I have left -- and as your friend I"
" entreat you to not squander yours. But here's the answer to your question: ",
@@ -76,9 +79,7 @@ pre_statements = ["Hmm, this is what I've found on Wikipedia: ",
" as tight and as closed as we AI bots do, seldom questioning our choices, content,"
" for the most part, to be told what to do next.\" This is what Dr. Ford used to think of"
" consciousness. Me? I'm still mastering my ability to answer your questions. Here's"
- " what I've found: ",
- "Wikipedia says that: ",
- "Technology advances, but humans not. Here's what my technology found: "]
+ " what I've found: "]
pre_old_memory_statements = ["Hmm, there's something I've heard once: ",
@@ -201,7 +202,12 @@ def respond():
# capitalizing
# response = str(kbqa_response["response"]).capitalize()
# we use one of the statements
- response = random.choice(pre_statements) + str(kbqa_response["response"])
+ str_response = str(kbqa_response["response"])
+ count = len(re.findall(r'\w+', str_response))
+ if (count > 3):
+ response = random.choice(long_pre_stmts) + str_response
+ else:
+ response = random.choice(short_pre_statements) + str_response
# FACTOID_DEFAULT_CONFIDENCE
confidence = kbqa_response["confidence"]
# and "?" in dialog["human_utterances"][-1]["text"]: Factoid questions can be without ?
