Calculates a hash key for the domain, intent and text of an example. This key is required for further interactions with the query cache. Args: domain(str): The domain of the example intent(str): The intent of the example query_text(str):
(domain, intent, query_text)
| 126 | |
| 127 | @staticmethod |
| 128 | def get_key(domain, intent, query_text): |
| 129 | """ |
| 130 | Calculates a hash key for the domain, intent and text of an example. |
| 131 | This key is required for further interactions with the query cache. |
| 132 | |
| 133 | Args: |
| 134 | domain(str): The domain of the example |
| 135 | intent(str): The intent of the example |
| 136 | query_text(str): The raw text of the example |
| 137 | Returns: |
| 138 | str: Hash id representing this query |
| 139 | """ |
| 140 | |
| 141 | h = sha256(domain.encode()) |
| 142 | h.update(b"###") |
| 143 | h.update(intent.encode()) |
| 144 | h.update(b"###") |
| 145 | h.update(query_text.encode()) |
| 146 | return h.hexdigest() |
| 147 | |
| 148 | @property |
| 149 | def connection(self): |