Modeling context and knowledge for dialogue generation