diff options
Diffstat (limited to 'modules/responses/responses.py')
-rw-r--r-- | modules/responses/responses.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/responses/responses.py b/modules/responses/responses.py new file mode 100644 index 0000000..f89a1fe --- /dev/null +++ b/modules/responses/responses.py @@ -0,0 +1,29 @@ +from dataclasses import dataclass, field +from typing import List, Dict, Any + +@dataclass(frozen=True) +class Response: + name: str + sentence_texts: List[str] + +@dataclass(frozen=True) +class Responses: + responses: Dict[str, Response] + + @staticmethod + def from_dict(input_dict: Dict[str, Any]) -> "Responses": + # responses: + # ResponseName: + # data: + # - sentences: + # - "<sentence>" + return Responses( + responses={ + response_name: Response( + name=response_name, + sentence_texts=response_dict["sentences"] + ) + for response_name, response_dict in input_dict["responses"].items() + }, + ) + |