Skip to main content

Crate german_impressum_extractor

Crate german_impressum_extractor 

Source
Expand description

§german-impressum-extractor

Extract structured data from German B2B website text — specifically the Impressum page that German websites are legally required to expose under TMG §5.

§Why this crate exists

Germany requires every commercial website to publish a structured “Impressum” listing the legal entity, managing directors, address, contact info, and tax identifiers. This metadata is invaluable for B2B research, lead enrichment, compliance checks, and CRM tooling — yet existing scrapers usually leave you with raw HTML and a few hopeful regexes. This crate gives you a battle-tested, well-tested parser that handles the common cases (and many edge cases).

§Features

  • 🇩🇪 German-aware: handles ä, ö, ü, ß, common abbreviations, obfuscated emails (info [at] firma [dot] de), German phone formats (E.164 normalization), and address patterns.
  • 📦 Zero async runtime needed; pure synchronous parsing.
  • 🔍 Granular: each extractor (emails, phones, address, persons, register numbers, etc.) is separately callable.
  • 🪪 Pulls out: HR-Nummer, HR-Court, USt-IdNr., Steuernummer, IBAN, BIC.
  • 📠 Fax / Telefax detection, kept separate from phone numbers.
  • 👥 Geschäftsführer / Inhaber / Vorstand / Verantwortlicher (§18 MStV) name extraction with role tag.
  • 🏢 Legal-form detection: GmbH, GmbH & Co. KG, UG, AG, KG, OHG, GbR, e.K., eG, SE.
  • 📅 Year-founded heuristics (“gegründet 1973” / “seit 1985” / “founded in 1990”).

§Quick start

use german_impressum_extractor::extract_all;

let text = "
    Musterreinigung GmbH & Co. KG
    Geschäftsführer: Dr. Hans Müller und Anna Schmidt
    Hauptstraße 12, 10115 Berlin
    Tel: +49 30 1234567
    E-Mail: info@musterreinigung.de
    Eingetragen im Handelsregister Berlin HRB 12345 B
    USt-IdNr.: DE 123456789
    Gegründet 1985
";

let data = extract_all(text);

assert_eq!(data.emails, vec!["info@musterreinigung.de"]);
assert!(data.phones.contains(&"+493012345-67".replace('-', "")));
assert_eq!(data.legal_form.as_deref(), Some("GmbH & Co. KG"));
assert_eq!(data.hr_number.as_deref(), Some("HRB 12345 B"));
assert_eq!(data.vat_id.as_deref(), Some("DE123456789"));
assert_eq!(data.year_founded, Some(1985));
assert!(data.persons.iter().any(|p| p.last_name.as_deref() == Some("Müller")));

§Granular use

All field extractors are public if you want to call them independently:

use german_impressum_extractor::{extract_emails, extract_phones};

let emails = extract_emails("Schreiben Sie an info [at] beispiel [dot] de");
assert_eq!(emails, vec!["info@beispiel.de"]);

let phones = extract_phones("Telefon: 030/123 45 67");
assert_eq!(phones[0], "+49301234567");

Structs§

Address
A single postal address (one per address-bearing text block).
Extracted
Container for everything extract_all returns.
Person
A single person mentioned in the Impressum (typically a managing director).
Scored
A value paired with a heuristic confidence in 0.0..=1.0.
ScoredExtracted
Scored counterpart of crate::Extracted: the same fields, each annotated with a confidence. Returned by crate::extract_all_scored.

Functions§

extract_address
Extract the first German address ((postcode, city, street)) from text.
extract_addresses
Extract every postal address on the page — one Address per text block that contains a postcode/city and/or a street, in document order, with exact duplicates removed.
extract_all
Extract every supported field from a free-form text blob.
extract_all_scored
Extract every supported field with a heuristic confidence score per field.
extract_bic
Extract a BIC / SWIFT code (uppercased). Only accepted when it appears in a banking context (BIC, SWIFT, or Bankverbindung nearby) to avoid matching ordinary uppercase words.
extract_de_mail
Extract a De-Mail address, when labeled “De-Mail:”.
extract_dispute_resolution_url
Extract the EU Online-Dispute-Resolution (OS-Plattform) URL, if present.
extract_emails
Return all email addresses (plain and obfuscated info [at] domain [dot] de), lowercased and deduplicated. Code-fragment false positives (invalid TLDs like .css/.js, known junk domains) are filtered out.
extract_fax
Extract a labeled Fax / Telefax number, normalized to +49….
extract_hr_court
Extract the Handelsregister court that follows an Amtsgericht label (e.g. "Berlin", "Berlin (Charlottenburg)").
extract_hr_number
Extract the HR (Handelsregister) number (e.g. HRB 12345 B).
extract_iban
Extract a German IBAN, normalized without spaces (e.g. DE89370400440532013000).
extract_legal_form
Detect the German legal form mentioned in the text (e.g. “GmbH”, “GmbH & Co. KG”, “AG”).
extract_persons
Extract Geschäftsführer / Inhaber / Vorstand / Verantwortlicher persons.
extract_phones
Return all German phone numbers normalized to +49… (digits only).
extract_professional_chamber
Extract the responsible professional chamber (“zuständige Kammer” / “Berufskammer”), when labeled.
extract_register_type
Extract the Handelsregister section — "HRA" or "HRB" — from the HR number.
extract_supervisory_authority
Extract the supervisory authority (“Aufsichtsbehörde”), when labeled.
extract_tax_number
Extract a Steuernummer (local German tax number), e.g. "28/815/0815 1".
extract_vat_id
Extract the German VAT-ID (USt-IdNr., format DE + 9 digits).
extract_year_founded
Extract the company’s founding year.