class_docstr: An implementation of the attack used in "Beyond Accuracy: Behavioral
  Testing of NLP models with CheckList", Ribeiro et al., 2020.
  
  This attack focuses on a number of attacks used in the Invariance Testing
  Method: Contraction, Extension, Changing Names, Number, Location
  
  https://arxiv.org/abs/2005.04118
class_docstr_tok: ["An","implementation","of","the","attack","used","in","``","Beyond","Accuracy",":","Behavioral","Testing","of","NLP","models","with","CheckList","''",",","Ribeiro","et","al.",",","2020",".","This","attack","focuses","on","a","number","of","attacks","used","in","the","Invariance","Testing","Method",":","Contraction",",","Extension",",","Changing","Names",",","Number",",","Location","https",":","\/\/arxiv.org\/abs\/2005.04118"]
code: def build(model_wrapper):
      transformation = CompositeTransformation(
          [
              ChineseWordSwapHowNet(),
              ChineseWordSwapMaskedLM(),
              ChineseMorphonymCharacterSwap(),
              ChineseHomophoneCharacterSwap(),
          ]
      )
  
      stopwords = CHN_STOPWORD.union(set(string.punctuation))
  
      # Need this constraint to prevent extend and contract modifying each others' changes and forming infinite loop
      constraints = [
          RepeatModification(),
          StopwordModification(stopwords=stopwords),
      ]
  
      # Untargeted attack & Greedy search with weighted saliency
      goal_function = UntargetedClassification(model_wrapper)
      search_method = GreedyWordSwapWIR(wir_method="weighted-saliency")
  
      return Attack(
          goal_function, constraints, transformation, search_method
      )
  
file_path: TextAttack/textattack/attack_recipes/chinese_recipe.py
imports: import string
  from textattack import Attack
  from textattack.constraints.pre_transformation import RepeatModification, StopwordModification
  from textattack.goal_functions import UntargetedClassification
  from textattack.search_methods import GreedyWordSwapWIR
  from textattack.shared.data import CHN_STOPWORD
  from textattack.transformations import ChineseHomophoneCharacterSwap, ChineseMorphonymCharacterSwap, ChineseWordSwapHowNet, ChineseWordSwapMaskedLM, CompositeTransformation
  from .attack_recipe import AttackRecipe
label_desc: Use image node_id 1 for calling the ChineseRecipe obj's underlying member method code with example usage: obj.build(model_wrapper) and returns: Attack