Interface Tokenizer

All Known Implementing Classes:
QwenTokenizer

@Deprecated public interface Tokenizer
Deprecated.
  • Method Details

    • encodeOrdinary

      List<Integer> encodeOrdinary(String text)
      Deprecated.
      Encoding that ignores any special tokens. There is no guarantee that the results will be completely consistent with the model output. Compared with the python version, there are some differences. It is known that the results of processing 2 or 4 consecutive spaces are different. Detailed information for qwen reference: https://github.com/QwenLM/Qwen/blob/main/tokenization_note_zh.md
      Parameters:
      text - The input.
      Returns:
      The list of token ids.
    • encode

      Deprecated.
      Encode the input text, handles special tokens. There is no guarantee that the results will be completely consistent with the model output. Compared with the python version, there are some differences. It is known that the results of processing 2 or 4 consecutive spaces are different. Detailed information for qwen reference: https://github.com/QwenLM/Qwen/blob/main/tokenization_note_zh.md
      Parameters:
      text - The input to be encode.
      allowedSpecial - The special token options can be "all"|"none"|"none_raise", if none_raise, then an `NoSpecialTokenExists` is throw if any special token is encountered in text, if null, use "all"
      Returns:
      The list of token encode.
      Throws:
      NoSpecialTokenExists - No special token in the input.
      UnSupportedSpecialTokenMode - the allowedSpecial is not["all"|"none"|"none_raise"]
    • decode

      String decode(List<Integer> ids)
      Deprecated.
      Decode token ids to String
      Parameters:
      ids - The input token ids, eg: [2610, 525, 264, 10950, 17847, 13], will be Decoded to "You are a helpful assistant."
      Returns:
      The token ids corresponding string.