NLP at Alfa-Bank, Part 9: Structuring OFD Receipts

27 May 2023

Problem

A bank wants to show customers what they spend money on. Card transactions give a place and an amount but not the purchase, and account transactions are too sparse for a shopping profile. Receipts from fiscal data operators (OFD) fill the gap for clients who consented, but each item is a noisy string of abbreviations, technical fields and glued tokens. A brand catalog with regexes fails: it is never current and spellings vary. Hand-labeling millions of receipts is unaffordable.

Example from the article: a supermarket such as Pyaterochka has one MCC category for the whole store, so an MCC spending pie says nothing about what the person bought. Receipt items allow a split by product category.

Solution in brief

Normalize each item line with regexes, then extract product and brand with a token-level NER model and predict the category with a pooled BiLSTM classifier. Labeling stays cheap because all receipts with the same brand and product pair share a category: the model proposes frequent new pairs, and the crowd checks about ten examples per pair with a true/false question.

Questions this case answers
  • How to extract structured entities from noisy abbreviated text lines when hand labeling millions of lines is unaffordable
  • How to assign one category to many items that share an identifying pair, so that annotation effort goes per pair instead of per item
  • How to extract brand and product from noisy fiscal receipt lines
  • How to categorize receipt items for spending analytics beyond MCC codes

Tools and methods

  • Regular expressions — tokenization, noise removal, number masking.
  • fastText embeddings + BiLSTM + MLP — NER with BIO tags for product and brand.
  • BiLSTM + min/average pooling + MLP — multi-class item categorization.
  • Auto-annotation with validation — model-proposed brand and product pairs, checked by the crowd.
  • Yandex.Toloka — NER and true/false validation tasks.
Continue reading — it's free

Google or a one-time email code. No password.