def compare_new_and_old_templates(origt, newt, pagetitle, pagemsg, errandpagemsg): global args def expand_text(tempcall): return blib.expand_text(tempcall, pagetitle, pagemsg, args.verbose) def generate_old_forms(): return generate_old_adj_forms(origt, errandpagemsg, expand_text, return_raw=True) def generate_new_forms(): new_generate_template = re.sub( r"^\{\{la-adecl\|", "{{User:Benwing2/la-new-generate-adj-forms|", newt) new_result = expand_text(new_generate_template) if not new_result: return None return new_result return blib.compare_new_and_old_template_forms(origt, newt, generate_old_forms, generate_new_forms, pagemsg, errandpagemsg)
def compare_new_and_old_templates(t, pagetitle, pagemsg, errandpagemsg): global args def expand_text(tempcall): return blib.expand_text(tempcall, pagetitle, pagemsg, args.verbose) def generate_old_forms(): old_generate_template = re.sub(r"^\{\{la-conj\|", "{{la-generate-verb-forms|", t) old_result = expand_text(old_generate_template) if not old_result: return None return old_result def generate_new_forms(): new_generate_template = re.sub( r"^\{\{la-conj\|", "{{User:Benwing2/la-new-generate-verb-forms|", t) new_result = expand_text(new_generate_template) if not new_result: return None # Omit linked_* variants, which won't be present in the old forms new_result = "|".join(x for x in new_result.split("|") if not x.startswith("linked_")) return new_result return blib.compare_new_and_old_template_forms(t, t, generate_old_forms, generate_new_forms, pagemsg, errandpagemsg)
def compare_new_and_old_templates(origt, newt, pagetitle, pagemsg, errandpagemsg): global args def expand_text(tempcall): return blib.expand_text(tempcall, pagetitle, pagemsg, args.verbose) def generate_old_forms(): if origt.startswith("{{la-decl-multi|"): old_generate_template = re.sub(r"^\{\{la-decl-multi\|", "{{la-generate-multi-forms|", origt) old_result = expand_text(old_generate_template) if not old_result: return None return old_result else: return generate_old_noun_forms(origt, errandpagemsg, expand_text, return_raw=True) def generate_new_forms(): if newt.startswith("{{la-ndecl|"): new_generate_template = re.sub(r"^\{\{la-ndecl\|", "{{User:Benwing2/la-new-generate-noun-forms|", newt) else: new_generate_template = re.sub(r"^\{\{la-adecl\|", "{{User:Benwing2/la-new-generate-adj-forms|", newt) new_result = expand_text(new_generate_template) if not new_result: return None # Omit linked_* variants, which won't be present in the old forms new_result = "|".join(x for x in new_result.split("|") if not x.startswith("linked_")) return new_result return blib.compare_new_and_old_template_forms(origt, newt, generate_old_forms, generate_new_forms, pagemsg, errandpagemsg)
def compare_new_and_old_templates(origt, newt, pagetitle, pagemsg, errandpagemsg, include_combined): global args def expand_text(tempcall): return blib.expand_text(tempcall, pagetitle, pagemsg, args.verbose) def sort_multiple(v): return ",".join(sorted(v.split(","))) def generate_old_forms(): args = generate_old_verb_forms(origt, errandpagemsg, expand_text, include_combined) if args: args["infinitive"] = pagetitle args = {k: sort_multiple(v) for k, v in args.iteritems()} return args def generate_new_forms(): new_generate_template = re.sub( r"^\{\{es-conj", "{{User:Benwing2/es-generate-verb-forms", newt) new_result = expand_text(new_generate_template) if not new_result: return None args = blib.split_generate_args(new_result) args = { k: v for k, v in args.iteritems() if not k.startswith("neg_") and k != "infinitive_linked" } args = {k: sort_multiple(v) for k, v in args.iteritems()} return args return blib.compare_new_and_old_template_forms(origt, newt, generate_old_forms, generate_new_forms, pagemsg, errandpagemsg, already_split=True, show_all=True)
def compare_new_and_old_templates(t, pagetitle, pagemsg, errandpagemsg): global args def expand_text(tempcall): return blib.expand_text(tempcall, pagetitle, pagemsg, args.verbose) def generate_old_forms(): old_generate_template = re.sub(r"^\{\{bg-ndecl\|", "{{bg-generate-noun-forms|", t) old_generate_template = re.sub(r"^\{\{bg-adecl\|", "{{bg-generate-adj-forms|", old_generate_template) old_result = expand_text(old_generate_template) if not old_result: return None return old_result def generate_new_forms(): new_generate_template = re.sub(r"^\{\{bg-ndecl\|", "{{User:Benwing2/bg-generate-noun-forms|", t) new_generate_template = re.sub(r"^\{\{bg-adecl\|", "{{User:Benwing2/bg-generate-adj-forms|", new_generate_template) new_result = expand_text(new_generate_template) if not new_result: return None return new_result return blib.compare_new_and_old_template_forms(t, t, generate_old_forms, generate_new_forms, pagemsg, errandpagemsg)
def compare_new_and_old_templates(origt, newt, pagetitle, pagemsg, errandpagemsg): global args def expand_text(tempcall): return blib.expand_text(tempcall, pagetitle, pagemsg, args.verbose) def sort_multiple(v): return ",".join(sorted(v.split(","))) def generate_old_forms(): return generate_verb_forms(origt, errandpagemsg, expand_text) def generate_new_forms(): return generate_verb_forms(newt, errandpagemsg, expand_text) return blib.compare_new_and_old_template_forms(origt, newt, generate_old_forms, generate_new_forms, pagemsg, errandpagemsg, already_split=True, show_all=True)