@@ -926,6 +926,12 @@ class PostProcessor extends Callable {
926
926
throw Error ( "post_process should be implemented in subclass." )
927
927
}
928
928
929
+ /**
930
+ * Alias for {@link PostProcessor#post_process}.
931
+ * @param {Array } tokens - The text or array of texts to post-process.
932
+ * @param {...* } args - Additional arguments required by the post-processing logic.
933
+ * @returns {Array } An array of post-processed tokens.
934
+ */
929
935
_call ( tokens , ...args ) {
930
936
return this . post_process ( tokens , ...args ) ;
931
937
}
@@ -1498,6 +1504,17 @@ class PreTrainedTokenizer extends Callable {
1498
1504
return inputs ;
1499
1505
}
1500
1506
1507
+ /**
1508
+ * Encode/tokenize the given text(s).
1509
+ * @param {string|string[] } text - The text to tokenize.
1510
+ * @param {object } options - An optional object containing the following properties:
1511
+ * @param {string|string[] } [options.text_pair=null] - Optional second sequence to be encoded. If set, must be the same type as text.
1512
+ * @param {boolean } [options.padding=false] - Whether to pad the input sequences.
1513
+ * @param {boolean } [options.truncation=null] - Whether to truncate the input sequences.
1514
+ * @param {number } [options.max_length=null] - Maximum length of the returned list and optionally padding length.
1515
+ * @param {boolean } [options.return_tensor=true] - Whether to return the results as Tensors or arrays.
1516
+ * @returns {{ input_ids: number[]|number[][]|Tensor; attention_mask: any[]|Tensor; } } Object to be passed to the model.
1517
+ */
1501
1518
_call (
1502
1519
// Required positional arguments
1503
1520
text ,
@@ -1512,6 +1529,7 @@ class PreTrainedTokenizer extends Callable {
1512
1529
return_tensor = true , // Different to HF
1513
1530
} = { } ,
1514
1531
) {
1532
+ /** @type {number[]|number[][]|Tensor } */
1515
1533
let tokens ;
1516
1534
1517
1535
if ( Array . isArray ( text ) ) {
0 commit comments