I have a list of bank statements. They look pretty much like this:

  • Received transaction. Reason[separator] invoice from [date][separator][number]. Counterparty[separator] [company name]
  • Payment to another bank [IBAN]/[company name] inv. [invoice number(s)]
  • Payment of taxes
  • Received payment on [invoice numbers][separator][dates]


I need to be able to extract key information from these statements, such as invoice numbers, or counterparty. Separators may vary or may not exist at all. Counterparty names will be different, so I want to be able to recognize that this part of the text is counterparty or at least cluster them all together and then I will name the clusters. Is it possible at all to perform some clustering on each line and then another one that will group the extracted groups? For example, groups of invoices, groups of dates, and so on. Or maybe I need to unite all lines and then cluster but in this case, sometimes I may need 2-3 words if the counterparty name is longer or one string (for example invoice number).

Any advice on what to look for - algorithms, papers, or some similar examples?

  • $\begingroup$ Imho you should rely as much as possible on pattern matching, not on clustering: these documents are strongly structured with some elements easy to identify like dates, IBAN number, amount. $\endgroup$
    – Erwan
    Sep 23 at 10:50
  • $\begingroup$ Actually, they are not. Maybe it looks like this from my example, but the reason is something written by a person. So there are many variations in how people write invoices' abbreviations. I cannot show the data because it is confidential, but you have to consider possible grammatical mistakes, various ordering of the sentences above, etc. $\endgroup$
    – Yana
    Sep 23 at 11:28
  • 1
    $\begingroup$ Ok, then this is probably a Named Entity Recognition (NER) task. A fully unsupervised system is very unlikely to result in what you want, so I don't think you can avoid annotating a good amount of documents in order to train a supervised model. $\endgroup$
    – Erwan
    Sep 23 at 14:03


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy