Grounded Text & Entity Extractor avatar

Grounded Text & Entity Extractor

Pricing

from $0.30 / 1,000 grounded extractions

Go to Apify Store
Grounded Text & Entity Extractor

Grounded Text & Entity Extractor

Extract structured entities, clauses, and facts from text or web pages with exact character-offset citations. Fast LangExtract alternative with zero-LLM mode, Gemini/OpenAI support, hallucination filtering, and interactive HTML highlight reports.

Pricing

from $0.30 / 1,000 grounded extractions

Rating

0.0

(0)

Developer

Solutions Smart

Solutions Smart

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

13 hours ago

Last modified

Categories

Features

Limited permissionsMulti-tenantServer interface

Share

Extract structured entities, clauses, and key facts from plain UTF-8 text and HTML web pages—with exact character-position citations (startChar, endChar) mapped back to the original source.

Built as a lightweight LangExtract alternative (google/langextract) with no headless browser or Python startup overhead, this Actor runs with or without an LLM API key, drops any extracted value not found verbatim in the source text, and generates an interactive HTML highlight report for visual review.

Grounded Text & Entity Extractor Interactive HTML Highlight Report


Why Use Grounded Text & Entity Extractor?

  • Lightweight, no browser or Python overhead: Runs directly on plain UTF-8 text and fetched HTML pages without launching a headless browser or heavy Python runtime.
  • Zero-LLM mode or bring your own LLM: Run immediately in Zero-LLM (rule_based) mode with built-in or custom regex rules, or connect Google Gemini, OpenAI, or any OpenAI-compatible endpoint for semantic few-shot entity extraction and NER.
  • Exact Unicode code-point offsets: Every extracted item includes inclusive startChar and exclusive endChar positions counted in Unicode code points (scalar values)—not UTF-8 bytes and not UTF-16 code units. Accented characters (ü, €), CJK characters, and emojis (🚀) each count as 1 (matching Python text[startChar:endChar]; in JavaScript, use [...text].slice(startChar, endChar).join("") when text contains emojis).
  • Verbatim source verification: Drops any value not found verbatim in the source text and saves dropped spans separately to UNGROUNDED_EXTRACTIONS.json for review. (Note: verbatim filtering ensures every value actually exists in the source, but an LLM can still misclassify an existing span—such as tagging a date as an amount—so clear prompts and few-shot examples remain important.)
  • Interactive HTML highlight report: Open OUTPUT_HIGHLIGHT.html in the run's Storage tab → Key-value store to filter by entity class and click any highlighted span inside the original text.

Use Cases

  • Contract Data Extraction & Legal Review: Pull signatories, agreement IDs, effective dates, and monetary amounts with exact character offsets for audit trails.
  • Source Citations for RAG & AI Pipelines: Attach verifiable startChar..endChar spans to extracted metadata so downstream apps can highlight exact supporting evidence.
  • Named Entity Recognition (NER) & Structured Data Extraction: Extract custom entity schemas from articles, support tickets, or financial text using few-shot LLM prompting.
  • Web Page Entity Extraction: Pass HTTP/HTTPS URLs directly—visible text is extracted from the HTML and grounded back to the cleaned page text.
  • Deterministic Compliance & QA: Separate unverified AI guesses from verbatim source spans before loading records into your CRM or database.

Supported Input Formats

  • Plain UTF-8 text: Paste directly into sourceText (or pass text / base64Text via API). base64Text decodes UTF-8 plain text only—binary file formats such as PDF or DOCX are not parsed directly and should be converted to plain text first.
  • Web pages (HTTP/HTTPS URLs): Add one or more URLs in sourceUrls. The Actor fetches each page over HTTP and extracts visible text from the HTML (stripping scripts, styles, and comments).

Input

Configure the Actor using the form in the Input tab or pass JSON via the Apify API.

Main Options

  • Text to Extract From (sourceText) & Web Page URLs (sourceUrls): Paste plain UTF-8 text and/or add HTTP/HTTPS URLs. (API callers can also pass a batch sources array with id plus text, url, or base64Text.)
  • Extraction Mode / LLM Provider (llmProvider):
    • rule_based (default) — Zero-LLM mode (no API key needed). Built-in rules cover person, agreement_id, date, amount, email, and url. Limitations: built-in rules do not extract locations/cities (e.g., München in the sample below), and regex-based person matching can miss uncommon or non-standard name formats. Add customRules or switch to an LLM provider for broader NER.
    • gemini — Google Gemini models (e.g., gemini-3.5-flash).
    • openai — OpenAI models (e.g., gpt-4o-mini).
    • openai_compatible — Any OpenAI-compatible API endpoint via apiBaseUrl.
  • LLM API Key (apiKey): Secret input field—stored encrypted by Apify and never exposed in logs. Not required in rule_based mode.
  • Extraction Prompt (promptDescription) & Few-Shot Example (exampleText, exampleExtractions): Instructions and verbatim class-to-text pairs when using an LLM provider.
  • Custom Regex Rules (customRules, rulesCaseInsensitive): Optional entity-class and Unicode regex pattern pairs for rule_based mode.
  • Grounding & Output (generateHtmlReport, filterUngrounded, requireExactMatch, caseInsensitiveFallback): Control verbatim verification, exact vs. case-insensitive fallback matching, and OUTPUT_HIGHLIGHT.html generation.
  • Chunking & Performance (maxCharBuffer, overlapChars, extractionPasses, maxConcurrency): Tune long-text splitting, multi-pass recall, and worker concurrency.

