def test_conditional(self): # Assert True for sentences that contain possible or imaginary situations. from pattern.text.en.modality import conditional for b, s in ((True, "We ought to help him."), (True, "We could help him."), (True, "I will help you."), (True, "I hope you will help me."), (True, "I can help you if you let me."), (False, "You will help me."), (False, "I can help you.")): self.assertEqual(conditional(en.Sentence(en.parse(s))), b) # Assert predictive mood. s = "I will help you." v = conditional(en.Sentence(en.parse(s)), predictive=False) self.assertEqual(v, False) # Assert speculative mood. s = "I will help you if you pay me." v = conditional(en.Sentence(en.parse(s)), predictive=False) self.assertEqual(v, True) print "pattern.en.modality.conditional()"
def test_conditional(self): # Assert True for sentences that contain possible or imaginary situations. from pattern.text.en.modality import conditional for b, s in ( (True, "We ought to help him."), (True, "We could help him."), (True, "I will help you."), (True, "I hope you will help me."), (True, "I can help you if you let me."), (False, "You will help me."), (False, "I can help you.")): self.assertEqual(conditional(en.Sentence(en.parse(s))), b) # Assert predictive mood. s = "I will help you." v = conditional(en.Sentence(en.parse(s)), predictive=False) self.assertEqual(v, False) # Assert speculative mood. s = "I will help you if you pay me." v = conditional(en.Sentence(en.parse(s)), predictive=False) self.assertEqual(v, True) print "pattern.en.modality.conditional()"