نبتونسجل شعارات التجار
اللغة: العربية

للمطورين / مواصفة المطابقة

Merchant matcher specification (schema 1)

One algorithm, implemented once per client. Every implementation must pass every case in fixtures.json. Reference implementation: neptune-mobile/lib/core/merchant_logos/merchant_matcher.dart.

Rule zero: a wrong logo is worse than none. Every ambiguity returns no match.

Input

name (counterparty or merchant name as the bank sent it), account (any digits), iban, descriptor (a card statement's merchant field, ISO 8583 DE43 style: name, city, country), text (the row's free description). Any of them may be absent. Order: account, name, descriptor, text. Clients pass text except for transfers and salaries, where the description is a person's purpose, not a merchant.

Signals, strongest first

SignalFires whenScore
accountthe account/IBAN equals exactly one registered account1
exactthe whole normalised name equals one merchant name or alias1
tokena run of consecutive name tokens, joined, equals an alias of 5+ characters1
fuzzya run of tokens is within the typo budget of an alias of 5+ characters1 - typos / length
texta run of description tokens equals an alias of 5+ characters, or is one typo from an alias of 7+as above

Order: account, then name, then text. text exists for voucher purchases: the statement row of a voucher names only its product, inside a fixed Arabic sentence, and carries no provider id. It is never fuzzy and never matches an acronym; two merchants in one description give no match.

Accounts

Names

Normalise, then split into tokens:

ؤسسة company co ltd limited llc est inc corp plc sarl jsc the and

  1. Eastern digits to Western; remove harakat (U+064B to U+0652), superscript alef (U+0670) and tatweel (U+0640).
  2. Lower-case Latin; fold Latin accents; أ إ آ ٱ to ا, ى to ي, ة to ه, ؤ to و, ئ to ي; Persian shapes ک ی ھ ڤ پ چ to ك ي ه ف ب ج; Latin p to b and v to f (Arabic has neither, so Libyan Latin spelling swaps them: Bresto is Presto).
  3. Anything that is not a letter or digit becomes a space.
  1. In words of 5+ letters collapse doubled letters (Prestto); shorter words keep them (LTT).
  2. Strip one Arabic prefix وال بال فال كال لل ال when 3+ letters remain.

Latin al/el stay as tokens: joining tokens makes Al-Madar, AL MADAR and ALMADAR equal.

Windows: every run of 1 to 5 consecutive tokens, joined without spaces.

قاولات» is not the airline Oya).

Choosing

Service marks yield: merchants of category payments (banks, wallets, rails, card schemes) carry a payment for someone else. When any other merchant also scored, they are dropped before ranking ("LYPAY Transfer . Libyana" is Libyana, "PAYPAL *NETFLIX" is Netflix). In a descriptor whose match is a service mark (or nothing) and that has a *, the part after the first * is matched as a descriptor too, and a non-service result wins ("TABBY*NOON" is noon).

Best score per merchant. If the top two merchants are within 0.02 of each other, no match.

Kind of place must agree (names and descriptors, not text): when the name announces a kind of place (pharmacy, hospital, restaurant, café, bakery, fuel, hotel, groceries, shopping, travel, transport, education, shipping, by the same word lists clients use for generic icons) the chosen merchant's category must allow it; otherwise no match. "AL MADAR CAFE" holds the telecom's alias and is a café. Allowed kinds per category: telecom {shopping}; ecommerce {shopping, groceries, shipping}; airline {travel, hotel, transport}; supermarket {groceries, shopping, bakery}; fuel {fuel, shopping, café, restaurant, groceries}; pharmacy {pharmacy, hospital}; restaurant {restaurant, café, bakery}; education {education}; shipping {shipping}; vouchers, fashion {shopping}; transport {transport, travel}; utilities, payments, government, entertainment, software {}; other or missing: any.

Evidence order, strongest first: account or IBAN, merchant ID, the whole name equal to an alias, an alias window, then typo-tolerant windows. Only the last needs coverage; every one but the account and the whole name must pass the kind check. Tags are labels for people (portal search, review); they never select a logo.

Budgets

Under 2 ms per row on a low-end Android; the reference runs ~80 µs per row against 2,000 merchants on the development Mac. Results are cached per (name, account, iban).