pepper.language.language module¶
-
class
pepper.language.language.
Chat
(speaker, context)[source]¶ Bases:
object
-
add_utterance
(hypotheses, me)[source]¶ Add Utterance to Conversation
Parameters: hypotheses (list of UtteranceHypothesis) – Returns: utterance Return type: Utterance
-
context
¶ returns: context – Context :rtype: Context
-
id
¶ returns: id – Unique (random) identifier of this chat :rtype: int
-
last_utterance
¶ returns: last_utterance – Most recent Utterance :rtype: Utterance
-
speaker
¶ returns: speaker – Name of speaker (a.k.a. the person Pepper has a chat with) :rtype: str
-
utterances
¶ returns: utterances – List of utterances that occurred in this chat :rtype: list of Utterance
-
-
class
pepper.language.language.
Emotion
[source]¶ Bases:
enum.Enum
-
ANGER
= 0¶
-
DISGUST
= 1¶
-
FEAR
= 2¶
-
HAPPINESS
= 3¶
-
SADNESS
= 4¶
-
SURPRISE
= 5¶
-
-
class
pepper.language.language.
Parser
(utterance)[source]¶ Bases:
object
-
CFG_GRAMMAR_FILE
= u'C:\\Users\\Pepper\\Documents\\Pepper\\pepper\\pepper\\language\\data\\cfg_new.txt'¶
-
POS_TAGGER
= None¶
-
constituents
¶
-
forest
¶
-
-
class
pepper.language.language.
Utterance
(chat, hypotheses, me, turn)[source]¶ Bases:
object
-
analyze
()[source]¶ Determines the type of utterance, extracts the RDF triple and perspective attaching them to the last utterance :param chat:
-
casefold
(format=u'triple')[source]¶ Format the labels to match triples or natural language :param format:
-
chat
¶ returns: chat – Utterance Chat :rtype: Chat
-
chat_speaker
¶ returns: speaker – Name of speaker (a.k.a. the person Pepper has a chat with) :rtype: str
-
confidence
¶ returns: confidence – Utterance Confidence :rtype: float
-
context
¶ returns: context – Context (a.k.a. people, objects and other detections ) :rtype: Context
-
datetime
¶
-
language
¶ returns: language – Original language of the Transcript :rtype: str
-
me
¶ returns: me – True if Robot spoke, False if Person Spoke :rtype: bool
-
pack_triple
(rdf, utterance_type)[source]¶ Sets utterance type, the extracted triple and (in future) the perspective :param rdf: :param utterance_type:
-
parser
¶ returns: parsed_tree :rtype: ntlk Tree generated by the CFG parser
-
perspective
¶ returns: perspective – NLP features related to the utterance :rtype: Perspective
-
tokens
¶ returns: tokens – Tokenized transcript :rtype: list of str
-
transcript
¶ returns: transcript – Utterance Transcript :rtype: str
-
triple
¶ returns: triple – Structured representation of the utterance :rtype: Triple
-
turn
¶ returns: turn – Utterance Turn :rtype: int
-
type
¶ returns: type – Whether the utterance was a statement, a question or an experience :rtype: UtteranceType
-
-
pepper.language.language.
getrandbits
(k) → x. Generates a long int with k random bits.¶