Metadata-Version: 2.1
Name: manifesto-model
Version: 0.1.1
Summary: Python package and web API for multilingual manifesto policy analysis.
Keywords: manifesto,policy,nlp,political-science,flask
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Framework :: Flask
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: Flask<4,>=3.0
Requires-Dist: huggingface-hub<2,>=0.30
Requires-Dist: joblib<2,>=1.4
Requires-Dist: numpy<3,>=1.26
Requires-Dist: pandas<3,>=2.2
Requires-Dist: scikit-learn<2,>=1.5
Requires-Dist: torch<2.6,>=2.5
Requires-Dist: transformers<5,>=4.46
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine<7,>=5; extra == "dev"
Provides-Extra: server
Requires-Dist: gunicorn<26,>=23; extra == "server"

# manifesto-model

`manifesto-model` is a Python package for multilingual manifesto policy analysis.

It provides:

- A Python inference API
- A Flask app factory for serving the model as an HTTP API
- Built-in macroeconomic lookup data from the `add/` directory

## Installation

```bash
pip install manifesto-model
```

If you are installing from the source repository:

```bash
pip install .
```

## Python usage

```python
from manifesto_model import create_service, predict

service = create_service()

result = service.predict(
    text="The government will expand industrial policy and labour training.",
    country="Japan",
    year=2026,
    top_k=5,
)

# Or use the convenience function:
result = predict(
    text="The government will expand industrial policy and labour training.",
    country="Japan",
    year=2026,
)
```

## Flask usage

```python
from manifesto_model.web import create_app

app = create_app()
```

## Command-line API server

After installation, you can start the packaged Flask server with:

```bash
manifesto-model-api
```

Environment variables:

- `PORT`
- `MODEL_PATH`
- `MODEL_REPO_ID`
- `MODEL_FILENAME`
- `HF_TOKEN`
- `TEXT_MODEL_NAME_OR_PATH`
- `TORCH_NUM_THREADS`
- `CORS_ALLOW_ORIGINS`

## Notes

- The packaged macro data currently supports years through `2026`.
- For `2024-2026`, macro variables use the expanded dataset columns, while the model year embedding falls back to the latest trained year (`2023`).
- Model weights are not bundled in the package. Use `MODEL_PATH` or Hugging Face Hub environment variables to provide them at runtime.
