Extract causal relation sentences from macroeconomic news articles
Project description
macroextract
Extract causal relation sentences from macroeconomic news articles.
Installation
pip install macroextract
python -m spacy download en_core_web_md
Usage
CLI
# Extract relations from test articles
macro bench extract_all
# Verbose output with sentences
macro bench extract_all -v
# Filter by filename pattern
macro bench extract_all "bbc*"
# Debug sentence structure
macro debug sentence "Inflation rose due to supply constraints."
Python API
import macroextract
# Extract all sentences with context
all_sentences = macroextract.extract(article_text)
# Extract only causal relation sentences with context
relations = macroextract.extract_relations(article_text)
for r in relations:
print(r["sentence"])
print(r["time"])
print(r["place"])
Output Format
sentence: "Tobacco prices grew largely due to duty rises announced in the Budget."
time: November
place: (none)
Causal Markers
The extractor identifies sentences containing causal language:
- Connectors: because, due to, after, following, amid
- Verbs: cause, trigger, fuel, drive, support, spark, spur, dampen, contribute, push
- Nouns: contributor, driver, factor, catalyst, impact
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
macroextract-0.1.1.tar.gz
(7.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file macroextract-0.1.1.tar.gz.
File metadata
- Download URL: macroextract-0.1.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1ac958b1727689a993dc14fbbbc610598716fc460dc02d481c0bf2bea841647
|
|
| MD5 |
b75a380204ce36a21e1eee3dd16e5a2d
|
|
| BLAKE2b-256 |
7357be1d7e4f7e055bd0507efa37793bb316e2be4681468b52e4e6b3f726cda0
|
File details
Details for the file macroextract-0.1.1-py3-none-any.whl.
File metadata
- Download URL: macroextract-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6772224b3aa6d7d8692c340ecb3b4de53c0424927ab9c3f642f4228c1d256ca9
|
|
| MD5 |
2d025a6b46187c8c19c52011b815c772
|
|
| BLAKE2b-256 |
de783d9feb00cdbf4fb5dc5fff04aaceb23ecbdbe2e60439be025c7478f6f456
|