class_docstr: Bert-base Model preprocessor.
class_docstr_tok: ["Bert-base","Model","preprocessor","."]
docstr: Bert-base Model preprocessor.
  
  Example:
      >>> import matchzoo as mz
      >>> train_data = mz.datasets.toy.load_data()
      >>> test_data = mz.datasets.toy.load_data(stage='test')
      >>> # The argument 'bert_vocab_path' must feed the bert vocab path
      >>> bert_preprocessor = mz.preprocessors.BertPreprocessor(
      ...     bert_vocab_path=
      ...     'matchzoo/datasets/bert_resources/uncased_vocab_100.txt')
      >>> train_data_processed = bert_preprocessor.fit_transform(
      ...     train_data)
      >>> test_data_processed = bert_preprocessor.transform(test_data)
docstr_tok: ["Bert-base","Model","preprocessor",".","Example",":",">",">",">","import","matchzoo","as","mz",">",">",">","train_data","=","mz.datasets.toy.load_data","(",")",">",">",">","test_data","=","mz.datasets.toy.load_data","(","stage='test","'",")",">",">",">","#","The","argument","'bert_vocab_path","'","must","feed","the","bert","vocab","path",">",">",">","bert_preprocessor","=","mz.preprocessors.BertPreprocessor","(","...","bert_vocab_path=","...","'matchzoo\/datasets\/bert_resources\/uncased_vocab_100.txt","'",")",">",">",">","train_data_processed","=","bert_preprocessor.fit_transform","(","...","train_data",")",">",">",">","test_data_processed","=","bert_preprocessor.transform","(","test_data",")"]
code: def __init__(
      self,
      bert_vocab_path: str,
      fixed_length_left: int = 30,
      fixed_length_right: int = 30,
      filter_mode: str = "df",
      filter_low_freq: float = 2,
      filter_high_freq: float = float("inf"),
      remove_stop_words: bool = False,
      lower_case: bool = True,
      chinese_version: bool = False,
  ):
      """
      Bert-base Model preprocessor.
  
      Example:
          >>> import matchzoo as mz
          >>> train_data = mz.datasets.toy.load_data()
          >>> test_data = mz.datasets.toy.load_data(stage='test')
          >>> # The argument 'bert_vocab_path' must feed the bert vocab path
          >>> bert_preprocessor = mz.preprocessors.BertPreprocessor(
          ...     bert_vocab_path=
          ...     'matchzoo/datasets/bert_resources/uncased_vocab_100.txt')
          >>> train_data_processed = bert_preprocessor.fit_transform(
          ...     train_data)
          >>> test_data_processed = bert_preprocessor.transform(test_data)
  
      """
      super().__init__()
      self._fixed_length_left = fixed_length_left
      self._fixed_length_right = fixed_length_right
      self._bert_vocab_path = bert_vocab_path
      self._left_fixedlength_unit = units.FixedLength(
          self._fixed_length_left, pad_mode="post"
      )
      self._right_fixedlength_unit = units.FixedLength(
          self._fixed_length_right, pad_mode="post"
      )
      self._filter_unit = units.FrequencyFilter(
          low=filter_low_freq, high=filter_high_freq, mode=filter_mode
      )
      self._units = self._default_units()
      self._vocab_unit = built_bert_vocab_unit(self._bert_vocab_path)
  
      if chinese_version:
          self._units.insert(1, units.ChineseTokenize())
      if lower_case:
          self._units.append(units.Lowercase())
          self._units.append(units.StripAccent())
      self._units.append(
          units.WordPieceTokenize(self._vocab_unit.state["term_index"])
      )
      if remove_stop_words:
          self._units.append(units.StopRemoval())
  
file_path: MatchZoo/matchzoo/preprocessors/bert_preprocessor.py
imports: from tqdm import tqdm
  from .None import units
  from .chain_transform import chain_transform
  from matchzoo import DataPack
  from matchzoo.engine.base_preprocessor import BasePreprocessor
  from .build_vocab_unit import built_bert_vocab_unit
  from .build_unit_from_data_pack import build_unit_from_data_pack
label_desc: Use image node_id 1 to create a new BertPreprocessor object from inherited base classes: BasePreprocessor with example: obj = BertPreprocessor(bert_vocab_path, fixed_length_left, fixed_length_right, filter_mode, filter_low_freq, filter_high_freq, remove_stop_words, lower_case, chinese_version)