Fixed bug in switch_to_task/1

Would backtrack over clauses it should have committed to, thereby
running two handlers for the task rather than one.  This lead to weird
doubling of continuations and restarts of operations.
Added repetition checking to NLG
Various extensions to discourse system and lexicon