class_docstr: ChnSentiCorp is a dataset for chinese sentiment classification,
  which was published by Tan Songbo at ICT of Chinese Academy of Sciences.
docstr: Args:
      tokenizer (:obj:`BertTokenizer` or `CustomTokenizer`):
          It tokenizes the text and encodes the data as model needed.
      max_seq_len (:obj:`int`, `optional`, defaults to :128):
          The maximum length (in number of tokens) for the inputs to the selected module,
          such as ernie, bert and so on.
      mode (:obj:`str`, `optional`, defaults to `train`):
          It identifies the dataset mode (train, test or dev).
  Examples:
      .. code-block:: python
          import paddlehub as hub
  
          tokenizer = hub.BertTokenizer(vocab_file='./vocab.txt')
          train_dataset = hub.datasets.ChnSentiCorp(tokenizer=tokenizer, max_seq_len=120, mode='train')
          dev_dataset = hub.datasets.ChnSentiCorp(tokenizer=tokenizer, max_seq_len=120, mode='dev')
          test_dataset = hub.datasets.ChnSentiCorp(tokenizer=tokenizer, max_seq_len=120, mode='test')
docstr_tok: ["Args",":","tokenizer","(",":","obj",":","`","BertTokenizer","`","or","`","CustomTokenizer","`",")",":","It","tokenizes","the","text","and","encodes","the","data","as","model","needed",".","max_seq_len","(",":","obj",":","`","int","`",",","`","optional","`",",","defaults","to",":128",")",":","The","maximum","length","(","in","number","of","tokens",")","for","the","inputs","to","the","selected","module",",","such","as","ernie",",","bert","and","so","on",".","mode","(",":","obj",":","`","str","`",",","`","optional","`",",","defaults","to","`","train","`",")",":","It","identifies","the","dataset","mode","(","train",",","test","or","dev",")",".","Examples",":","..","code-block",":",":","python","import","paddlehub","as","hub","tokenizer","=","hub.BertTokenizer","(","vocab_file='.\/vocab.txt","'",")","train_dataset","=","hub.datasets.ChnSentiCorp","(","tokenizer=tokenizer",",","max_seq_len=120",",","mode='train","'",")","dev_dataset","=","hub.datasets.ChnSentiCorp","(","tokenizer=tokenizer",",","max_seq_len=120",",","mode='dev","'",")","test_dataset","=","hub.datasets.ChnSentiCorp","(","tokenizer=tokenizer",",","max_seq_len=120",",","mode='test","'",")"]
code: def __init__(
      self,
      tokenizer: Union[BertTokenizer, CustomTokenizer],
      max_seq_len: int = 128,
      mode: str = "train",
  ):
      """
      Args:
          tokenizer (:obj:`BertTokenizer` or `CustomTokenizer`):
              It tokenizes the text and encodes the data as model needed.
          max_seq_len (:obj:`int`, `optional`, defaults to :128):
              The maximum length (in number of tokens) for the inputs to the selected module,
              such as ernie, bert and so on.
          mode (:obj:`str`, `optional`, defaults to `train`):
              It identifies the dataset mode (train, test or dev).
      Examples:
          .. code-block:: python
              import paddlehub as hub
  
              tokenizer = hub.BertTokenizer(vocab_file='./vocab.txt')
              train_dataset = hub.datasets.ChnSentiCorp(tokenizer=tokenizer, max_seq_len=120, mode='train')
              dev_dataset = hub.datasets.ChnSentiCorp(tokenizer=tokenizer, max_seq_len=120, mode='dev')
              test_dataset = hub.datasets.ChnSentiCorp(tokenizer=tokenizer, max_seq_len=120, mode='test')
  
      """
      base_path = os.path.join(DATA_HOME, "chnsenticorp")
      if mode == "train":
          data_file = "train.tsv"
      elif mode == "test":
          data_file = "test.tsv"
      else:
          data_file = "dev.tsv"
      super().__init__(
          base_path=base_path,
          tokenizer=tokenizer,
          max_seq_len=max_seq_len,
          mode=mode,
          data_file=data_file,
          label_list=["0", "1"],
          is_file_with_header=True,
      )
  
file_path: PaddleHub/paddlehub/datasets/chnsenticorp.py
imports: from typing import Dict, List, Optional, Union, Tuple
  import os
  from paddlehub.env import DATA_HOME
  from paddlehub.utils.download import download_data
  from paddlehub.datasets.base_nlp_dataset import TextClassificationDataset
  from paddlehub.text.bert_tokenizer import BertTokenizer
  from paddlehub.text.tokenizer import CustomTokenizer
label_desc: Use image node_id 1 to create a new ChnSentiCorp object from inherited base classes: TextClassificationDataset with example: obj = ChnSentiCorp(tokenizer, max_seq_len, mode)