Skip to content

Commit d3f7aa9

Browse files
Avoid uncertain menu price matches
1 parent 9d5346f commit d3f7aa9

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎outputs/sea-real.html‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,18 +2708,14 @@ <h3 id="ribbonTitle" data-i18n="blueRibbon">블루리본 추천 맛집</h3>
27082708
const translatedItems = [];
27092709
normalizedSource.split(/\n/).forEach(rawLine => {
27102710
const line = repairOcrLine(rawLine);
2711-
const matchedKeys = keys.filter(key => line.includes(key)).filter((key, index, list) => {
2711+
const matchedKeys = keys.filter(key => key.length >= 2 && line.includes(key)).filter((key, index, list) => {
27122712
return !list.some((other, otherIndex) => otherIndex !== index && other.includes(key));
27132713
});
27142714
const prices = line.match(/(?:\d{1,3}(?:,\d{3})+|\d{4,}|\d{1,3}\.\d{1,3})\s*(?:원|₩|KRW)?/gi) || [];
27152715
if (matchedKeys.length) {
27162716
const names = matchedKeys.map(key => menuTranslations[key][target]);
27172717
const priceText = prices.length ? ` · ${prices.join(" / ").replace(/\s*(?:원|₩|KRW)?$/i, "")} KRW` : "";
27182718
translatedItems.push(`${[...new Set(names)].join(" · ")}${priceText}`);
2719-
return;
2720-
}
2721-
if (prices.length && translatedItems.length && !/\d/.test(translatedItems[translatedItems.length - 1])) {
2722-
translatedItems[translatedItems.length - 1] += ` · ${prices.join(" / ").replace(/\s*(?:원|₩|KRW)?$/i, "")} KRW`;
27232719
}
27242720
});
27252721
if (!translatedItems.length) {

0 commit comments

Comments
 (0)