feat: decompose composite unknowns before questioning
This commit is contained in:
@@ -514,17 +514,45 @@ function isBroadCompositeUnknownText(text) {
|
||||
);
|
||||
}
|
||||
|
||||
function hasCompoundAbstractSignals(text) {
|
||||
return (
|
||||
/\b(timing|measurement|basis|cost|costs|debt|stock|tax|capital spending|mix|segment)\s+(and|or)\s+\b/.test(
|
||||
text,
|
||||
) ||
|
||||
/\b[a-z]+\/[a-z]+\b/.test(text) ||
|
||||
/,\s*[a-z]+,\s*[a-z]+/.test(text)
|
||||
);
|
||||
}
|
||||
|
||||
function isFocusedAtomicUnknownText(text) {
|
||||
return /\b(define|definition|meaning|term|threshold|criterion|criteria|baseline|evidence|measure|metric|denominator|rate|date|period|budget|constraint|customer|actor|owner)\b/.test(
|
||||
text,
|
||||
);
|
||||
}
|
||||
|
||||
function isDirectlyAnswerableObservationChildText(text) {
|
||||
return /\b(whether the two observations reflect different timing|how the two observations were measured|change mainly affecting|one off event during the period|mix shift during the period)\b/.test(
|
||||
text,
|
||||
);
|
||||
}
|
||||
|
||||
export function assessUnknownAtomicity({ node, graph }) {
|
||||
const nodeText = normaliseText(
|
||||
`${node?.label || ""} ${node?.description || ""}`,
|
||||
);
|
||||
|
||||
if (
|
||||
isDirectlyAnswerableObservationChildText(nodeText) &&
|
||||
!hasCompoundAbstractSignals(nodeText)
|
||||
) {
|
||||
return {
|
||||
atomicity: "atomic",
|
||||
reason:
|
||||
"This unknown isolates one specific line of enquiry and can be investigated directly.",
|
||||
decompositionKind: null,
|
||||
};
|
||||
}
|
||||
|
||||
if (isRelationshipExplanationUnknown(node, graph)) {
|
||||
return {
|
||||
atomicity: "composite",
|
||||
@@ -534,6 +562,15 @@ export function assessUnknownAtomicity({ node, graph }) {
|
||||
};
|
||||
}
|
||||
|
||||
if (hasCompoundAbstractSignals(nodeText)) {
|
||||
return {
|
||||
atomicity: "composite",
|
||||
reason:
|
||||
"This unknown still bundles multiple abstract uncertainties together, so it should be decomposed before asking it directly.",
|
||||
decompositionKind: "compound_child",
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
isFocusedAtomicUnknownText(nodeText) &&
|
||||
!isBroadCompositeUnknownText(nodeText)
|
||||
|
||||
Reference in New Issue
Block a user