修复匹配的问题
This commit is contained in:
1 parent
6eeaee07d4
commit
ea9c4b34c6
23 files changed
+470
-31
No files matched your search
@@ -79,7 +79,7 @@ export function effectiveParserModeForRoute(route: BusinessRouteDefinition, conf
|
||||
return route.parserPolicy === 'program_only' ? 'program' : 'ai';
|
||||
}
|
||||
|
||||
const PROGRAM_VERSION = 'ltjt-program-parser-v1.0.13';
|
||||
const PROGRAM_VERSION = 'ltjt-program-parser-v1.0.14';
|
||||
export const BUSINESS_INPUT_CONTRACT_VERSION = 'business-input-templates-0.5.136';
|
||||
|
||||
const lookupFields = ({ customerRequired = true } = {}): ProgramFieldDefinition[] => [
|
||||
|
||||
@@ -273,8 +273,10 @@ function parseDateList(rawValue: string, context: DateContext, nextOccurrence: b
|
||||
}
|
||||
|
||||
function namedRef(rawValue: string): JsonRecord {
|
||||
const keyword = compactText(rawValue);
|
||||
return { name: keyword.replace(/人名币/gu, '人民币'), keyword };
|
||||
// Keep the supplied spelling for traceability; only the comparison name
|
||||
// retains the existing width normalization and registered typo alias.
|
||||
const keyword = String(rawValue || '').trim();
|
||||
return { name: compactText(keyword).replace(/人名币/gu, '人民币'), keyword };
|
||||
}
|
||||
|
||||
function positiveInteger(rawValue: string): FieldParseResult {
|
||||
|
||||
@@ -189,7 +189,7 @@ test('versioned sanitized gold corpus replays deterministically', async () => {
|
||||
const corpus = JSON.parse(await readFile(
|
||||
new URL('../../samples/business-parser-gold-corpus.json', import.meta.url), 'utf8'
|
||||
));
|
||||
assert.equal(corpus.version, 'ltjt-program-parser-v1.0.13');
|
||||
assert.equal(corpus.version, 'ltjt-program-parser-v1.0.14');
|
||||
assert.ok(corpus.cases.length >= 28);
|
||||
for (const candidate of corpus.cases) {
|
||||
const parse = () => parseProgramInput({
|
||||
@@ -410,6 +410,18 @@ test('independent headcount distributions keep occupied and non-occupied childre
|
||||
}
|
||||
});
|
||||
|
||||
test('named references retain original fullwidth spelling and internal whitespace in keyword', async () => {
|
||||
const parsed = await parseProgramInput({
|
||||
rawText: '独立团单个下单\n发团日期:09-19\n预订客户:测试客户(人名币)\n产品搜索:单订房 (测试市场)\n预估人数:1\n用房数量:1大床房',
|
||||
receivedAt: '2026-09-18T21:16:59+08:00'
|
||||
});
|
||||
assert.equal(parsed.status, 'agent_parse_passed', JSON.stringify(parsed));
|
||||
const data = (parsed.operation as any).data;
|
||||
assert.deepEqual(data.product, { name: '单订房 (测试市场)', keyword: '单订房 (测试市场)' });
|
||||
assert.deepEqual(data.customer, { name: '测试客户(人民币)', keyword: '测试客户(人名币)' });
|
||||
assert.deepEqual(data.room_counts, { DBL: 1 });
|
||||
});
|
||||
|
||||
test('registered customer typo is normalized only in name while keyword preserves source', async () => {
|
||||
const result = await parseProgramInput({ rawText: routeCases[0].input, receivedAt });
|
||||
const customer = ((result.operation as any).data.customer);
|
||||
|
||||
Reference in new issue
Block a user