Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.1 KB

message_response.md

File metadata and controls

43 lines (32 loc) · 1.1 KB

Message and Response

The base component of a conversation is utterance. Kovot provides Message and Response classes to represent utterances.

Message class represents user utterance. It is generated by taking text as an argument

from kovot import Message
msg = Message(text="This is utterance.")

Message class optionally takes Speaker object which represents a speaker of the utterance.

from kovot import Speaker
msg = Message(text="This is utterance",
              speaker=Speaker(name="Speaker name"))

Response class represents system response to user utterance. Response class takes two arguments;

  • text as a sentence of the response
  • score as a appropriateness
from kovot import Response
res = Response(text="This is a response", score=1.0)

Like Message, Resposne class takes following arguments as well as speaker.

  • message corresponding to the response
  • source as a Mod name generating the response
res = Response(text="This is a response",
               score=1.0,
               message=msg,
               source="source name")