Invoices, receipts and support tickets mention amounts in free text: "Subtotal: 40 ... total is 1200". Pull out the number attached to each keyword.
Implement extract_amounts(text, keywords) returning a dict that maps every keyword (in the given order) to the list of amounts that follow it, in order of appearance ([] if none).
Matching rules
total does not match inside subtotal. A multi-word keyword such as late fee matches with any run of whitespace between its words.:, =, or the word is, was or of), then optional whitespace.-, an optional currency symbol ($, € or £), an optional -, then digits. Digits are either groups with comma thousands separators (1,234,567) or a plain run (1234), optionally followed by . and more digits. Sign, symbol and digits must be adjacent (no spaces between them).- appears before or after the symbol. Return Python floats.