Files
romanov_btg_rag/scripts/build_knowledge.py
T
anorandClaude Opus 4.8 e65e77cd0a chore: скелет проекта RAG-базы по БТГ Романова
Пакет rag/ (config, corpus, фазовые заглушки), CLI-скелеты scripts/,
docs (статус, глоссарий, инварианты), тесты инфраструктуры данных,
согласованный план пилота Фазы 1 (eval-first) в PROJECT_STATUS.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 14:25:08 +10:00

41 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""Фаза 1 — извлечение карточек знаний из транскриптов (+ кадров).
Запуск из корня проекта:
python scripts/build_knowledge.py --limit 5 --source manual
Сейчас скелет: показывает, что увидит конвейер, и где остановиться.
Реализация — в rag/extract/ (см. его TODO и ROADMAP Фаза 1).
"""
import argparse
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) # корень в путь
from rag import corpus # noqa: E402
def main() -> int:
ap = argparse.ArgumentParser(description="Фаза 1: транскрипт → карточки знаний")
ap.add_argument("--limit", type=int, default=0, help="сколько лекций (0 = все)")
ap.add_argument("--source", choices=["all", "mass", "manual"], default="all")
args = ap.parse_args()
items = [t for t in corpus.iter_transcripts()
if args.source == "all" or t.source == args.source]
if args.limit:
items = items[: args.limit]
print(f"К обработке: {len(items)} транскриптов (source={args.source})")
for t in items[:10]:
print(f" [{t.source}] {t.id}")
if len(items) > 10:
print(f" … ещё {len(items) - 10}")
print("\n[TODO] извлечение карточек ещё не реализовано — см. rag/extract/ и ROADMAP Фаза 1.")
return 0
if __name__ == "__main__":
raise SystemExit(main())