コード例 #1
0
 def _process(self, input_pack: DataPack):
     input_pack.set_text(input_pack.text + "\n" + self.instruction)
     u = Utterance(
         input_pack,
         len(input_pack.text) - len(self.instruction),
         len(input_pack.text),
     )
     u.speaker = "ai"
コード例 #2
0
def new_utterance(input_pack: DataPack, text: str, speaker: str):
    input_pack.set_text(input_pack.text + '\n' + text)
    logging.info('The response is:')
    logging.info(text)

    u = Utterance(input_pack,
                  len(input_pack.text) - len(text),
                  len(input_pack.text))
    u.speaker = speaker
コード例 #3
0
    def new_utternace(self, input_pack: DataPack, text: str, speaker: str):
        input_pack.set_text(input_pack.text + "\n" + text)
        logging.info("The response is:")
        logging.info(text)

        print("The response is:")
        print(text)

        u = Utterance(input_pack,
                      len(input_pack.text) - len(text), len(input_pack.text))
        u.speaker = speaker
コード例 #4
0
def create_utterance(input_pack: DataPack, text: str, speaker: str):
    """
    Create an utterance in the datapack. This is composed of two steps:
     1. Append the utterance text to the data pack.
     2. Create :class:`~ft.onto.base_ontology.Utterance` entry on the text.
     3. Set the speaker of the utterance to the provided `speaker`.

    Args:
        input_pack: The data pack to add utterance into.
        text: The text of the utterance.
        speaker: The speaker name to be associated with the utterance.

    """
    input_pack.set_text(input_pack.text + '\n' + text)

    u = Utterance(input_pack,
                  len(input_pack.text) - len(text), len(input_pack.text))
    u.speaker = speaker