get_token

Return the token that corresponds to the given identifier.

Method call format

get_token(token_id)

Parameters

token_id

Description

The identifier of the token that should be returned.

Data types

int

Default value

Obligatory parameter

Type of return value

string

Example

from catboost.text_processing import Dictionary

dictionary = Dictionary(occurence_lower_bound=0)\
    .fit(["his", "tender", "heir", "whatever"])

print(dictionary.get_token(3))

Output:

whatever

Note

This method returns the token value in accordance with the numeration in the built dictionary. In this example, the numeration for the input list for building the dictionary and the one of the dictionary differ.

Previous