A1="Fish are friends." =_1_is_2_if_3_are_4.("water", "wet", "fish", "friends", A1) -> "Water is wet." =_1_is_2_if_3_are_4.("water", "wet", "fish", "food", A1) -> "Water is not wet."
DEFINE(
_1_is_2_if_3_are_4.,
LAMBDA(
_1,
_2,
_3,
_4,
knowledgebase,
LET(
affirmation,
CONTAINS(
knowledgebase,
FORMAT(
"{1} are {2}.",
CAPITALIZE(_3),
_4)),
negation,
CONTAINS(
knowledgebase,
FORMAT(
"{1} are not {2}.",
CAPITALIZE(_3),
_4)),
template,
IFS(
AND(
affirmation,
negation),
"{1} simultaneously is and is not {2}.",
affirmation,
"{1} is {2}.",
negation,
"{1} is not {2}.",
OTHERWISE,
"Unknown."),
FORMAT(
template,
CAPITALIZE(_1),
_2))))
Help us optimize this function