A1="Women is the plural of woman." A2="Up is the opposite of down." A3="Cain is the brother of Abel." =_1_is_the_2_of_?.("women", "plural", A1:A3) -> "woman" =_1_is_the_2_of_?.("up", "opposite", A1:A3) -> "down" =_1_is_the_2_of_?.("Cain", "brother", A1:A3) -> "Abel"
DEFINE(
_1_is_the_2_of_?.,
LAMBDA(
_1,
_2,
knowledgebase,
LET(
fragment,
FORMAT(
"{1} is the {2} of ",
CAPITALIZE(_1),
_2),
knowledgecolumn,
TOCOL(knowledgebase),
matches,
FILTER(
knowledgecolumn,
BEGINSWITH?(
knowledgecolumn,
fragment)),
IF(
ISERROR(matches),
FALSE,
TRIMALL(
REGEXEXTRACT(
matches,
FORMAT(
"^{1} is the {2} of (.+)\.$",
CAPITALIZE(_1),
_2),
2))))))
Help us optimize this function