2011 OCW 6.00 SC - Can someone please explain how the solution for PS 5 problem 6 works? What fumbles me is the t.evaluate (where t = WordTrigger('word') method is called, but it appears that such a method does not exist in the WordTrigger superclass. My code works in my own tests, but it cannot pass the diagnostic unit tests that the course provides...
Problem 6 implementsa Not trigger - seems straight forward. can you post the solution u are wondering about? please use a code pasting site.
hmmm... WordTrigger does not implement an evaluate() method and is not meant to - it is an abstract class. In the instructions, look at the note just before Problem 6.
This is the solution: http://pastebin.com/smbdd5Hk This is my current WIP: http://pastebin.com/RUs70LBj ----- Can you suggest how I would debug this then? For instance, I tried copying and pasting the solution's 'PS5 problem 6 code' into my code and it did not work in the unit test file.
@0003 The composite triggers take as an argument one of the triggers that you implemented in prob 3. the composite triggers don't know (in advance) which class you are going to pass them. the triggers in problem 3 work by passing a specific Portion of the NewStory to is_word_in(). the composite triggers cannot know, in advance, which portion of the NewStory to pass to is_word_in() - so is_word_in() is not the correct method to call at line 143
Gotcha. Thanks a lot. My code now evaluates correctly.
Join our real-time social learning platform and learn together with your friends!