Skip to main content

Headline Parser

PyPI version License: MIT Downloads LinkedIn

A package to process news headlines or short text snippets, extracting key entities, topics, and sentiment, and outputting structured summaries in a consistent format.

Installation

pip install headline_parser

Overview

This package uses a large language model (LLM) to process input text and generate structured summaries of current events. It's suitable for:

  • News aggregation
  • Content moderation analysis
  • Tracking public discourse on free speech and regulatory issues
  • Applications not requiring raw media files

Example usage

from headline_parser import headline_parser

response = headline_parser(
    user_input="Us Democrats pass a health care reform bill.",
)
print(response)

The headline_parser function can take in optional arguments:

  • llm: an instance of langchain_core.language_models.BaseChatModel, which defaults to langchain_llm7.ChatLLM7
  • api_key: an optional API key for LLM7, which defaults to the LLM7_API_KEY environment variable

You can pass your own LLM instance from other providers:

# Using OpenAI
from langchain_openai import ChatOpenAI
from headline_parser import headline_parser

llm = ChatOpenAI()
response = headline_parser("Your news headline", llm=llm)
print(response)

# Using Anthropic
from langchain_anthropic import ChatAnthropic
from headline_parser import headline_parser

llm = ChatAnthropic()
response = headline_parser("Your news headline", llm=llm)
print(response)

# Using Google
from langchain_google_genai import ChatGoogleGenerativeAI
from headline_parser import headline_parser

llm = ChatGoogleGenerativeAI()
response = headline_parser("Your news headline", llm=llm)
print(response)

For higher rate limits with LLM7, you can obtain a free API key by registering at https://token.llm7.io/ and pass it either as an environment variable or directly to the function:

from headline_parser import headline_parser

# Via environment variable
os.environ["LLM7_API_KEY"] = "your_api_key"

# Or directly
response = headline_parser("Your news headline", api_key="your_api_key")
print(response)

Contributing

Found an issue or have a feature request? Please report them on GitHub.

Author

Eugene Evstafev (hi@eugene.plus)

Release files for headline-parser 2025.12.21175317

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

Source distribution (sdist)

Source distribution for headline-parser 2025.12.21175317
File Size Uploaded
headline_parser-2025.12.21175317.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for headline-parser 2025.12.21175317
File Interpreter ABI Platform
headline_parser-2025.12.21175317-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / headline_parser-2025.12.21175317.tar.gz

Download URL headline_parser-2025.12.21175317.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
387716232fb85046ff0115a9632ea84ed59d9a3d6ec159d1ec3b86f719077a07
BLAKE2b-256 checksum
How to use checksums
386daba79866aebff3767c574bbbbdef3e7cdf46c81252dc9c20ef433caa87e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / headline_parser-2025.12.21175317-py3-none-any.whl

Download URL headline_parser-2025.12.21175317-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
631fb42bb7e5b748a6417a9d9a10d44d7796608de99a235dea912452cfa3abe4
BLAKE2b-256 checksum
How to use checksums
af5c6ca4febf44aad3283eb6588d5c37ac8ddd37be76f5f55e2efbb748acdbd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2025.12.21175317 This release

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