docstr: Change city and country names
  
  Parameters
  ----------
  doc : spacy.token.Doc
      input
  meta : bool
      if True, will return list of (orig_loc, new_loc) as meta
  seed : int
      random seed
  n : int
      number of locations to replace original locations with
  
  Returns
  -------
  list(str)
      if meta=True, returns (list(str), list(tuple))
      Strings with locations replaced.
docstr_tok: ["Change","city","and","country","names","Parameters","--","--","--","--","--","doc",":","spacy.token.Doc","input","meta",":","bool","if","True",",","will","return","list","of","(","orig_loc",",","new_loc",")","as","meta","seed",":","int","random","seed","n",":","int","number","of","locations","to","replace","original","locations","with","Returns","--","--","--","-","list","(","str",")","if","meta=True",",","returns","(","list","(","str",")",",","list","(","tuple",")",")","Strings","with","locations","replaced","."]
code: def change_location(doc, meta=False, seed=None, n=10):
      """Change city and country names
  
      Parameters
      ----------
      doc : spacy.token.Doc
          input
      meta : bool
          if True, will return list of (orig_loc, new_loc) as meta
      seed : int
          random seed
      n : int
          number of locations to replace original locations with
  
      Returns
      -------
      list(str)
          if meta=True, returns (list(str), list(tuple))
          Strings with locations replaced.
  
      """
      if seed is not None:
          np.random.seed(seed)
      ents = [
          x.text
          for x in doc.ents
          if np.all([a.ent_type_ == "GPE" for a in x])
      ]
      ret = []
      ret_m = []
      for x in ents:
          if x in Perturb.data["city"]:
              names = Perturb.data["city"][:100]
          elif x in Perturb.data["country"]:
              names = Perturb.data["country"][:50]
          else:
              continue
          sub_re = re.compile(r"\b%s\b" % re.escape(x))
          to_use = np.random.choice(names, n)
          ret.extend([sub_re.sub(n, doc.text) for n in to_use])
          ret_m.extend([(x, n) for n in to_use])
      return process_ret(ret, ret_m=ret_m, n=n, meta=meta)
  
imports: import numpy
  import collections
  import re
  import os
  import json
  import pattern
  from pattern.en import tenses
  from .editor import recursive_apply, MunchWithAdd
label_desc: Use image node_id 11 for calling the Perturb obj's underlying member method code with example usage: obj.change_location(doc, meta, seed, n) and returns: process_ret