docstr: Transforms an input by replacing names of recognized name entity.
  
  :param n: Number of new names to generate per name detected
  :param first_only: Whether to change first name only
  :param last_only: Whether to change last name only
  :param confidence_score: Name will only be changed when it's above confidence score
  :param consistent: Whether to change all instances of the same name to the same new name
  >>> from textattack.transformations import WordSwapChangeName
  >>> from textattack.augmentation import Augmenter
  
  >>> transformation = WordSwapChangeName()
  >>> augmenter = Augmenter(transformation=transformation)
  >>> s = 'I am John Smith.'
  >>> augmenter.augment(s)
docstr_tok: ["Transforms","an","input","by","replacing","names","of","recognized","name","entity",".",":","param","n",":","Number","of","new","names","to","generate","per","name","detected",":","param","first_only",":","Whether","to","change","first","name","only",":","param","last_only",":","Whether","to","change","last","name","only",":","param","confidence_score",":","Name","will","only","be","changed","when","it","'s","above","confidence","score",":","param","consistent",":","Whether","to","change","all","instances","of","the","same","name","to","the","same","new","name",">",">",">","from","textattack.transformations","import","WordSwapChangeName",">",">",">","from","textattack.augmentation","import","Augmenter",">",">",">","transformation","=","WordSwapChangeName","(",")",">",">",">","augmenter","=","Augmenter","(","transformation=transformation",")",">",">",">","s","=","'","I","am","John","Smith",".","'",">",">",">","augmenter.augment","(","s",")"]
code: def __init__(
      self,
      num_name_replacements=3,
      first_only=False,
      last_only=False,
      confidence_score=0.7,
      language="en",
      consistent=False,
      **kwargs,
  ):
      """Transforms an input by replacing names of recognized name entity.
  
      :param n: Number of new names to generate per name detected
      :param first_only: Whether to change first name only
      :param last_only: Whether to change last name only
      :param confidence_score: Name will only be changed when it's above confidence score
      :param consistent: Whether to change all instances of the same name to the same new name
      >>> from textattack.transformations import WordSwapChangeName
      >>> from textattack.augmentation import Augmenter
  
      >>> transformation = WordSwapChangeName()
      >>> augmenter = Augmenter(transformation=transformation)
      >>> s = 'I am John Smith.'
      >>> augmenter.augment(s)
      """
      super().__init__(**kwargs)
      self.num_name_replacements = num_name_replacements
      if first_only & last_only:
          raise ValueError(
              "first_only and last_only cannot both be true"
          )
      self.first_only = first_only
      self.last_only = last_only
      self.confidence_score = confidence_score
      self.language = language
      self.consistent = consistent
  
file_path: TextAttack/textattack/transformations/word_swaps/word_swap_change_name.py
imports: from collections import defaultdict
  import numpy
  from textattack.shared.data import PERSON_NAMES
  from .word_swap import WordSwap
label_desc: Use image node_id 1 to create a new WordSwapChangeName object from inherited base classes: WordSwap with example: obj = WordSwapChangeName(num_name_replacements, first_only, last_only, confidence_score, language, consistent)