Skip to content

Financials Instrument

FinancialsInstrument is an instrument that extracts financial information from a text using a fine-tuned BERT model.

Configuration

Argument Type Description
entities list[str] List of financial entity types to identify and edit. More information on supported entities can be found on the model page
edit_mode str The editing strategy to apply to identified financial entities. Options include:
- "redact": Remove financial entities completely
- "replace": Replace financial entities with a placeholder string
- "hash": Replace financial entities with a hash value
- "mask": Replace characters with * while preserving length

Usage Example

examples/financial_ner.py
from eunomia.instruments import FinancialsInstrument
from eunomia.orchestra import Orchestra

eunomia = Orchestra(
    instruments=[
        FinancialsInstrument(
            entities=[
                "Advisors.GENERIC_CONSULTING_COMPANY",
                "Parties.BUYING_COMPANY",
                "Parties.ACQUIRED_COMPANY",
            ],
            edit_mode="replace",
        )
    ]
)

text_original = """\
Smithson Legal Advisors provided counsel to Bellcom Industries, \
the buying company, in their acquisition of Hexatech Systems, \
a prominent acquired company. The deal was supported by the consulting company Oper&Manson, \
which provided strategic oversight.
"""
text_edited = eunomia.run(text_original)

print(text_edited)