Skip to main content

Claim Extractor

Extract LinkedClaims from text using LLMs.

Quick Start

from claim_extractor import ClaimExtractor

# Initialize
extractor = ClaimExtractor()

## OPTIONALLY include extra instructions and override default message prompt

extractor=ClaimExtractor(extra_system_instructions="Only look for claims about islands", message_prompt="The following narrative may or may not have claims in it, include any claims about islands and especially trees on islands. Otherwise return empty array if not found.  Here is the text {text}")

# Extract claims from text
text = "John Smith was the CEO of TechCorp from 2020 to 2023 and increased revenue by 40%."
claims = extractor.extract_claims(text)

# Returns:
# [
#   {
#     "subject": "urn:person:John_Smith",
#     "claim": "controlled", 
#     "object": "urn:company:TechCorp",
      "effectiveDate": 2020,
      "statement": "John Smith was the CEO of TechCorp from 2020 to 2023",
#     "howKnown": "DOCUMENT",
#   },
#   {
#     "subject": "urn:person:John_Smith",
#     "claim": "impact:revenue",
#     "object": "urn:company:TechCorp",
#     "amt": 1.4,
#     "effectiveDate": 2023,
#     "statement": "John Smith increased revenue of Tech Corp by 40% from 2020 to 2023"
#   }
# ]

Installation

From PyPI

pip install linked-claims-extractor

Development Setup

# Clone the repository
git clone https://github.com/Cooperation-org/linked-claims-extractor.git
cd linked-claims-extractor

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e .

# Install build tools (optional, for publishing)
pip install build twine

For publishing instructions, see PUBLISH.md.

Configuration

Set environment variable:

export ANTHROPIC_API_KEY=your-key

Or create a .env file:

ANTHROPIC_API_KEY=your-key

Usage

from claim_extractor import ClaimExtractor

# Basic usage
extractor = ClaimExtractor()
claims = extractor.extract_claims("Your text here...")

# Extract from URL
claims = extractor.extract_claims_from_url("https://example.com/article")

Related Projects

Metadata

Release files for linked-claims-extractor 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for linked-claims-extractor 0.2.3
File Size Uploaded
linked_claims_extractor-0.2.3.tar.gz 12.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for linked-claims-extractor 0.2.3
File Interpreter ABI Platform
linked_claims_extractor-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 22.2 kB

Release files / linked_claims_extractor-0.2.3.tar.gz

Download URL linked_claims_extractor-0.2.3.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
64bf501dd2f6ee508fe840b993971237473524a126bc3460c037b1d977a1d35d
BLAKE2b-256 checksum
How to use checksums
3d6e55d024479c0372b394608ec002d0608377bc8ddfb25ed1bae257a1e482ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / linked_claims_extractor-0.2.3-py3-none-any.whl

Download URL linked_claims_extractor-0.2.3-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5379b3902637e16785b7ea8d6b0f0337ce33a01a1911b3f5ae79dcf786f73e56
BLAKE2b-256 checksum
How to use checksums
1739b335bccd9a5a92df30b3930f69248555d64621f284fc1d724345e3c51453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

0.2.4

2 release files

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page