Skip to content

Commit

Permalink
fix get_annotation error
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoIsALie committed Aug 24, 2023
1 parent 48bc963 commit b76fd0d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions state_formatters/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,16 @@ def get_tokenized_sentences(dialog: Dict) -> List[List[str]]:


def get_annotation(dialog: Dict, params: Dict) -> List:
return dialog[
params["utterance_type"][-params["last_n_utts"]]["annotations"].get(
params["annotation_attribute"], params["def_subresult"]
)
]
return dialog["human_utterances"][-1]["annotations"].get(
"spelling_preprocessing", dialog["human_utterances"][-1]["text"]
)


def get_sentences_with_history(dialog: Dict, params: Dict = None) -> List[str]:
# get the two most recent bot and human utterances, and the last human utterance
last_human_utt = get_annotation(dialog, params)
last_human_utt = dialog["human_utterances"][-1]["annotations"].get(
"spelling_preprocessing", dialog["human_utterances"][-1]["text"]
)
if dialog["bot_utterances"]:
# h sep b sep h sep b sep h
prev_bot_utts = [k["text"] for k in dialog["bot_utterances"][-2:]]
Expand Down

0 comments on commit b76fd0d

Please sign in to comment.