Metadata-Version: 2.4
Name: macroextract
Version: 0.1.1
Summary: Extract causal relation sentences from macroeconomic news articles
License: MIT
Keywords: nlp,economics,causal-extraction,spacy
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: spacy>=3.0
Requires-Dist: click>=8.0

# macroextract

Extract causal relation sentences from macroeconomic news articles.

## Installation

```bash
pip install macroextract
python -m spacy download en_core_web_md
```

## Usage

### CLI

```bash
# 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

```python
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
