def __judge_print(self):
     """
     judge slack call for chainer
     Example:
         chainer:{your sentence}
             chainer return the sentence
         chainer_train:{your sentence}
             start train
     """
     if len(self.data) >= 1 and "text" in self.data[0]:
         print(self.data[0]["text"])
         if "chainer:" in self.data[0]["text"]:
             # input sentence
             src_batch = self.__input_sentence()
             # predict
             hyp_batch = self.__predict_sentence(src_batch)
             # show predict word
             word = ''.join(hyp_batch[0]).replace("</s>", "")
             print(
                 self.slack_channel.api_call("chat.postMessage",
                                             user=self.usr,
                                             channel=self.chan,
                                             text=word))
         if "chainer_train" in self.data[0]["text"]:
             self.__setting_parameter()
             model = AttentionDialogue.load_spec(self.model_name + '.spec',
                                                 self.XP)
             dialogue = EncoderDecoderModelAttention(self.parameter)
             serializers.load_hdf5(self.model_name + '.weights', model)
             dialogue.attention_dialogue = model
             dialogue.word2vecFlag = False
             dialogue.train()
 def __judge_print(self):
     """
     judge slack call for chainer
     Example:
         chainer:{your sentence}
             chainer return the sentence
         chainer_train:{your sentence}
             start train
     """
     if len(self.data) >= 1 and "text" in self.data[0]:
         print(self.data[0]["text"])
         if "chainer:" in self.data[0]["text"]:
             # input sentence
             src_batch = self.__input_sentence()
             # predict
             hyp_batch = self.__predict_sentence(src_batch)
             # show predict word
             word = ''.join(hyp_batch[0]).replace("</s>", "")
             print(self.slack_channel.api_call("chat.postMessage", user=self.usr, channel=self.chan, text=word))
         if "chainer_train" in self.data[0]["text"]:
             self.__setting_parameter()
             model = AttentionDialogue.load_spec(self.model_name + '.spec', self.XP)
             dialogue = EncoderDecoderModelAttention(self.parameter)
             serializers.load_hdf5(self.model_name + '.weights', model)
             dialogue.attention_dialogue = model
             dialogue.word2vecFlag = False
             dialogue.train()