Example Input: Zero-LLM Mode (No API Key Required)

{
"sourceText": "Dr. Clara Müller signed Service Agreement SA-2026-04 on 15 March 2026 in München for EUR 48,500.",
"llmProvider": "rule_based",
"generateHtmlReport": true
}

Example Input: AI Few-Shot Mode (Gemini / OpenAI)

{
"sourceText": "Dr. Clara Müller signed Service Agreement SA-2026-04 on 15 March 2026 in München for €48.500.",
"promptDescription": "Extract person names, agreement IDs, dates, cities, and monetary amounts verbatim from the text.",
"exampleText": "Max Weber executed Contract C-101 on 2 January 2025 in Berlin for €12.000.",
"exampleExtractions": [
{ "key": "person", "value": "Max Weber" },
{ "key": "agreement_id", "value": "Contract C-101" },
{ "key": "date", "value": "2 January 2025" },
{ "key": "city", "value": "Berlin" },
{ "key": "amount", "value": "€12.000" }
],
"llmProvider": "gemini",
"modelId": "gemini-3.5-flash",
"apiKey": "YOUR_API_KEY"
}

Output

All verified extractions are saved to the run's Dataset (downloadable as JSON, CSV, Excel, XML, or HTML, or via the Apify API):

[
{
"sourceId": "text-1",
"sourceUrl": null,
"chunkIndex": 0,
"extractionClass": "person",
"extractionText": "Dr. Clara Müller",
"matchedSnippet": "Dr. Clara Müller",
"attributes": { "source": "builtin_rule" },
"charInterval": { "startChar": 0, "endChar": 16 },
"groundingStatus": "exact",
"extractionIndex": 0,
"passNumber": 1
},
{
"sourceId": "text-1",
"sourceUrl": null,
"chunkIndex": 0,
"extractionClass": "amount",
"extractionText": "EUR 48,500",
"matchedSnippet": "EUR 48,500",
"attributes": { "source": "builtin_rule" },
"charInterval": { "startChar": 85, "endChar": 95 },
"groundingStatus": "exact",
"extractionIndex": 3,
"passNumber": 1
}
]

Additional artifacts saved in the run's Storage tab → Key-value store:

  • OUTPUT_HIGHLIGHT.html — Self-contained interactive HTML report highlighting every grounded span inside the source text with an attribute inspector and class filters.
  • UNGROUNDED_EXTRACTIONS.json — Created when filterUngrounded is enabled and any extracted spans could not be matched verbatim against the source text.

Pricing

This Actor uses Pay-Per-Event (PPE) billing (platform usage costs are included) and respects your max cost per run setting, so runs stop cleanly before exceeding your budget.

Event nameTriggerPrice (USD)
apify-actor-startCharged when the run starts, per GB of memory (minimum 1 GB)$0.00005
apify-default-dataset-itemCharged per grounded extraction pushed to the Dataset$0.30 / 1,000 ($0.0003 / item)

Example: Extracting 1,000 grounded entities costs about $0.30 (tested on 1,000 entities in a single 1-second run at 256 MB memory, all exact matches).

  • Zero-LLM Mode (rule_based): Only the Actor events above apply—no external AI API costs.
  • AI Mode (gemini, openai, openai_compatible): Bring your own apiKey (stored encrypted) and pay your model provider directly with zero token markup.

FAQ & Support

  • Do I need an LLM API key to try the Actor? No. Leave llmProvider set to rule_based and click Start to run immediately on the prefilled sample text.
  • How are character offsets counted for emojis, accents, and CJK text? startChar (inclusive) and endChar (exclusive) count Unicode code points (scalar values). One emoji (🚀), umlaut (ü), or CJK character counts as 1, matching Python string indexing. In JavaScript (UTF-16), slice with [...text].slice(startChar, endChar).join("").
  • Does base64Text support PDF or DOCX files? No—base64Text decodes UTF-8 plain text only. Extract text from PDF/DOCX files first before passing it in.
  • How does it handle repeated words or long texts? Long inputs are split into overlapping chunks, and repeated terms are matched to the exact occurrence inside their originating chunk in reading order.
  • Questions or feature requests? Open a ticket on the Actor's Issues tab in Apify Console and include a sample input or run ID.