NODEDC_1C/llm_normalizer/backend/dist/services/addressInventoryIntentSigna...

317 lines
30 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveInventoryAddressIntent = resolveInventoryAddressIntent;
const inventoryLifecycleCueHelpers_1 = require("./inventoryLifecycleCueHelpers");
function hasInventoryAccount41Anchor(text) {
return /(?:СЃС‡[её]С(?:Р°|Рµ|Сѓ)?|счет(?:Р°|Рµ|Сѓ)?)\D{0,12}41(?:[.,]0?1)?/iu.test(text) || /41(?:[.,]0?1)?\D{0,12}(?:СЃС‡[её]С(?:Р°|Рµ|Сѓ)?|счет(?:Р°|Рµ|Сѓ)?)/iu.test(text);
}
function hasInventoryAsOfCue(text) {
return /(?:сейчас|текущ|на\s+дату|по\s+состоянию|срез|на\s+конец|date|as\s+of|current|now|today)/iu.test(text);
}
function hasPlainRussianInventoryOnHandSignal(text) {
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) {
const hasColloquialStockSnapshotCue = /(?:что|ч[еёо])\s+(?:у\s+нас\s+)?на\s+склад(?:е|у|ом|ах)(?=$|[\s,.;:!?])/iu.test(text);
const hasStockStateCue = /(?:(?:что|ч[еёо])\s+там\s+на\s+склад(?:е|у|ом|ах)|(?:что|ч[еёо]).*происход(?:ит|ило|ящее).*(?:на\s+)?склад(?:е|у|ом|ах)|происход(?:ит|ило|ящее)\s+на\s+склад(?:е|у|ом|ах)|ситуац(?:ия|ии)\s+на\s+склад(?:е|у|ом|ах)|обстановк(?:а|и)\s+на\s+склад(?:е|у|ом|ах)|what(?:'s| is)?\s+(?:there\s+)?(?:on|in)\s+(?:the\s+)?(?:warehouse|stock)|what(?:'s| is)?\s+happening\s+(?:on|in)\s+(?:the\s+)?(?:warehouse|stock))/iu.test(text);
const hasAccount41Anchor = hasInventoryAccount41Anchor(text);
const hasStockLexeme = /(?:склад(?:Рµ|Сѓ|РѕРј|С|РѕРІ)?|warehouse|stock(?:room)?|inventory|on[\s-]?hand)/iu.test(text);
const hasPlainRussianRootCue = hasPlainRussianInventoryOnHandSignal(text);
if (!hasStockLexeme && !hasAccount41Anchor && !hasPlainRussianRootCue) {
return false;
}
if (hasInventoryProvenanceSignalV2(text) ||
hasInventoryPurchaseDocumentsSignalV2(text) ||
hasInventorySaleTraceSignalV2(text) ||
hasInventoryAgingSignal(text) ||
hasInventoryPurchaseToSaleChainSignal(text)) {
return false;
}
const hasGoodsLexeme = /(?:товар(?:С|РѕРІ|РѕРј|Р°|ные)?|номенклатур|материал(?:С|РѕРІ|Р°|ам)?|item(?:s)?|sku|product(?:s)?)/iu.test(text);
const hasBalanceLexeme = /(?:леж(?:ит|ат)|есть|числ(?:ит(?:ся|сь)|ятся)|остат(?:ок|ки)|срез|на\s+дат|по\s+состоянию|на\s+конец|происход(?:ит|ило|ящее)|ситуац(?:ия|ии)|обстановк(?:а|и)|today|now|current|as\s+of)/iu.test(text);
const hasRequestCue = /(?:покажи|показать|выведи|дай|какие|что|ч[еёо]|какой|сколько|проверь|проверить|чекни|check|show|list|which|what)/iu.test(text);
if (hasAccount41Anchor && (hasGoodsLexeme || hasBalanceLexeme || hasRequestCue || hasInventoryAsOfCue(text))) {
return true;
}
if (hasPlainRussianRootCue) {
return true;
}
return (hasGoodsLexeme || hasBalanceLexeme || hasColloquialStockSnapshotCue || hasStockStateCue) &&
(hasRequestCue || hasBalanceLexeme || hasColloquialStockSnapshotCue || hasStockStateCue);
}
function hasSelectedObjectInventoryCue(text) {
const value = String(text ?? "");
if (/(?:по\s+выбранному\s+объекту|по\s+выбранной\s+позиции|по\s+этой\s+позиции|по\s+этому\s+товару|по\s+нему|по\s+ней|по\s+ним|по\s+нему\s+же|по\s+ней\s+же|selected\s+object)/iu.test(value)) {
return true;
}
return /(?:по\s+выбранному\s+объекту|по\s+выбранной\s+позиции|по\s+этой\s+позиции|по\s+этому\s+товару|по\s+нему|по\s+ней|по\s+ним|по\s+нему\s+же|по\s+ней\s+же|selected\s+object)/iu.test(String(text ?? ""));
}
function hasSelectedObjectInventoryProvenanceSignal(text) {
return hasSelectedObjectInventoryCue(text) && (0, inventoryLifecycleCueHelpers_1.hasInventorySupplierCue)(text);
}
function hasSelectedObjectInventoryPurchaseDocumentsSignal(text) {
const value = String(text ?? "");
if (hasSelectedObjectInventoryCue(value) &&
/(?:по\s+каким\s+документам\s+(?:это|его|этот\s+товар|эту\s+позицию)?\s*купили|по\s+каким\s+документам\s+(?:был\s+)?куплен|какими\s+документами\s+(?:это|его|этот\s+товар|эту\s+позицию)?\s*купили|какими\s+документами\s+(?:был\s+)?куплен|покажи\s+документы\s+по\s+(?:этой\s+позиции|этому\s+товару|ней|нему)|документы\s+по\s+(?:этой\s+позиции|этому\s+товару|ней|нему)|purchase\s+documents|documents\s+of\s+purchase|through\s+which\s+documents)/iu.test(value)) {
return true;
}
const hasPurchaseDocumentsCue = /(?:по\s+каким\s+документам\s+(?:это|его|этот\s+товар|эту\s+позицию)\s+купили|по\s+каким\s+документам\s+(?:был\s+)?куплен|какими\s+документами\s+(?:это|его|этот\s+товар|эту\s+позицию)\s+купили|какими\s+документами\s+(?:был\s+)?куплен|purchase\s+documents|documents\s+of\s+purchase|through\s+which\s+documents)/iu.test(text) ||
/(?:(?:по\s+каким|какими)\s+док[а-яё]*[\s\S]{0,80}(?:купил|куплен)|док(?:и|умент[а-яё]*)[\s\S]{0,80}(?:по\s+(?:ним|ней|нему|этой\s+позиции|этому\s+товару)|операци)|(?:по\s+(?:ним|ней|нему|этой\s+позиции|этому\s+товару))[\s\S]{0,80}док(?:и|умент[а-яё]*))/iu.test(text);
return hasSelectedObjectInventoryCue(text) && hasPurchaseDocumentsCue;
}
function hasSelectedObjectInventorySaleTraceSignal(text) {
return hasSelectedObjectInventoryCue(text) && (0, inventoryLifecycleCueHelpers_1.hasInventorySaleCue)(text);
}
function hasSelectedObjectInventoryProfitabilitySignal(text) {
return hasSelectedObjectInventoryCue(text) && (0, inventoryLifecycleCueHelpers_1.hasInventoryProfitabilityCue)(text);
}
function hasInventoryProvenanceSignalV2(text) {
const value = String(text ?? "");
const hasPlainItemCue = /(?:товар|номенклатур|sku|item|product|остат|склад)/iu.test(value);
const hasPlainSupplierCue = (0, inventoryLifecycleCueHelpers_1.hasInventorySupplierCue)(value) || /(?:кем\s+поставлен|кто\s+(?:это|его|этот\s+товар|эту\s+позицию)?\s*поставил)/iu.test(value);
const hasPlainPurchaseCue = /(?:куплен(?:ы|а|о)?|закупк|происхожд|откуда|где\s+(?:мы\s+)?купили|поставлен(?:ы|а)?|purchase\s+provenance|purchase\s+date)/iu.test(value) || (0, inventoryLifecycleCueHelpers_1.hasInventoryPurchaseStem)(value);
if (hasPlainItemCue && hasPlainSupplierCue && hasPlainPurchaseCue) {
return true;
}
const hasItemCue = /(?:товар|номенклатур|sku|item|product|остат(?:ок|ки)|склад)/iu.test(text);
const hasSupplierCue = (0, inventoryLifecycleCueHelpers_1.hasInventorySupplierCue)(text) || /кем\s+поставлен/iu.test(text);
const hasPurchaseCue = /(?:куплен(?:С|Р°|Рѕ)?|закупк|происхождени|откуда|РіРґРµ\s+(?:РјС\s+)?купили(?:\s+(?:это|его|товар|позицию))?|РіРґРµ\s+куплено|РєРѕРіРґР°\s+был\s+куплен|РєРѕРіРґР°\s+куплен|дата\s+закупк|кто\s+(?:нам\s+)?поставил|кем\s+поставлен|поставлен(?:С|Р°)?|purchase\s+provenance|purchase\s+date)/iu.test(text) || (0, inventoryLifecycleCueHelpers_1.hasInventoryPurchaseStem)(text);
return hasItemCue && hasSupplierCue && hasPurchaseCue;
}
function hasInventoryPurchaseDateSignal(text) {
const hasItemCue = /(?:товар|номенклатур|sku|item|product)/iu.test(text) || hasSelectedObjectInventoryCue(text);
const hasPurchaseDateCue = /(?:РєРѕРіРґР°\s+(?:примерно\s+)?(?:РјС\s+)?купили|РєРѕРіРґР°\s+был\s+куплен|РєРѕРіРґР°\s+куплен|дата\s+закупк|purchase\s+date)/iu.test(text) ||
/(?:когда\s+был(?:а|и|о)?\s+закупк\w*|когда\s+закупк\w*)/iu.test(text);
return hasItemCue && hasPurchaseDateCue;
}
function hasInventoryPurchaseDocumentsSignalV2(text) {
const value = String(text ?? "");
const hasPlainItemCue = /(?:товар|номенклатур|sku|item|product)/iu.test(value);
const hasPlainPurchaseDocCue = /(?:по\s+каким\s+документам\s+(?:был\s+)?куплен|по\s+каким\s+документам\s+(?:это|его|этот\s+товар|эту\s+позицию)?\s*купили|какими\s+документами\s+(?:был\s+)?куплен|какими\s+документами\s+(?:это|его|этот\s+товар|эту\s+позицию)?\s*купили|документ[а-яё]*\s+закупк|purchase\s+documents|documents\s+of\s+purchase|through\s+which\s+documents)/iu.test(value);
if (hasPlainItemCue && hasPlainPurchaseDocCue) {
return true;
}
const hasItemCue = /(?:товар|номенклатур|sku|item|product)/iu.test(text);
const hasPurchaseDocCue = /(?:РїРѕ\s+каким\s+документам\s+был\s+куплен|РїРѕ\s+каким\s+документам\s+куплен|какими\s+документами\s+был\s+куплен|документ(?:ам|С)\s+закупк|purchase\s+documents|documents\s+of\s+purchase|through\s+which\s+documents)/iu.test(text);
return hasItemCue && hasPurchaseDocCue;
}
function hasInventorySaleTraceSignalV2(text) {
const value = String(text ?? "");
const hasPlainItemCue = /(?:товар|номенклатур|позици|продукци|sku|item|product)/iu.test(value);
const hasPlainTraceCue = /(?:кому\s+(?:в\s+итоге\s+)?(?:мы\s+)?(?:продали|реализовали|впарили)|кому\s+(?:был[аио]?|были)?\s*реализован|кто\s+купил|покупател|buyer|sale\s+trace|trace\s+of\s+sale)/iu.test(value);
if (hasPlainItemCue && hasPlainTraceCue) {
return true;
}
const hasItemCue = /(?:товар|номенклатур|sku|item|product|позици(?:я|ю|и)|продукци(?:я|ю|и))/iu.test(text);
const hasTraceCue = /(?:РєРѕРјСѓ\s+(?:РІ\s+итоге\s+)?(?:РјС\s+)?продали|РєРѕРјСѓ\s+был\s+продан|РєСѓРґР°\s+(?:РІ\s+итоге\s+)?(?:РјС\s+)?продали(?:\s+(?:это|его|товар|позицию))?|РєСѓРґР°\s+(?:была\s+)?реализована\s+(?:позиция|номенклатура|продукция)|кто\s+РєСѓРїРёР»|buyer|sale\s+trace|trace\s+of\s+sale|через\s+какие\s+документы\s+РїСЂРѕС€[её]Р»\s+путь\s+товара|закупк.*склад.*продаж|purchase[\s-]?to[\s-]?sale|purchase\s*->\s*warehouse\s*->\s*sale|purchase\s*->\s*stock\s*->\s*sale)/iu.test(text);
return hasItemCue && hasTraceCue;
}
function hasInventorySupplierStockOverlapSignal(text) {
const value = String(text ?? "");
const hasPlainDirectSingleItemSupplierQuestion = /(?:от\s+(?:какого|кого)\s+поставщик[а-яё]*\s+куплен\s+(?:товар|номенклатур|позици)|от\s+кого\s+куплен\s+(?:товар|номенклатур|позици))/iu.test(value);
if (hasPlainDirectSingleItemSupplierQuestion) {
return false;
}
const hasPlainSupplierCue = /(?:поставщик|supplier|vendor)/iu.test(value);
const hasPlainStockCue = /(?:склад|остат|леж[аи][т]?|висят|сейчас\s+еще|сейчас\s+ещё|на\s+дату|current\s+stock|stock\s+overlap)/iu.test(value);
const hasPlainUnresolvedSupplierLink = /(?:без\s+понятн[а-яё]*\s+привязк[а-яё]*\s+к\s+поставщик|без\s+привязк[а-яё]*\s+к\s+поставщик|unresolved\s+supplier\s+link)/iu.test(value);
if ((hasPlainSupplierCue && hasPlainStockCue) || (hasPlainUnresolvedSupplierLink && hasPlainStockCue)) {
return true;
}
const hasDirectSingleItemSupplierQuestion = /(?:РѕС\s+какого\s+поставщика\s+куплен\s+(?:товар|номенклатур(?:Р°|Сѓ|С)|позици(?:СЏ|СЋ|Рё))|РѕС\s+РєРѕРіРѕ\s+куплен\s+(?:товар|номенклатур(?:Р°|Сѓ|С)|позици(?:СЏ|СЋ|Рё)))/iu.test(text);
if (hasDirectSingleItemSupplierQuestion) {
return false;
}
const hasSupplierCue = /(?:поставщик|supplier|vendor|РѕС\s+поставщика|Сѓ\s+поставщика)/iu.test(text);
const hasStockCue = /(?:склад|остат(?:ок|ке|ков)|лежат|лежит|сейчас\s+еще|сейчас\s+ещ[её]|на\s+дату|по\s+состоянию\s+на\s+дату|current\s+stock|stock\s+overlap|что\s+сейчас\s+лежит)/iu.test(text);
return hasSupplierCue && hasStockCue;
}
function hasInventoryAgingSignal(text) {
const value = String(text ?? "");
const hasPlainResidueCue = /(?:остат|склад|stock\s+residue|stock\s+balance)/iu.test(value);
const hasPlainAgingCue = /(?:стар(?:ые|ым|ых)\s+закупк|очень\s+давно|давно\s+(?:куплен|приобретен|приобретён)|закуплен[а-яё]*\s+задолго\s+до|задолго\s+до(?:\s+\d{4}-\d{2}-\d{2})?|возраст\s+(?:остатк|закупк)|aging\s+by\s+purchase\s+date|old\s+purchase|old\s+purchases|old\s+stock|very\s+old\s+stock|very\s+old\s+purchase)/iu.test(value);
if (hasPlainAgingCue || (hasPlainResidueCue && /(?:давно|задолго\s+до|стар(?:ые|ым|ых)\s+закупк)/iu.test(value))) {
return true;
}
const hasResidueCue = /(?:остат(?:ок|ки)|в\s+остатке|среди\s+текущих\s+остатков|на\s+складе|stock\s+residue|stock\s+balance)/iu.test(text);
const hasAgingCue = /(?:стар(?:ые|СРј|ых)\s+закупк|стары(?:Рј|С…)\s+закупк(?:ам|Рё|ах)|относит(?:СЃСЏ|СЃСЏ\s+ли)?\s+.*\s+Рє\s+старым\s+закупк|закупал(?:РёСЃСЊ|СЃСЏ)\s+очень\s+давно|очень\s+давно|давно\s+куплен|давно\s+приобретен|куплен\s+задолго\s+РґРѕ(?:\s+даты)?|закуплен(?:С|Р°)?\s+давно|приобретен\s+давно|задолго\s+РґРѕ(?:\s+даты)?|возраст\s+остатк|возраст\s+закупк|aged?\s+stock|old\s+purchase|old\s+purchases|old\s+stock|bought\s+long\s+ago|purchased\s+long\s+ago|aging\s+by\s+purchase\s+date|very\s+old\s+stock|very\s+old\s+purchase|old\s+procurement|older\s+purchases|aged\s+items|old\s+goods)/iu.test(text);
return hasAgingCue || (hasResidueCue && /(?:давно\s+куплен|давно\s+приобретен|задолго\s+до)/iu.test(text));
}
function hasInventoryPurchaseToSaleChainSignal(text) {
const value = String(text ?? "");
const hasPlainItemCue = /(?:товар|номенклатур|позици|sku|item|product)/iu.test(value);
const hasPlainChainCue = /(?:закупк[а-яё]*\s*->\s*склад\s*->\s*продаж|через\s+какие\s+документы\s+прош[её]л\s+путь|цепочк[а-яё]*\s+движен|документально\s+подтвержденн[а-яё]*\s+цепочк|supplier\s*->\s*item\s*->\s*(?:buyer|customer)|supplier\s+to\s+buyer|supplier\s+to\s+item\s+to\s+buyer|purchase[\s-]?to[\s-]?sale|purchase\s*->\s*(?:warehouse|stock)\s*->\s*sale)/iu.test(value) || value.includes("->");
if (hasPlainItemCue && hasPlainChainCue) {
return true;
}
const hasItemCue = /(?:товар|номенклатур|sku|item|product)/iu.test(text);
const hasChainCue = /(?:закупк.*склад.*продаж|purchase[\s-]?to[\s-]?sale|purchase\s*->\s*(?:warehouse|stock)\s*->\s*sale|закупка\s*->\s*склад\s*->\s*продажа|цепочк[аи]\s+движен|документально\s+подтвержденн\w+\s+цепочк|supplier\s*->\s*item\s*->\s*(?:buyer|customer)|supplier\s+to\s+buyer|supplier\s+to\s+item\s+to\s+buyer)/iu.test(text) || text.includes("->");
return hasItemCue && hasChainCue;
}
function hasInventorySupplierToBuyerChainSignal(text) {
const value = String(text ?? "");
const hasPlainSupplierCue = /(?:поставщик|supplier|vendor)/iu.test(value);
const hasPlainBuyerCue = /(?:покупател|buyer|customer|client)/iu.test(value);
const hasPlainItemCue = /(?:товар|номенклатур|sku|item|product)/iu.test(value);
const hasPlainChainCue = /(?:документально\s+подтвержденн[а-яё]*\s+цепочк|поставщик\s*->\s*товар\s*->\s*покупател|supplier\s*->\s*item\s*->\s*(?:buyer|customer)|supplier\s*->\s*buyer|supplier\s+to\s+buyer|supplier\s+to\s+item\s+to\s+buyer)/iu.test(value) || value.includes("->");
if (hasPlainSupplierCue && hasPlainBuyerCue && hasPlainItemCue && hasPlainChainCue) {
return true;
}
const hasSupplierCue = /(?:поставщик|supplier|vendor)/iu.test(text);
const hasBuyerCue = /(?:покупател|buyer|customer|client)/iu.test(text);
const hasItemCue = /(?:товар|номенклатур|sku|item|product)/iu.test(text);
const hasChainCue = /(?:документально\s+подтвержденн\w+\s+цепочк|supplier\s*->\s*item\s*->\s*buyer|supplier\s*->\s*item\s*->\s*customer|supplier\s*->\s*buyer|supplier\s+to\s+buyer|supplier\s+to\s+buyer\s+chain|supplier\s+to\s+item\s+to\s+buyer|поставщик\s*->\s*товар\s*->\s*покупател|поставщик\s*->\s*товар\s*->\s*клиент|поставщик\s*->\s*товар\s*->\s*покупатель|поставщик\s+к\s+покупател|поставщик\s+к\s+клиент|поставщик\s+к\s+товару\s+и\s+покупателю)/iu.test(text) || text.includes("->");
return hasSupplierCue && hasBuyerCue && hasItemCue && hasChainCue;
}
function resolveInventoryAddressIntent(text) {
if (/(?:старым\s+закупк(?:ам|и|ах)|относится\s+ли\s+.*\s+к\s+старым\s+закупк(?:ам|и|ах)|очень\s+давно|давно\s+куплен|давно\s+приобретен|old\s+stock|old\s+purchase|aging\s+by\s+purchase\s+date)/iu.test(text)) {
return {
intent: "inventory_aging_by_purchase_date",
confidence: "high",
reasons: ["inventory_aging_signal_detected_strong"]
};
}
if (hasInventoryAccount41Anchor(text) && hasInventoryAsOfCue(text)) {
return {
intent: "inventory_on_hand_as_of_date",
confidence: "high",
reasons: ["inventory_account_41_as_of_date_signal_detected"]
};
}
if (/(?:без\s+понятн(?:ой|ого)\s+привязк(?:и|а)\s+к\s+поставщик|без\s+привязк(?:и|а)\s+к\s+поставщик|unresolved\s+supplier\s+link)/iu.test(text)) {
return {
intent: "inventory_supplier_stock_overlap_as_of_date",
confidence: "medium",
reasons: ["inventory_unresolved_provenance_signal_detected"]
};
}
if (hasInventorySupplierStockOverlapSignal(text)) {
return {
intent: "inventory_supplier_stock_overlap_as_of_date",
confidence: "medium",
reasons: ["inventory_supplier_stock_overlap_signal_detected"]
};
}
if (/(?:supplier\s*->\s*buyer|supplier\s+to\s+buyer|supplier\s+to\s+buyer\s+chain|поставщик\s+к\s+покупателю|поставщик\s*->\s*товар\s*->\s*покупател|документально\s+подтвержденн\w+\s+цепочк)/iu.test(text) &&
/(?:поставщик|supplier|vendor)/iu.test(text) &&
/(?:покупател|buyer|customer|client)/iu.test(text) &&
/(?:товар|номенклатур|sku|item|product)/iu.test(text)) {
return {
intent: "inventory_purchase_to_sale_chain",
confidence: "high",
reasons: ["inventory_supplier_to_buyer_chain_signal_detected_strong"]
};
}
if (hasInventoryPurchaseToSaleChainSignal(text)) {
return {
intent: "inventory_purchase_to_sale_chain",
confidence: "medium",
reasons: ["inventory_purchase_to_sale_chain_signal_detected"]
};
}
if (hasInventoryAgingSignal(text)) {
return {
intent: "inventory_aging_by_purchase_date",
confidence: "medium",
reasons: ["inventory_aging_signal_detected"]
};
}
if (hasSelectedObjectInventoryProvenanceSignal(text)) {
return {
intent: "inventory_purchase_provenance_for_item",
confidence: "medium",
reasons: ["inventory_selected_object_provenance_signal_detected"]
};
}
if (hasInventoryProvenanceSignalV2(text)) {
return {
intent: "inventory_purchase_provenance_for_item",
confidence: "medium",
reasons: ["inventory_provenance_signal_detected"]
};
}
if (hasInventoryPurchaseDateSignal(text)) {
return {
intent: "inventory_purchase_provenance_for_item",
confidence: "medium",
reasons: ["inventory_purchase_date_signal_detected"]
};
}
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",
confidence: "medium",
reasons: ["inventory_selected_object_purchase_documents_signal_detected"]
};
}
if (hasInventoryPurchaseDocumentsSignalV2(text)) {
return {
intent: "inventory_purchase_documents_for_item",
confidence: "medium",
reasons: ["inventory_purchase_documents_signal_detected"]
};
}
if (hasSelectedObjectInventoryProfitabilitySignal(text)) {
return {
intent: "inventory_profitability_for_item",
confidence: "medium",
reasons: ["inventory_selected_object_profitability_signal_detected"]
};
}
if (hasSelectedObjectInventorySaleTraceSignal(text)) {
return {
intent: "inventory_sale_trace_for_item",
confidence: "medium",
reasons: ["inventory_selected_object_sale_trace_signal_detected"]
};
}
if (/(?:РєРѕРјСѓ\s+(?:РјС\s+)?впарили(?:\s+(?:это|его|товар|позицию))?|РєРѕРјСѓ\s+РІ\s+итоге\s+РјС\s+впарили)/iu.test(text) &&
/(?:товар|номенклатур|sku|item|product|позици(?:я|ю|и)|продукци(?:я|ю|и))/iu.test(text)) {
return {
intent: "inventory_sale_trace_for_item",
confidence: "medium",
reasons: ["inventory_sale_trace_signal_detected"]
};
}
if (hasInventorySaleTraceSignalV2(text)) {
return {
intent: "inventory_sale_trace_for_item",
confidence: "medium",
reasons: ["inventory_sale_trace_signal_detected"]
};
}
if (hasInventorySupplierToBuyerChainSignal(text)) {
return {
intent: "inventory_purchase_to_sale_chain",
confidence: "medium",
reasons: ["inventory_supplier_to_buyer_chain_signal_detected"]
};
}
if (hasInventoryOnHandSignal(text)) {
return {
intent: "inventory_on_hand_as_of_date",
confidence: "high",
reasons: ["inventory_on_hand_signal_detected"]
};
}
return null;
}