本文整理汇总了Python中source.main.Interface.teach方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.teach方法的具体用法?Python Interface.teach怎么用?Python Interface.teach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类source.main.Interface
的用法示例。
在下文中一共展示了Interface.teach方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_question_prev_question_known_answer
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_question_prev_question_known_answer(self):
new_interface = Interface()
test_string1 = "How is paul awesome?"
result = new_interface.ask(test_string1)
result = new_interface.teach("He just is.")
result = new_interface.teach("Shouldn't allow change")
self.assertEqual(result, NO_TEACH)
示例2: test_provide_answer_corrected_square2
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_provide_answer_corrected_square2(self):
obj = Interface()
obj.ask('What type of flamingo is this 1 1 1 1?')
obj.teach(get_triangle_type)
obj.correct(get_quad_type)
result = obj.ask('What type of flamingo is this 1 1 1 1?')
self.assertEqual(result, 'Square')
示例3: test_question_ask_90_similar
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_question_ask_90_similar(self):
new_interface = Interface()
test_string = "How is pual awesom?"
result = new_interface.ask(test_string)
new_interface.teach("He just is.")
result = new_interface.ask(test_string)
self.assertEqual(result, "He just is.")
示例4: test_StoreAnswer_req
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_StoreAnswer_req(self):
obj = Interface()
obj.ask("What type of square is 1 1 1 1?")
obj.teach(get_triangle_type)
obj.correct(get_square_type)
result = obj.ask("What type of square is 1 1 1 1?")
self.assertEqual(result, "square")
示例5: test_provide_answer_corrected
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_provide_answer_corrected(self):
obj = Interface()
obj.ask('What color is the sky?')
obj.teach('The sky is blue')
obj.correct('The sky is a multitude of colors typically ranging from turquoise to indigo')
result = obj.ask('What color is the sky?')
self.assertEqual(result, 'The sky is a multitude of colors typically ranging from turquoise to indigo')
示例6: test_UpdateLearned_req
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_UpdateLearned_req(self):
obj = Interface()
obj.ask("What type of square is 1 1 1 1?")
obj.teach(get_triangle_type)
obj.correct(get_square_type)
result = obj.ask(obj.last_question + "?")
self.assertEqual(result, "invalid")
示例7: test_provide_answer_corrected_fptr
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_provide_answer_corrected_fptr(self):
obj = Interface()
obj.ask('What shape is 2 5 2 5?')
obj.teach(get_triangle_type)
obj.correct(get_quadrilateral_type)
result = obj.ask('What shape is 2 5 2 5?')
self.assertEqual(result, 'rectangle')
示例8: test_provide_answer_corrected_strings
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_provide_answer_corrected_strings(self):
obj = Interface()
obj.ask('Why did ancient egyptians build the pyramids?')
obj.teach('To honor their royalty in tombs')
obj.correct('Aliens')
result = obj.ask('Why did ancient egyptians build the pyramids?')
self.assertEqual(result, 'Aliens')
示例9: test_provide_answer_corrected_sentence
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_provide_answer_corrected_sentence(self):
obj = Interface()
obj.ask('Why did Abe Lincoln start killing vampires?')
obj.teach('Because Abe hates glitter')
obj.correct('Because Abe wants to add to his glitter collection')
result = obj.ask('Why did Abe Lincoln start killing vampires?')
self.assertEqual(result, 'Because Abe wants to add to his glitter collection')
示例10: test_giving_answer
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_giving_answer(self):
""" test teaching an answer """
attempt = Interface()
question = "How many sides does a quadrilateral have?"
attempt.ask(question)
attempt.teach("four sides.")
result = attempt.ask(question)
self.assertEqual(result, "four sides.")
示例11: test_question_ask_89_similar
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_question_ask_89_similar(self):
new_interface = Interface()
test_string = "How is paul awesome?"
result = new_interface.ask(test_string)
new_interface.teach("He just is.")
test_string2 = "How is pual awesum?"
result = new_interface.ask(test_string2)
self.assertEqual(result, UNKNOWN_QUESTION)
示例12: test_question_ask_0_similar
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_question_ask_0_similar(self):
new_interface = Interface()
test_string1 = "How is paul awesome?"
result = new_interface.ask(test_string1)
new_interface.teach("He just is.")
dif_str = "jack do knot scar."
result = new_interface.ask(dif_str)
self.assertEqual(result, NOT_A_QUESTION_RETURN)
示例13: test_job_story_clear
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_job_story_clear(self):
''' test to see if the user set question answers are cleared '''
attempt = Interface()
attempt.ask("What is the meaning of life?")
attempt.teach("42")
attempt.ask("Please clear memory?")
result4 = attempt.ask("What is the meaning of life?")
self.assertEqual(result4, "I don't know, please provide the answer")
示例14: test_story_clear_mem_teach
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_story_clear_mem_teach(self):
obj = Interface()
obj.ask('Why did Abe Lincoln start killing vampires?')
obj.teach('Because Abe hates glitter')
obj.ask('Why did Abe Lincoln start killing vampires?')
obj.ask("Please clear memory?")
result = obj.ask('Why did Abe Lincoln start killing vampires?')
self.assertEqual(result, 'I don\'t know, please provide the answer')
示例15: test_previous_question_answer
# 需要导入模块: from source.main import Interface [as 别名]
# 或者: from source.main.Interface import teach [as 别名]
def test_previous_question_answer(self):
'''
This tests the interface for previous question teaching.
'''
interface = Interface()
interface.ask("What makes you think she is a witch?")
interface.teach("Oh, she turned me into a newt!")
result = interface.ask("What makes you think she is a witch?")
self.assertEqual(result, "Oh, she turned me into a newt!")