class_docstr: 用于构建, 存储和使用 `str` 到 `int` 的一一映射::
  
      from fastNLP.core import Vocabulary
      vocab = Vocabulary()
      word_list = "this is a word list".split()
      # vocab更新自己的字典，输入为list列表
      vocab.update(word_list)
      vocab["word"] # str to int
      vocab.to_word(5) # int to str
  
  :param max_size: `Vocabulary` 的最大大小, 即能存储词的最大数量
      若为 ``None`` , 则不限制大小。
  :param min_freq: 能被记录下的词在文本中的最小出现频率, 应大于或等于 1。
      若小于该频率, 词语将被视为 `unknown`. 若为 ``None`` , 所有文本中的词都被记录。
  :param padding: padding的字符. 如果设置为 ``None`` ,
      则vocabulary中不考虑padding, 也不计入词表大小，为 ``None`` 的情况多在为 label 建立 Vocabulary 的情况。
  :param unknown: unknown的字符，所有未被记录的词在转为 :class:`int` 时将被视为 `unknown` 。
      如果设置为 ``None`` ,则 vocabulary 中不考虑 `unknown`, 也不计入词表大小。
      为 ``None`` 的情况多在为 labe l建立 Vocabulary 的情况
class_docstr_tok: ["\u7528\u4e8e\u6784\u5efa",",","\u5b58\u50a8\u548c\u4f7f\u7528","`","str","`","\u5230","`","int","`","\u7684\u4e00\u4e00\u6620\u5c04",":",":","from","fastNLP.core","import","Vocabulary","vocab","=","Vocabulary","(",")","word_list","=","``","this","is","a","word","list","''",".split","(",")","#","vocab\u66f4\u65b0\u81ea\u5df1\u7684\u5b57\u5178\uff0c\u8f93\u5165\u4e3alist\u5217\u8868","vocab.update","(","word_list",")","vocab","[","``","word","''","]","#","str","to","int","vocab.to_word","(","5",")","#","int","to","str",":","param","max_size",":","`","Vocabulary","`","\u7684\u6700\u5927\u5927\u5c0f",",","\u5373\u80fd\u5b58\u50a8\u8bcd\u7684\u6700\u5927\u6570\u91cf","\u82e5\u4e3a","``","None","``",",","\u5219\u4e0d\u9650\u5236\u5927\u5c0f\u3002",":","param","min_freq",":","\u80fd\u88ab\u8bb0\u5f55\u4e0b\u7684\u8bcd\u5728\u6587\u672c\u4e2d\u7684\u6700\u5c0f\u51fa\u73b0\u9891\u7387",",","\u5e94\u5927\u4e8e\u6216\u7b49\u4e8e","1\u3002","\u82e5\u5c0f\u4e8e\u8be5\u9891\u7387",",","\u8bcd\u8bed\u5c06\u88ab\u89c6\u4e3a","`","unknown","`",".","\u82e5\u4e3a","``","None","``",",","\u6240\u6709\u6587\u672c\u4e2d\u7684\u8bcd\u90fd\u88ab\u8bb0\u5f55\u3002",":","param","padding",":","padding\u7684\u5b57\u7b26",".","\u5982\u679c\u8bbe\u7f6e\u4e3a","``","None","``",",","\u5219vocabulary\u4e2d\u4e0d\u8003\u8651padding",",","\u4e5f\u4e0d\u8ba1\u5165\u8bcd\u8868\u5927\u5c0f\uff0c\u4e3a","``","None","``","\u7684\u60c5\u51b5\u591a\u5728\u4e3a","label","\u5efa\u7acb","Vocabulary","\u7684\u60c5\u51b5\u3002",":","param","unknown",":","unknown\u7684\u5b57\u7b26\uff0c\u6240\u6709\u672a\u88ab\u8bb0\u5f55\u7684\u8bcd\u5728\u8f6c\u4e3a",":","class",":","`","int","`","\u65f6\u5c06\u88ab\u89c6\u4e3a","`","unknown","`","\u3002","\u5982\u679c\u8bbe\u7f6e\u4e3a","``","None","``",",","\u5219","vocabulary","\u4e2d\u4e0d\u8003\u8651","`","unknown","`",",","\u4e5f\u4e0d\u8ba1\u5165\u8bcd\u8868\u5927\u5c0f\u3002","\u4e3a","``","None","``","\u7684\u60c5\u51b5\u591a\u5728\u4e3a","labe","l\u5efa\u7acb","Vocabulary","\u7684\u60c5\u51b5"]
docstr: 用来从 pickle 中加载 data
docstr_tok: ["\u7528\u6765\u4ece","pickle","\u4e2d\u52a0\u8f7d","data"]
code: def __getstate__(self):
      r"""
      用来从 pickle 中加载 data
  
      """
      len(self)  # make sure vocab has been built
      state = self.__dict__.copy()
      # no need to pickle _idx2word as it can be constructed from _word2idx
      del state["_idx2word"]
      return state
  
imports: from collections import Counter
  from functools import partial
  from functools import wraps
  from typing import List, Callable, Union
  from fastNLP.core.dataset import DataSet
  from fastNLP.core.utils.utils import Option
  from fastNLP.core.utils.utils import _is_iterable
  from .log import logger
  import io
label_desc: Use image node_id 26 for calling the Vocabulary obj's underlying member method code with example usage: obj.__getstate__() and returns: state