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
- linked-claims-extraction-service: Web service for publishing claims to LinkedTrust
Metadata
Release files for linked-claims-extractor 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| linked_claims_extractor-0.2.4.tar.gz | 12.2 kB | Without provenance | Details for linked_claims_extractor-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| linked_claims_extractor-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for linked_claims_extractor-0.2.4-py3-none-any.whl |
Total release size: 22.2 kB
Release files / linked_claims_extractor-0.2.4.tar.gz
| Download URL | linked_claims_extractor-0.2.4.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f9bfe7f42f76dce712942b668c62bd148829724d0a437b638739aafd8dd5127
|
|
BLAKE2b-256 checksum How to use checksums |
d05f05294a693c7fba22d0601847cd822452fc6b25bd4e8d0d711a66ccbc10ab
|
| 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.4-py3-none-any.whl
| Download URL | linked_claims_extractor-0.2.4-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fdcd1a635d3ceb31a243ce2efddb807961f72f9bbea3e06eda9a4445f04953e
|
|
BLAKE2b-256 checksum How to use checksums |
4a1743c903f234d5657a0ea0c476e3e90cd9cf52bea2dc89de425623d4361b43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for linked-claims-extractor 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.