def infer_rule(words): data = phonosynth.parse(words) change = phonosynth.infer_change(data) rules = phonosynth.infer_rule(data, change) response = [] for rule in rules: if rule: change, (left, target, right) = rule response.append( ipa_data.format_rule(target, { 'left': left, 'right': right }, change)) return response
def get_rules(words): data = phonosynth.parse(words) changes = phonosynth.infer_change(data) rules = phonosynth.infer_rule(data, changes) return rules