class_docstr: 对 **CWS** 数据进行处理，处理之后 :class:`~fastNLP.core.DataSet` 中的内容如下：
  
  .. csv-table::
     :header: "raw_words", "chars", "target", "seq_len"
  
     "共同  创造  美好...", "[2, 3, 4...]", "[0, 2, 0, 2,...]", 13
     "2001年  新年  钟声...", "[8, 9, 9, 7, ...]", "[0, 1, 1, 1, 2...]", 20
     "...", "[...]","[...]", .
  
  :param dataset_name: data 的名称，支持 ``['pku', 'msra', 'cityu'(繁体), 'as'(繁体), None]``
  :param encoding_type: ``target`` 列使用什么类型的 encoding 方式，支持 ``['bmes', 'segapp']`` 两种。``"我 来自 复旦大学..."`` 这句话 ``bmes``的 
      tag为 ``[S, B, E, B, M, M, E...]`` ； ``segapp`` 的 tag 为 ``[seg, app, seg, app, app, app, seg, ...]`` 。
  :param replace_num_alpha: 是否将数字和字母用特殊字符替换。
  :param bigrams: 是否增加一列 ``bigrams`` 。 ``bigrams`` 会对原文进行如下转化： ``['复', '旦', '大', '学', ...]->["复旦", "旦大", ...]`` 。如果
      设置为 ``True`` ，返回的 :class:`~fastNLP.core.DataSet` 将有一列名为 ``bigrams`` ，且已经转换为了 index 并设置为 input，对应的词表可以通过
      ``data_bundle.get_vocab('bigrams')`` 获取。
  :param trigrams: 是否增加一列 ``trigrams`` 。 ``trigrams`` 会对原文进行如下转化 ``['复', '旦', '大', '学', ...]->["复旦大", "旦大学", ...]`` 。
      如果设置为 ``True`` ，返回的 :class:`~fastNLP.core.DataSet` 将有一列名为 ``trigrams`` ，且已经转换为了 index 并设置为 input，对应的词表可以通过
      ``data_bundle.get_vocab('trigrams')`` 获取。
  :param num_proc: 处理数据时使用的进程数目。
