def get_string_rules(source, target):
  """Return string seed rules based on exact match."""
  rules = set()
  for prefix in ("PersonName", "String", "LocationKeyphrase", "Month",
                 "DayOfWeek"):
    regex = r'%s " (.+?) "' % prefix
    matches = re.findall(regex, target)
    for match in matches:
      source_rhs = string_utils.format_source(match)
      if source_rhs.lower() not in source.lower():
        print("`%s` is not in `%s`." % (source_rhs, source))
        continue
      target_rhs = '%s " %s "' % (prefix, match)
      rules.add(
          qcfg_rule.QCFGRule(
              tuple(source_rhs.split(" ")), tuple(target_rhs.split(" ")), 0))
  return rules
Return string seed rules based on exact match.
language/compgen/csl/tasks/smcalflow/tools/generate_identity_rules.py