class_docstr: Find samples that contain tokens unsupported by your tokenizer.
  
  Parameters
  ----------
  tokenizer: t.Any , default: None
      Tokenizer from the HuggingFace transformers library to use for tokenization. If None,
      AutoTokenizer.from_pretrained('bert-base-uncased') will be used.
  group_singleton_words: bool, default: False
      If True, group all words that appear only once in the data into the "Other" category in the display.
  n_most_common : int , default: 5
      Number of most common words with unknown tokens to show in the display.
  n_samples: int, default: 1_000_000
      number of samples to use for this check.
  random_state : int, default: 42
      random seed for all check internals.
  {max_text_length_for_display_param:1*indent}
class_docstr_tok: ["Find","samples","that","contain","tokens","unsupported","by","your","tokenizer",".","Parameters","--","--","--","--","--","tokenizer",":","t.Any",",","default",":","None","Tokenizer","from","the","HuggingFace","transformers","library","to","use","for","tokenization",".","If","None",",","AutoTokenizer.from_pretrained","(","'bert-base-uncased","'",")","will","be","used",".","group_singleton_words",":","bool",",","default",":","False","If","True",",","group","all","words","that","appear","only","once","in","the","data","into","the","``","Other","''","category","in","the","display",".","n_most_common",":","int",",","default",":","5","Number","of","most","common","words","with","unknown","tokens","to","show","in","the","display",".","n_samples",":","int",",","default",":","1_000_000","number","of","samples","to","use","for","this","check",".","random_state",":","int",",","default",":","42","random","seed","for","all","check","internals",".","{","max_text_length_for_display_param:1","*","indent","}"]
docstr: Create pie chart with most common unknown words.
docstr_tok: ["Create","pie","chart","with","most","common","unknown","words","."]
code: def create_pie_chart(self, all_unknown_words_counter, total_words):
      """Create pie chart with most common unknown words."""
      most_common_unknown_words = [
          x[0]
          for x in all_unknown_words_counter.most_common(
              self.n_most_common
          )
          if ((x[1] > 1) or (not self.group_singleton_words))
      ]
      other_words = [
          x
          for x in all_unknown_words_counter
          if x not in most_common_unknown_words
      ]
  
      # Calculate percentages for each category
      other_words_count = sum(
          all_unknown_words_counter[word] for word in other_words
      )
      other_words_percentage = (
          other_words_count * 1.0 / total_words
      ) * 100.0
      labels = most_common_unknown_words
      percentages = [
          all_unknown_words_counter[word] * 1.0 / total_words * 100.0
          for word in most_common_unknown_words
      ]
  
      # Add "Other Unknown Words" and "Known Words" categories
      if other_words_percentage > 0:
          labels.append(OTHER_CAT_NAME)
          percentages.append(other_words_percentage)
  
      # Truncate labels for display
      labels = [
          truncate_string(label, self.max_text_length_for_display)
          for label in labels
      ]
      # round percentages to 2 decimal places after the percent
      percentages = [round_sig(percent, 2) for percent in percentages]
  
      # Create pie chart with hover text and custom hover template
      fig = go.Figure(
          data=[
              go.Pie(
                  labels=labels,
                  values=percentages,
                  texttemplate="%{label}<br>%{value}%",
                  hovertext=[
                      format_list(
                          other_words,
                          max_string_length=self.max_text_length_for_display,
                      )
                      if label == OTHER_CAT_NAME
                      else label
                      for label in labels
                  ],
                  hovertemplate=[
                      "<b>Unknown Word</b>: %{hovertext}<br><b>Percent of All Words</b>: %{value}%<extra></extra>"
                      if label != OTHER_CAT_NAME
                      else "<b>Other Unknown Words</b>: %{hovertext}<br>"
                      "<b>Percent of All Words</b>: %{value}%<extra></extra>"
                      for label in labels
                  ],
                  pull=[
                      0.1 if label == OTHER_CAT_NAME else 0
                      for label in labels
                  ],
              )
          ]
      )
  
      # Customize chart appearance
      fig.update_layout(
          title=f"Words containing Unknown Tokens - {self.tokenizer.name_or_path} Tokenizer<br>"
          f"({format_percent(sum(percentages) / 100.)} of all words)",
          title_x=0.5,
          title_y=0.95,
          legend_title="Words with Unknown Tokens",
          margin=dict(l=0, r=0, t=100, b=0),
      )
  
      return fig
  
imports: import contextlib
  import copy
  import sys
  import typing
  import warnings
  from collections import Counter
  import nltk
  import plotly.graph_objects
  from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
  from deepchecks.core.errors import DeepchecksProcessError, DeepchecksValueError
  from deepchecks.nlp import Context, SingleDatasetCheck
  from deepchecks.nlp._shared_docs import docstrings
  from deepchecks.nlp.text_data import TextData
  from deepchecks.utils.numbers import round_sig
  from deepchecks.utils.strings import format_list, format_percent, truncate_string
label_desc: Use image node_id 6 for calling the UnknownTokens obj's underlying member method code with example usage: obj.create_pie_chart(all_unknown_words_counter, total_words) and returns: fig