АРЧ АП11 - Архитектура после ге :
This commit is contained in:
@@ -16,6 +16,25 @@ function hasInventoryAsOfCue(text: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
function hasPlainRussianInventoryOnHandSignal(text: string): boolean {
|
||||
const normalized = String(text ?? "").toLowerCase().replace(/ё/g, "е");
|
||||
if (!normalized) {
|
||||
return false;
|
||||
}
|
||||
const hasStockCue =
|
||||
/(?:остатк|склад|товар(?:ы|ов)?|номенклатур|позици|на\s+складе|по\s+складу)/iu.test(normalized);
|
||||
if (!hasStockCue) {
|
||||
return false;
|
||||
}
|
||||
const hasRequestCue =
|
||||
/(?:какие|какой|какая|что|покажи|показать|получить|дай|выведи|чекни|посмотри|есть\s+ли)/iu.test(normalized);
|
||||
const hasSnapshotCue =
|
||||
/(?:на\s+(?:дату|сегодня|сейчас|март|апрел|май|мая|июн|июл|август|сентябр|октябр|ноябр|декабр|январ|феврал)|\b(?:19|20)\d{2}\b)/iu.test(
|
||||
normalized
|
||||
);
|
||||
return hasRequestCue && (hasSnapshotCue || /остатк/iu.test(normalized));
|
||||
}
|
||||
|
||||
function hasInventoryOnHandSignal(text: string): boolean {
|
||||
const hasColloquialStockSnapshotCue = /(?:что|ч[еёо])\s+(?:у\s+нас\s+)?на\s+склад(?:е|у|ом|ах)(?=$|[\s,.;:!?])/iu.test(
|
||||
text
|
||||
@@ -26,7 +45,8 @@ function hasInventoryOnHandSignal(text: string): boolean {
|
||||
const hasAccount41Anchor = hasInventoryAccount41Anchor(text);
|
||||
const hasStockLexeme =
|
||||
/(?:склад(?:е|у|ом|ы|ов)?|warehouse|stock(?:room)?|inventory|on[\s-]?hand)/iu.test(text);
|
||||
if (!hasStockLexeme && !hasAccount41Anchor) {
|
||||
const hasPlainRussianRootCue = hasPlainRussianInventoryOnHandSignal(text);
|
||||
if (!hasStockLexeme && !hasAccount41Anchor && !hasPlainRussianRootCue) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
@@ -51,6 +71,9 @@ function hasInventoryOnHandSignal(text: string): boolean {
|
||||
if (hasAccount41Anchor && (hasGoodsLexeme || hasBalanceLexeme || hasRequestCue || hasInventoryAsOfCue(text))) {
|
||||
return true;
|
||||
}
|
||||
if (hasPlainRussianRootCue) {
|
||||
return true;
|
||||
}
|
||||
return (hasGoodsLexeme || hasBalanceLexeme || hasColloquialStockSnapshotCue || hasStockStateCue) &&
|
||||
(hasRequestCue || hasBalanceLexeme || hasColloquialStockSnapshotCue || hasStockStateCue);
|
||||
}
|
||||
@@ -263,6 +286,17 @@ export function resolveInventoryAddressIntent(text: string): AddressIntentResolu
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
(text.includes("по этой позиции") || text.includes("по этому товару")) &&
|
||||
(text.includes("когда была закупка") || text.includes("когда купили"))
|
||||
) {
|
||||
return {
|
||||
intent: "inventory_purchase_provenance_for_item",
|
||||
confidence: "medium",
|
||||
reasons: ["inventory_purchase_date_signal_detected"]
|
||||
};
|
||||
}
|
||||
|
||||
if (hasSelectedObjectInventoryPurchaseDocumentsSignal(text)) {
|
||||
return {
|
||||
intent: "inventory_purchase_documents_for_item",
|
||||
|
||||
Reference in New Issue
Block a user