class_docstr: 中文NER任务的处理Pipe, 该Pipe会（1）复制raw_chars列，并命名为chars; (2）在chars, target列建立词表
  (创建 :class:`fastNLP.Vocabulary` 对象，所以在返回的DataBundle中将有两个Vocabulary); (3）将chars，target列根据相应的
  Vocabulary转换为index。
  
  raw_chars列为List[str], 是未转换的原始数据; chars列为List[int]，是转换为index的输入数据; target列是List[int]，是转换为index的
  target。返回的DataSet中被设置为input有chars, target, seq_len; 设置为target有target, seq_len。
class_docstr_tok: ["\u4e2d\u6587NER\u4efb\u52a1\u7684\u5904\u7406Pipe",",","\u8be5Pipe\u4f1a\uff081\uff09\u590d\u5236raw_chars\u5217\uff0c\u5e76\u547d\u540d\u4e3achars",";","(","2\uff09\u5728chars",",","target\u5217\u5efa\u7acb\u8bcd\u8868","(","\u521b\u5efa",":","class",":","`","fastNLP.Vocabulary","`","\u5bf9\u8c61\uff0c\u6240\u4ee5\u5728\u8fd4\u56de\u7684DataBundle\u4e2d\u5c06\u6709\u4e24\u4e2aVocabulary",")",";","(","3\uff09\u5c06chars\uff0ctarget\u5217\u6839\u636e\u76f8\u5e94\u7684","Vocabulary\u8f6c\u6362\u4e3aindex\u3002","raw_chars\u5217\u4e3aList","[","str","]",",","\u662f\u672a\u8f6c\u6362\u7684\u539f\u59cb\u6570\u636e",";","chars\u5217\u4e3aList","[","int","]","\uff0c\u662f\u8f6c\u6362\u4e3aindex\u7684\u8f93\u5165\u6570\u636e",";","target\u5217\u662fList","[","int","]","\uff0c\u662f\u8f6c\u6362\u4e3aindex\u7684","target\u3002\u8fd4\u56de\u7684DataSet\u4e2d\u88ab\u8bbe\u7f6e\u4e3ainput\u6709chars",",","target",",","seq_len",";","\u8bbe\u7f6e\u4e3atarget\u6709target",",","seq_len\u3002"]
docstr: :param str encoding_type: target列使用什么类型的encoding方式，支持bioes, bio两种。
  :param bool bigrams: 是否增加一列bigrams. bigrams的构成是['复', '旦', '大', '学', ...]->["复旦", "旦大", ...]。如果
      设置为True，返回的DataSet将有一列名为bigrams, 且已经转换为了index并设置为input，对应的vocab可以通过
      data_bundle.get_vocab('bigrams')获取.
  :param bool trigrams: 是否增加一列trigrams. trigrams的构成是 ['复', '旦', '大', '学', ...]->["复旦大", "旦大学", ...]
      。如果设置为True，返回的DataSet将有一列名为trigrams, 且已经转换为了index并设置为input，对应的vocab可以通过
      data_bundle.get_vocab('trigrams')获取.
docstr_tok: [":","param","str","encoding_type",":","target\u5217\u4f7f\u7528\u4ec0\u4e48\u7c7b\u578b\u7684encoding\u65b9\u5f0f\uff0c\u652f\u6301bioes",",","bio\u4e24\u79cd\u3002",":","param","bool","bigrams",":","\u662f\u5426\u589e\u52a0\u4e00\u5217bigrams",".","bigrams\u7684\u6784\u6210\u662f","[","'","\u590d","'",",","'","\u65e6","'",",","'","\u5927","'",",","'","\u5b66","'",",","...","]","-",">","[","``","\u590d\u65e6","''",",","``","\u65e6\u5927","''",",","...","]","\u3002\u5982\u679c","\u8bbe\u7f6e\u4e3aTrue\uff0c\u8fd4\u56de\u7684DataSet\u5c06\u6709\u4e00\u5217\u540d\u4e3abigrams",",","\u4e14\u5df2\u7ecf\u8f6c\u6362\u4e3a\u4e86index\u5e76\u8bbe\u7f6e\u4e3ainput\uff0c\u5bf9\u5e94\u7684vocab\u53ef\u4ee5\u901a\u8fc7","data_bundle.get_vocab","(","'bigrams","'",")","\u83b7\u53d6",".",":","param","bool","trigrams",":","\u662f\u5426\u589e\u52a0\u4e00\u5217trigrams",".","trigrams\u7684\u6784\u6210\u662f","[","'","\u590d","'",",","'","\u65e6","'",",","'","\u5927","'",",","'","\u5b66","'",",","...","]","-",">","[","``","\u590d\u65e6\u5927","''",",","``","\u65e6\u5927\u5b66","''",",","...","]","\u3002\u5982\u679c\u8bbe\u7f6e\u4e3aTrue\uff0c\u8fd4\u56de\u7684DataSet\u5c06\u6709\u4e00\u5217\u540d\u4e3atrigrams",",","\u4e14\u5df2\u7ecf\u8f6c\u6362\u4e3a\u4e86index\u5e76\u8bbe\u7f6e\u4e3ainput\uff0c\u5bf9\u5e94\u7684vocab\u53ef\u4ee5\u901a\u8fc7","data_bundle.get_vocab","(","'trigrams","'",")","\u83b7\u53d6","."]
code: def __init__(
      self,
      encoding_type: str = "bio",
      bigrams=False,
      trigrams=False,
      num_proc: int = 0,
  ):
      r"""
  
      :param str encoding_type: target列使用什么类型的encoding方式，支持bioes, bio两种。
      :param bool bigrams: 是否增加一列bigrams. bigrams的构成是['复', '旦', '大', '学', ...]->["复旦", "旦大", ...]。如果
          设置为True，返回的DataSet将有一列名为bigrams, 且已经转换为了index并设置为input，对应的vocab可以通过
          data_bundle.get_vocab('bigrams')获取.
      :param bool trigrams: 是否增加一列trigrams. trigrams的构成是 ['复', '旦', '大', '学', ...]->["复旦大", "旦大学", ...]
          。如果设置为True，返回的DataSet将有一列名为trigrams, 且已经转换为了index并设置为input，对应的vocab可以通过
          data_bundle.get_vocab('trigrams')获取.
      """
      if encoding_type == "bio":
          self.convert_tag = iob2
      elif encoding_type == "bioes":
  
          def func(words):
              return iob2bioes(iob2(words))
  
          # self.convert_tag = lambda words: iob2bioes(iob2(words))
          self.convert_tag = func
      else:
          raise ValueError(
              "encoding_type only supports `bio` and `bioes`."
          )
  
      self.bigrams = bigrams
      self.trigrams = trigrams
      self.num_proc = num_proc
  
imports: from .pipe import Pipe
  from .utils import _add_chars_field
  from .utils import _indexize, _add_words_field
  from .utils import iob2, iob2bioes
  from fastNLP.io.data_bundle import DataBundle
  from ..loader.conll import Conll2003NERLoader, OntoNotesNERLoader
  from ..loader.conll import PeopleDailyNERLoader, WeiboNERLoader, MsraNERLoader, ConllLoader
  from ...core.vocabulary import Vocabulary
label_desc: Use image node_id 1 to create a new _CNNERPipe object from inherited base classes: Pipe with example: obj = _CNNERPipe(encoding_type, bigrams, trigrams, num_proc)