class_docstr_tok: ["\u5bf9","*","*","CWS","*","*","\u6570\u636e\u8fdb\u884c\u5904\u7406\uff0c\u5904\u7406\u4e4b\u540e",":","class",":","`","~fastNLP.core.DataSet","`","\u4e2d\u7684\u5185\u5bb9\u5982\u4e0b\uff1a","..","csv-table",":",":",":","header",":","``","raw_words","''",",","``","chars","''",",","``","target","''",",","``","seq_len","''","``","\u5171\u540c","\u521b\u9020","\u7f8e\u597d","...","''",",","``","[","2",",","3",",","4","...","]","''",",","``","[","0",",","2",",","0",",","2",",","...","]","''",",","13","``","2001\u5e74","\u65b0\u5e74","\u949f\u58f0","...","''",",","``","[","8",",","9",",","9",",","7",",","...","]","''",",","``","[","0",",","1",",","1",",","1",",","2","...","]","''",",","20","``","...","''",",","``","[","...","]","''",",","''","[","...","]","''",",",".",":","param","dataset_name",":","data","\u7684\u540d\u79f0\uff0c\u652f\u6301","``","[","'pku","'",",","'msra","'",",","'cityu","'","(","\u7e41\u4f53",")",",","'as","'","(","\u7e41\u4f53",")",",","None","]","``",":","param","encoding_type",":","``","target","``","\u5217\u4f7f\u7528\u4ec0\u4e48\u7c7b\u578b\u7684","encoding","\u65b9\u5f0f\uff0c\u652f\u6301","``","[","'bmes","'",",","'segapp","'","]","``","\u4e24\u79cd\u3002","``","``","\u6211","\u6765\u81ea","\u590d\u65e6\u5927\u5b66","...","''","``","\u8fd9\u53e5\u8bdd","``","bmes","``","\u7684","tag\u4e3a","``","[","S",",","B",",","E",",","B",",","M",",","M",",","E","...","]","``","\uff1b","``","segapp","``","\u7684","tag","\u4e3a","``","[","seg",",","app",",","seg",",","app",",","app",",","app",",","seg",",","...","]","``","\u3002",":","param","replace_num_alpha",":","\u662f\u5426\u5c06\u6570\u5b57\u548c\u5b57\u6bcd\u7528\u7279\u6b8a\u5b57\u7b26\u66ff\u6362\u3002",":","param","bigrams",":","\u662f\u5426\u589e\u52a0\u4e00\u5217","``","bigrams","``","\u3002","``","bigrams","``","\u4f1a\u5bf9\u539f\u6587\u8fdb\u884c\u5982\u4e0b\u8f6c\u5316\uff1a","``","[","'","\u590d","'",",","'","\u65e6","'",",","'","\u5927","'",",","'","\u5b66","'",",","...","]","-",">","[","``","\u590d\u65e6","''",",","``","\u65e6\u5927","''",",","...","]","``","\u3002\u5982\u679c","\u8bbe\u7f6e\u4e3a","``","True","``","\uff0c\u8fd4\u56de\u7684",":","class",":","`","~fastNLP.core.DataSet","`","\u5c06\u6709\u4e00\u5217\u540d\u4e3a","``","bigrams","``","\uff0c\u4e14\u5df2\u7ecf\u8f6c\u6362\u4e3a\u4e86","index","\u5e76\u8bbe\u7f6e\u4e3a","input\uff0c\u5bf9\u5e94\u7684\u8bcd\u8868\u53ef\u4ee5\u901a\u8fc7","``","data_bundle.get_vocab","(","'bigrams","'",")","``","\u83b7\u53d6\u3002",":","param","trigrams",":","\u662f\u5426\u589e\u52a0\u4e00\u5217","``","trigrams","``","\u3002","``","trigrams","``","\u4f1a\u5bf9\u539f\u6587\u8fdb\u884c\u5982\u4e0b\u8f6c\u5316","``","[","'","\u590d","'",",","'","\u65e6","'",",","'","\u5927","'",",","'","\u5b66","'",",","...","]","-",">","[","``","\u590d\u65e6\u5927","''",",","``","\u65e6\u5927\u5b66","''",",","...","]","``","\u3002","\u5982\u679c\u8bbe\u7f6e\u4e3a","``","True","``","\uff0c\u8fd4\u56de\u7684",":","class",":","`","~fastNLP.core.DataSet","`","\u5c06\u6709\u4e00\u5217\u540d\u4e3a","``","trigrams","``","\uff0c\u4e14\u5df2\u7ecf\u8f6c\u6362\u4e3a\u4e86","index","\u5e76\u8bbe\u7f6e\u4e3a","input\uff0c\u5bf9\u5e94\u7684\u8bcd\u8868\u53ef\u4ee5\u901a\u8fc7","``","data_bundle.get_vocab","(","'trigrams","'",")","``","\u83b7\u53d6\u3002",":","param","num_proc",":","\u5904\u7406\u6570\u636e\u65f6\u4f7f\u7528\u7684\u8fdb\u7a0b\u6570\u76ee\u3002"]
docstr: 传入文件路径，生成处理好的 :class:`~fastNLP.io.DataBundle` 对象。``paths`` 支持的路径形式可以参考 :meth:`fastNLP.io.Loader.load`
  
  :param paths:
  :return:
docstr_tok: ["\u4f20\u5165\u6587\u4ef6\u8def\u5f84\uff0c\u751f\u6210\u5904\u7406\u597d\u7684",":","class",":","`","~fastNLP.io.DataBundle","`","\u5bf9\u8c61\u3002","``","paths","``","\u652f\u6301\u7684\u8def\u5f84\u5f62\u5f0f\u53ef\u4ee5\u53c2\u8003",":","meth",":","`","fastNLP.io.Loader.load","`",":","param","paths",":",":","return",":"]
code: def process_from_file(self, paths=None) -> DataBundle:
      r"""
      传入文件路径，生成处理好的 :class:`~fastNLP.io.DataBundle` 对象。``paths`` 支持的路径形式可以参考 :meth:`fastNLP.io.Loader.load`
  
      :param paths:
      :return:
      """
      if self.dataset_name is None and paths is None:
          raise RuntimeError(
              "You have to set `paths` when calling process_from_file() or `dataset_name `when initialization."
          )
      if self.dataset_name is not None and paths is not None:
          raise RuntimeError(
              "You cannot specify `paths` and `dataset_name` simultaneously"
          )
      data_bundle = CWSLoader(self.dataset_name).load(paths)
      return self.process(data_bundle)
  
file_path: fastNLP/fastNLP/io/pipe/cws.py
imports: import re
  from itertools import chain
  from .pipe import Pipe
  from .utils import _indexize
  from fastNLP.io.data_bundle import DataBundle
  from fastNLP.io.loader import CWSLoader
label_desc: Use image node_id 4 for calling the CWSPipe obj's underlying member method code with example usage: obj.process_from_file(paths) and returns: self