Metadata-Version: 2.5
Name: fl-style-transfer
Version: 0.2.0
Summary: Profile-conditioned author style transfer for LLM agents
Author-email: Igor Beschastnov <i.beschastnov@focuslabs.ru>
License-Expression: MIT
License-File: LICENSE
Keywords: agent,authorship,llm,profile,style-transfer,writing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Text Processing :: Linguistic
Requires-Python: <3.13,>=3.12
Requires-Dist: diversity==0.3.1
Requires-Dist: elfen==1.3.3
Requires-Dist: markdown-it-py
Requires-Dist: numpy<3
Requires-Dist: odfpy
Requires-Dist: openai
Requires-Dist: polars
Requires-Dist: pymupdf
Requires-Dist: python-docx
Requires-Dist: python-dotenv
Requires-Dist: pyyaml
Requires-Dist: scikit-learn
Requires-Dist: scipy
Requires-Dist: sentence-transformers>=4.0
Requires-Dist: stanza<2,>=1.14.0
Requires-Dist: statsmodels
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Description-Content-Type: text/markdown

# fl-style-transfer

Профиль-ориентированный перенос авторского стиля для LLM-агентов:
по корпусу текстов автора строится профиль (признаки, эмбеддинги, словарь
функций абзацев), а генерация новых текстов в этом профиле выполняется
агентом с проверкой содержания и форматирования.

Пакет предназначен для использования из agent skill (см.
`candidate_skill/` в репозитории) и как библиотека CLI.

## Установка

```bash
uvx fl-style-transfer --help
# или
pip install fl-style-transfer
```

Модели (Stanza ru, эмбеддинги) скачиваются при первом запуске:
по умолчанию в XDG-кэш (`~/.cache/fl-style-transfer`), либо в папку,
указанную переменными `FL_STYLE_DATA_DIR` (профили/индексы) и
`FL_STYLE_CACHE_DIR` (модели).

## CLI

```bash
# профиль автора из корпуса
fl-style-transfer profile build --input corpus/author1 --output profiles/author1 --config ru.yaml
fl-style-transfer profile inspect profiles/author1

# сравнение текста с профилем (диагностика, JSON)
fl-style-transfer compare --profile profiles/author1 --text draft.md --json

# skill-команды (автономный agent skill)
fl-style-transfer skill setup      --skill-dir . --corpus corpus/author1 --author author1
fl-style-transfer skill warmup
fl-style-transfer skill labels import --profile profiles/author1/ru-v1 --labels data/labels.jsonl
fl-style-transfer skill retrieve   --profile profiles/author1/ru-v1 --brief-file brief.md --plan-file plan.md --out prompt.md
fl-style-transfer skill check      --text candidate.md --brief-file brief.md --anchors anchors.json --profile profiles/author1/ru-v1
```

## Первый запуск (skill)

1. Положить тексты автора в `corpus/<author_id>/` (txt/md/docx/odt/pdf).
2. `fl-style-transfer skill setup --skill-dir . --corpus corpus/<author_id> --author <author_id>`
   — строит профиль, экспортирует задание на разметку абзацев
   (`data/label_job.jsonl` + `data/labeler_prompt.md`).
3. Разметить абзацы своим LLM (формат JSONL: `unit_id`, `dominant`,
   `secondary`, `confidence`) и импортировать:
   `fl-style-transfer skill labels import --profile profiles/<author_id>/ru-v1 --labels data/labels.jsonl`.
4. Дальше: `skill retrieve` собирает промпт для субагента (примеры автора +
   план), `skill check` проверяет кандидата (якоря, форматирование,
   шаблонные клише, англицизмы) и возвращает exit code 1 при провале.

## Лицензия

MIT
