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: 支持的DataSet的field为
  
  .. csv-table::
     :header: "raw_chars", "target"
  
     "[相, 比, 之, 下,...]", "[O, O, O, O, ...]"
     "[青, 岛, 海, 牛, 队, 和, ...]", "[B-ORG, I-ORG, I-ORG, ...]"
     "[...]", "[...]"
  
  raw_chars列为List[str], 是未转换的原始数据; chars列为List[int]，是转换为index的输入数据; target列是List[int]，
  是转换为index的target。返回的DataSet中被设置为input有chars, target, seq_len; 设置为target有target。
  
  :param ~fastNLP.DataBundle data_bundle: 传入的DataBundle中的DataSet必须包含raw_words和ner两个field，且两个field的内容均为List[str]。在传入DataBundle基础上原位修改。
  :return: 处理后的 ``data_bundle``
docstr_tok: ["\u652f\u6301\u7684DataSet\u7684field\u4e3a","..","csv-table",":",":",":","header",":","``","raw_chars","''",",","``","target","''","``","[","\u76f8",",","\u6bd4",",","\u4e4b",",","\u4e0b",",","...","]","''",",","``","[","O",",","O",",","O",",","O",",","...","]","''","``","[","\u9752",",","\u5c9b",",","\u6d77",",","\u725b",",","\u961f",",","\u548c",",","...","]","''",",","``","[","B-ORG",",","I-ORG",",","I-ORG",",","...","]","''","``","[","...","]","''",",","``","[","...","]","''","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\u7684target\u3002\u8fd4\u56de\u7684DataSet\u4e2d\u88ab\u8bbe\u7f6e\u4e3ainput\u6709chars",",","target",",","seq_len",";","\u8bbe\u7f6e\u4e3atarget\u6709target\u3002",":","param","~fastNLP.DataBundle","data_bundle",":","\u4f20\u5165\u7684DataBundle\u4e2d\u7684DataSet\u5fc5\u987b\u5305\u542braw_words\u548cner\u4e24\u4e2afield\uff0c\u4e14\u4e24\u4e2afield\u7684\u5185\u5bb9\u5747\u4e3aList","[","str","]","\u3002\u5728\u4f20\u5165DataBundle\u57fa\u7840\u4e0a\u539f\u4f4d\u4fee\u6539\u3002",":","return",":","\u5904\u7406\u540e\u7684","``","data_bundle","``"]
code: def process(self, data_bundle: DataBundle) -> DataBundle:
      r"""
      支持的DataSet的field为
  
      .. csv-table::
         :header: "raw_chars", "target"
  
         "[相, 比, 之, 下,...]", "[O, O, O, O, ...]"
         "[青, 岛, 海, 牛, 队, 和, ...]", "[B-ORG, I-ORG, I-ORG, ...]"
         "[...]", "[...]"
  
      raw_chars列为List[str], 是未转换的原始数据; chars列为List[int]，是转换为index的输入数据; target列是List[int]，
      是转换为index的target。返回的DataSet中被设置为input有chars, target, seq_len; 设置为target有target。
  
      :param ~fastNLP.DataBundle data_bundle: 传入的DataBundle中的DataSet必须包含raw_words和ner两个field，且两个field的内容均为List[str]。在传入DataBundle基础上原位修改。
      :return: 处理后的 ``data_bundle``
      """
      # 转换tag
      for name, dataset in data_bundle.datasets.items():
          dataset.apply_field(
              self.convert_tag,
              field_name="target",
              new_field_name="target",
              num_proc=self.num_proc,
          )
  
      _add_chars_field(data_bundle, lower=False)
  
      input_field_names = ["chars"]
  
      def bigrams(chars):
          return [
              c1 + c2 for c1, c2 in zip(chars, chars[1:] + ["<eos>"])
          ]
  
      def trigrams(chars):
          return [
              c1 + c2 + c3
              for c1, c2, c3 in zip(
                  chars,
                  chars[1:] + ["<eos>"],
                  chars[2:] + ["<eos>"] * 2,
              )
          ]
  
      if self.bigrams:
          for name, dataset in data_bundle.iter_datasets():
              dataset.apply_field(
                  bigrams,
                  field_name="chars",
                  new_field_name="bigrams",
                  num_proc=self.num_proc,
              )
          input_field_names.append("bigrams")
      if self.trigrams:
          for name, dataset in data_bundle.datasets.items():
              dataset.apply_field(
                  trigrams,
                  field_name="chars",
                  new_field_name="trigrams",
                  num_proc=self.num_proc,
              )
          input_field_names.append("trigrams")
  
      # index
      _indexize(data_bundle, input_field_names, "target")
  
      for name, dataset in data_bundle.iter_datasets():
          dataset.add_seq_len("chars")
  
      return data_bundle
  
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 2 for calling the _CNNERPipe obj's underlying member method code with example usage: obj.process(data_bundle) and returns: data_bundle, unknown, unknown