---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://catboost.ai/docs/en/concepts/python-reference_dictionary_get_top_tokens.md
  - href: en/concepts/python-reference_dictionary_get_top_tokens.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://catboost.ai/docs/en/llms.txt

# get_top_tokens

<!-- source: en/_includes/work_src/reusage-tokenizer/get_top_tokens.md -->
Get the specified number of top most frequent tokens.
<!-- endsource: en/_includes/work_src/reusage-tokenizer/get_top_tokens.md -->

<!-- source: en/_includes/work_src/reusage-tokenizer/fbd_only.md -->
{% note alert %}

This method is implemented only for the FrequencyBased dictionary type.

{% endnote %}
<!-- endsource: en/_includes/work_src/reusage-tokenizer/fbd_only.md -->


## Method call format {#call-format}

```
get_top_tokens(top_size=None)
```

## Parameters {#parameters}

### top_size

#### Description

The top size to output.

**Data types**

int

**Default value**

10

## Type of return value {#return-value}

list

## Example {#example}

```python
from catboost.text_processing import Dictionary

dictionary = Dictionary(occurence_lower_bound=0)\
    .fit(['A', 'C', 'C', 'A', 'B', 'A', 'D'])

print(dictionary.get_top_tokens(2))

```

Output:
```bash
['A', 'C']
```

