docstr: Check that the dictionary is valid.
docstr_tok: ["Check","that","the","dictionary","is","valid","."]
code: def check_valid(self):
      """
      Check that the dictionary is valid.
      """
      assert self.bos_index == 0
      assert self.eos_index == 1
      assert self.pad_index == 2
      assert self.unk_index == 3
      assert all(
          self.id2word[4 + i] == SPECIAL_WORD % i
          for i in range(SPECIAL_WORDS)
      )
      assert len(self.id2word) == len(self.word2id) == len(self.counts)
      assert set(self.word2id.keys()) == set(self.counts.keys())
      for i in range(len(self.id2word)):
          assert self.word2id[self.id2word[i]] == i
      last_count = 1e18
      for i in range(4 + SPECIAL_WORDS, len(self.id2word) - 1):
          count = self.counts[self.id2word[i]]
          assert count <= last_count
          last_count = count
  
file_path: pytext/pytext/data/xlm_dictionary.py
imports: import os
  from logging import getLogger
  import numpy
  import torch
  from pytext.utils.file_io import PathManager
label_desc: Use image node_id 6 for calling the Dictionary obj's underlying member method code with example usage: obj.check_valid() without return types