コード例 #1
0
 def observe(self, msg):
     print(
         display_messages(
             [msg],
             ignore_fields=self.opt.get('display_ignore_fields', ''),
             prettify=self.opt.get('display_prettify', False),
         ))
コード例 #2
0
 def observe(self, msg):
     current_message = TelegramAgent.message_queue.pop()
     msg_text = display_messages([msg],
                                 prettify=True,
                                 ignore_fields='text_candidates')
     self.bot.send_message(chat_id=current_message.chat_id,
                           text=msg_text.replace("[Seq2Seq]:", ""))
コード例 #3
0
 def act(self):
     reply = {
         'id': self.getID(),
         'text': self.text,
         'episode_done': self.episode_done
     }
     print('\t' + display_messages([reply]))
     return reply
コード例 #4
0
    def display(self):
        """Returns a string describing the current state of the world.

        Useful for monitoring and debugging.
        By default, display the messages between the agents."""
        if not hasattr(self, 'acts'):
            return ''
        return display_messages(self.acts,
                                prettify=self.opt.get('display_prettify',
                                                      False))
コード例 #5
0
    def observe(self, observation):
        print('\t' + display_messages([observation]))
        self.observation = observation
        self.episode_done = observation['episode_done']

        if self.episode_done:
            self.text = '/end'
        else:
            self.text = random.choice([
                'I love you!', 'Wow!', 'Really?', 'Nice!', 'Hi', 'Hello',
                'This is not very interesting. Let\'s change the subject of the '
                'conversation and talk about cats.', '/end'
            ])
コード例 #6
0
ファイル: worlds.py プロジェクト: kotenev/ParlAI
    def display(self):
        """
        Return a string describing the current state of the world.

        Useful for monitoring and debugging.
        By default, display the messages between the agents.
        """
        if not hasattr(self, 'acts'):
            return ''
        return display_messages(
            self.acts,
            ignore_fields=self.opt.get('display_ignore_fields', ''),
            prettify=self.opt.get('display_prettify', False),
            max_len=self.opt.get('max_display_len', 1000),
        )
コード例 #7
0
ファイル: convai_world.py プロジェクト: xlrshop/Parl
 def display(self):
     if self.curr_chatID in self.chats.keys():
         return display_messages(self.last_exchanges[self.curr_chatID])
     else:
         return ''
コード例 #8
0
 def observe(self, msg):
     print(
         display_messages([msg],
                          prettify=self.opt.get('display_prettify', False)))