code: def test_create_ngram_index():
      tokenizer = LightTokenizer()
      scenarios = [TEST_SCENARIO_1, TEST_SCENARIO_2]
      ngram_index: NgramIndex
      ngram_index = create_ngram_index(
          light_scenarios=scenarios,
          n_values=N_VALUES,
          tokenizer=tokenizer,
      )
  
      stats_1_key, stats_2_key, stats_3_key = (
          ContaminationStatsKey(
              metadata={
                  "light_scenario_key": TEST_SCENARIO_1.light_scenario_key,
                  "N": 5,
              }
          ),
          ContaminationStatsKey(
              metadata={
                  "light_scenario_key": TEST_SCENARIO_2.light_scenario_key,
                  "N": 5,
              }
          ),
          ContaminationStatsKey(
              metadata={
                  "light_scenario_key": TEST_SCENARIO_2.light_scenario_key,
                  "N": 13,
              }
          ),
      )
  
      test_5_gram: Ngram = (
          "Center",
          "for",
          "Research",
          "on",
          "Foundation",
      )
      test_13_gram: Ngram = (
          "The",
          "Center",
          "for",
          "Research",
          "on",
          "Foundation",
          "Models",
          "(CRFM)",
          "is",
          "an",
          "interdisciplinary",
          "initiative",
          "born",
      )
  
      assert ngram_index[5][test_5_gram] == set(
          [
              EntryContaminationKey(
                  stats_key=stats_1_key, instance_id=0, part=PART_INPUT
              ),
              EntryContaminationKey(
                  stats_key=stats_2_key, instance_id=0, part=PART_INPUT
              ),
              EntryContaminationKey(
                  stats_key=stats_2_key, instance_id=0, part=PART_REF
              ),
          ]
      )
      assert ngram_index[13][test_13_gram] == set(
          [
              EntryContaminationKey(
                  stats_key=stats_3_key, instance_id=0, part=PART_INPUT
              ),
              EntryContaminationKey(
                  stats_key=stats_3_key, instance_id=0, part=PART_REF
              ),
          ]
      )
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/contamination/test_compute_contamination_metrics.py
imports: from typing import List
  from helm.benchmark.contamination.compute_contamination_metrics import compute_scenario_document_contamination, create_all_contamination_stats, create_ngram_index, EntryContaminationKey, Ngram, NgramIndex, AllContaminationStats
  from helm.benchmark.contamination.light_scenario import LightScenario, LightInstance, LightScenarioKey
  from helm.benchmark.contamination.light_tokenizer import LightTokenizer, DefaultTokenizer
  from helm.benchmark.contamination.contamination_stats import ContaminationStats, ContaminationStatsKey, PART_INPUT, PART_REF
  from helm.common.general import asdict_without_nones
label_desc: Use image node_id 3 for calling a global function with example usage: test_create_ngram_index() without return types