class_docstr: Augmenter that leverage contextual word embeddings to find top n similar word for augmentation.
  
  :param str model_path: Model name or model path. It used transformers to load the model. Tested
      'bert-base-uncased', 'bert-base-cased', 'distilbert-base-uncased', 'roberta-base', 'distilroberta-base',
      'facebook/bart-base', 'squeezebert/squeezebert-uncased'.
  :param str model_type: Type of model. For BERT model, use 'bert'. For RoBERTa/LongFormer model, use 'roberta'. 
      For BART model, use 'bart'. If no value is provided, will determine from model name.
  :param str action: Either 'insert or 'substitute'. If value is 'insert', a new word will be injected to random
      position according to contextual word embeddings calculation. If value is 'substitute', word will be replaced
      according to contextual embeddings calculation
  :param int top_k: Controlling lucky draw pool. Top k score token will be used for augmentation. Larger k, more
      token can be used. Default value is 100. If value is None which means using all possible tokens.
  :param float aug_p: Percentage of word will be augmented.
  :param int aug_min: Minimum number of word will be augmented.
  :param int aug_max: Maximum number of word will be augmented. If None is passed, number of augmentation is
      calculated via aup_p. If calculated result from aug_p is smaller than aug_max, will use calculated result from
      aug_p. Otherwise, using aug_max.
  :param list stopwords: List of words which will be skipped from augment operation. Do NOT include the UNKNOWN word.
      UNKNOWN word of BERT is [UNK]. UNKNOWN word of RoBERTa and BART is <unk>.
  :param str stopwords_regex: Regular expression for matching words which will be skipped from augment operation.
  :param str device: Default value is CPU. If value is CPU, it uses CPU for processing. If value is CUDA, it uses GPU
      for processing. Possible values include 'cuda' and 'cpu'. (May able to use other options)
  :param int batch_size: Batch size.
  :param bool force_reload: Force reload the contextual word embeddings model to memory when initialize the class.
      Default value is False and suggesting to keep it as False if performance is the consideration.
  :param bool silence: Default is True. transformers library will print out warning message when leveraing
      pre-trained model. Set True to disable the expected warning message.
  :param str name: Name of this augmenter
  
  >>> import nlpaug.augmenter.word as naw
  >>> aug = naw.ContextualWordEmbsAug()
class_docstr_tok: ["Augmenter","that","leverage","contextual","word","embeddings","to","find","top","n","similar","word","for","augmentation",".",":","param","str","model_path",":","Model","name","or","model","path",".","It","used","transformers","to","load","the","model",".","Tested","'bert-base-uncased","'",",","'bert-base-cased","'",",","'distilbert-base-uncased","'",",","'roberta-base","'",",","'distilroberta-base","'",",","'facebook\/bart-base","'",",","'squeezebert\/squeezebert-uncased","'",".",":","param","str","model_type",":","Type","of","model",".","For","BERT","model",",","use","'bert","'",".","For","RoBERTa\/LongFormer","model",",","use","'roberta","'",".","For","BART","model",",","use","'bart","'",".","If","no","value","is","provided",",","will","determine","from","model","name",".",":","param","str","action",":","Either","'insert","or","'substitute","'",".","If","value","is","'insert","'",",","a","new","word","will","be","injected","to","random","position","according","to","contextual","word","embeddings","calculation",".","If","value","is","'substitute","'",",","word","will","be","replaced","according","to","contextual","embeddings","calculation",":","param","int","top_k",":","Controlling","lucky","draw","pool",".","Top","k","score","token","will","be","used","for","augmentation",".","Larger","k",",","more","token","can","be","used",".","Default","value","is","100",".","If","value","is","None","which","means","using","all","possible","tokens",".",":","param","float","aug_p",":","Percentage","of","word","will","be","augmented",".",":","param","int","aug_min",":","Minimum","number","of","word","will","be","augmented",".",":","param","int","aug_max",":","Maximum","number","of","word","will","be","augmented",".","If","None","is","passed",",","number","of","augmentation","is","calculated","via","aup_p",".","If","calculated","result","from","aug_p","is","smaller","than","aug_max",",","will","use","calculated","result","from","aug_p",".","Otherwise",",","using","aug_max",".",":","param","list","stopwords",":","List","of","words","which","will","be","skipped","from","augment","operation",".","Do","NOT","include","the","UNKNOWN","word",".","UNKNOWN","word","of","BERT","is","[","UNK","]",".","UNKNOWN","word","of","RoBERTa","and","BART","is","<","unk",">",".",":","param","str","stopwords_regex",":","Regular","expression","for","matching","words","which","will","be","skipped","from","augment","operation",".",":","param","str","device",":","Default","value","is","CPU",".","If","value","is","CPU",",","it","uses","CPU","for","processing",".","If","value","is","CUDA",",","it","uses","GPU","for","processing",".","Possible","values","include","'cuda","'","and","'cpu","'",".","(","May","able","to","use","other","options",")",":","param","int","batch_size",":","Batch","size",".",":","param","bool","force_reload",":","Force","reload","the","contextual","word","embeddings","model","to","memory","when","initialize","the","class",".","Default","value","is","False","and","suggesting","to","keep","it","as","False","if","performance","is","the","consideration",".",":","param","bool","silence",":","Default","is","True",".","transformers","library","will","print","out","warning","message","when","leveraing","pre-trained","model",".","Set","True","to","disable","the","expected","warning","message",".",":","param","str","name",":","Name","of","this","augmenter",">",">",">","import","nlpaug.augmenter.word","as","naw",">",">",">","aug","=","naw.ContextualWordEmbsAug","(",")"]
code: def _build_stop_words(self, stopwords):
      if stopwords:
          prefix_reg = "(?<=\s|\W)"
          suffix_reg = "(?=\s|\W)"
          stopword_reg = (
              "("
              + ")|(".join(
                  [
                      prefix_reg + re.escape(s) + suffix_reg
                      for s in stopwords
                  ]
              )
              + ")"
          )
          self.stopword_reg = re.compile(stopword_reg)
  
          unknown_token = (
              self.model.get_unknown_token() or self.model.UNKNOWN_TOKEN
          )
          reserve_word_reg = (
              "("
              + prefix_reg
              + re.escape(unknown_token)
              + suffix_reg
              + ")"
          )
          self.reserve_word_reg = re.compile(reserve_word_reg)
  
file_path: nlpaug/nlpaug/augmenter/word/context_word_embs.py
imports: import string
  import os
  import re
  import logging
  from nlpaug.augmenter.word import WordAugmenter
  import nlpaug.model.lang_models
  from nlpaug.util import Action, Doc
label_desc: Use image node_id 2 for calling the ContextualWordEmbsAug obj's underlying member method code with example usage: obj._build_stop_words(stopwords) without return types