Decode a list of token IDs back into a natural text string. Args: token_ids: List of token IDs to decode. Returns: Decoded text string.
(self, token_ids: List[int])
| 30 | return self.tokenizer.encode(content.strip()) |
| 31 | |
| 32 | def decode(self, token_ids: List[int]) -> str: |
| 33 | """Decode a list of token IDs back into a natural text string. |
| 34 | |
| 35 | Args: |
| 36 | token_ids: List of token IDs to decode. |
| 37 | |
| 38 | Returns: |
| 39 | Decoded text string. |
| 40 | """ |
| 41 | if not token_ids: |
| 42 | return '' |
| 43 | return self.tokenizer.decode(token_ids, skip_special_tokens=True) |
| 44 | |
| 45 | def segment(self, content: str) -> List[str]: |
| 46 | """Tokenize text into a list of token strings suitable for BM25-like algorithms indexing/retrieval. |
no outgoing calls
no test coverage detected