class_docstr: **Chinese word segmentor** 的 **Loader** 。如果您使用了该数据集，请引用以下的文章：Thomas Emerson, The Second International Chinese Word Segmentation Bakeoff,
  2005. 更多信息可以在 http://sighan.cs.uchicago.edu/bakeoff2005/ 查看。
  
  :class:`CWSLoader` 支持的数据格式为：一行一句话，不同词之间用空格隔开，例如::
  
      上海 浦东 开发 与 法制 建设 同步
      新华社 上海 二月 十日 电 （ 记者 谢金虎 、 张持坚 ）
      ...
  
  读取的 :class:`~fastNLP.core.DataSet` 将具备以下的数据结构：
  
  .. csv-table::
     :header: "raw_words"
  
     "上海 浦东 开发 与 法制 建设 同步"
     "新华社 上海 二月 十日 电 （ 记者 谢金虎 、 张持坚 ）"
     "..."
  
  :param dataset_name: data 的名称，支持 ``['pku', 'msra', 'cityu'(繁体), 'as'(繁体), None]``
class_docstr_tok: ["*","*","Chinese","word","segmentor","*","*","\u7684","*","*","Loader","*","*","\u3002\u5982\u679c\u60a8\u4f7f\u7528\u4e86\u8be5\u6570\u636e\u96c6\uff0c\u8bf7\u5f15\u7528\u4ee5\u4e0b\u7684\u6587\u7ae0\uff1aThomas","Emerson",",","The","Second","International","Chinese","Word","Segmentation","Bakeoff",",","2005",".","\u66f4\u591a\u4fe1\u606f\u53ef\u4ee5\u5728","http",":","\/\/sighan.cs.uchicago.edu\/bakeoff2005\/","\u67e5\u770b\u3002",":","class",":","`","CWSLoader","`","\u652f\u6301\u7684\u6570\u636e\u683c\u5f0f\u4e3a\uff1a\u4e00\u884c\u4e00\u53e5\u8bdd\uff0c\u4e0d\u540c\u8bcd\u4e4b\u95f4\u7528\u7a7a\u683c\u9694\u5f00\uff0c\u4f8b\u5982",":",":","\u4e0a\u6d77","\u6d66\u4e1c","\u5f00\u53d1","\u4e0e","\u6cd5\u5236","\u5efa\u8bbe","\u540c\u6b65","\u65b0\u534e\u793e","\u4e0a\u6d77","\u4e8c\u6708","\u5341\u65e5","\u7535","\uff08","\u8bb0\u8005","\u8c22\u91d1\u864e","\u3001","\u5f20\u6301\u575a","\uff09","...","\u8bfb\u53d6\u7684",":","class",":","`","~fastNLP.core.DataSet","`","\u5c06\u5177\u5907\u4ee5\u4e0b\u7684\u6570\u636e\u7ed3\u6784\uff1a","..","csv-table",":",":",":","header",":","``","raw_words","''","``","\u4e0a\u6d77","\u6d66\u4e1c","\u5f00\u53d1","\u4e0e","\u6cd5\u5236","\u5efa\u8bbe","\u540c\u6b65","''","``","\u65b0\u534e\u793e","\u4e0a\u6d77","\u4e8c\u6708","\u5341\u65e5","\u7535","\uff08","\u8bb0\u8005","\u8c22\u91d1\u864e","\u3001","\u5f20\u6301\u575a","\uff09","''","``","...","''",":","param","dataset_name",":","data","\u7684\u540d\u79f0\uff0c\u652f\u6301","``","[","'pku","'",",","'msra","'",",","'cityu","'","(","\u7e41\u4f53",")",",","'as","'","(","\u7e41\u4f53",")",",","None","]","``"]
docstr: 自动下载数据集。
  
  :param dev_ratio: 如果路径中没有验证集，从 train 划分多少作为 dev 的数据。 如果为 **0** ，则不划分 dev
  :param re_download: 是否重新下载数据，以重新切分数据。
  :return: 数据集的目录地址
docstr_tok: ["\u81ea\u52a8\u4e0b\u8f7d\u6570\u636e\u96c6\u3002",":","param","dev_ratio",":","\u5982\u679c\u8def\u5f84\u4e2d\u6ca1\u6709\u9a8c\u8bc1\u96c6\uff0c\u4ece","train","\u5212\u5206\u591a\u5c11\u4f5c\u4e3a","dev","\u7684\u6570\u636e\u3002","\u5982\u679c\u4e3a","*","*","0","*","*","\uff0c\u5219\u4e0d\u5212\u5206","dev",":","param","re_download",":","\u662f\u5426\u91cd\u65b0\u4e0b\u8f7d\u6570\u636e\uff0c\u4ee5\u91cd\u65b0\u5207\u5206\u6570\u636e\u3002",":","return",":","\u6570\u636e\u96c6\u7684\u76ee\u5f55\u5730\u5740"]
code: def download(self, dev_ratio=0.1, re_download=False) -> str:
      r"""
      自动下载数据集。
  
      :param dev_ratio: 如果路径中没有验证集，从 train 划分多少作为 dev 的数据。 如果为 **0** ，则不划分 dev
      :param re_download: 是否重新下载数据，以重新切分数据。
      :return: 数据集的目录地址
      """
      if self.dataset_name is None:
          return ""
      data_dir = self._get_dataset_path(dataset_name=self.dataset_name)
      modify_time = 0
      for filepath in glob.glob(os.path.join(data_dir, "*")):
          modify_time = os.stat(filepath).st_mtime
          break
      if (
          time.time() - modify_time > 1 and re_download
      ):  # 通过这种比较丑陋的方式判断一下文件是否是才下载的
          shutil.rmtree(data_dir)
          data_dir = self._get_dataset_path(
              dataset_name=self.dataset_name
          )
  
      if not os.path.exists(os.path.join(data_dir, "dev.txt")):
          if dev_ratio > 0:
              assert (
                  0 < dev_ratio < 1
              ), "dev_ratio should be in range (0,1)."
              try:
                  with open(
                      os.path.join(data_dir, "train.txt"),
                      "r",
                      encoding="utf-8",
                  ) as f, open(
                      os.path.join(data_dir, "middle_file.txt"),
                      "w",
                      encoding="utf-8",
                  ) as f1, open(
                      os.path.join(data_dir, "dev.txt"),
                      "w",
                      encoding="utf-8",
                  ) as f2:
                      for line in f:
                          if random.random() < dev_ratio:
                              f2.write(line)
                          else:
                              f1.write(line)
                  os.remove(os.path.join(data_dir, "train.txt"))
                  os.renames(
                      os.path.join(data_dir, "middle_file.txt"),
                      os.path.join(data_dir, "train.txt"),
                  )
              finally:
                  if os.path.exists(
                      os.path.join(data_dir, "middle_file.txt")
                  ):
                      os.remove(
                          os.path.join(data_dir, "middle_file.txt")
                      )
  
      return data_dir
  
file_path: fastNLP/fastNLP/io/loader/cws.py
imports: import glob
  import os
  import random
  import shutil
  import time
  from .loader import Loader
  from fastNLP.core.dataset import DataSet, Instance
label_desc: Use image node_id 3 for calling the CWSLoader obj's underlying member method code with example usage: obj.download(dev_ratio, re_download) and returns: data_dir, str