Пример #1
0
 def __validate_position_in_text(self, start: int, end: int):
     """Validate the start and end position match the text length."""
     if self.text_len < start or end > self.text_len:
         err_msg = (f"Invalid analyzer result, start: {start} and end: "
                    f"{end}, while text length is only {self.text_len}.")
         raise InvalidParamException(err_msg)
Пример #2
0
 def __validate_text_not_empty(self, text: str):
     if not text:
         self.logger.debug("invalid input, json is missing text field")
         raise InvalidParamException("Invalid input, text can not be empty")