| """Quick check for sentence transforms.""" | |
| from __future__ import annotations | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent.parent | |
| sys.path.insert(0, str(ROOT)) | |
| from app.pipeline.orchestrator import rewrite_text | |
| text = ( | |
| "Automated software bug detection and repair play a significant role in " | |
| "improving software reliability while reducing development and maintenance costs." | |
| ) | |
| for tone in ["Neutral", "Casual", "Formal", "Academic"]: | |
| r = rewrite_text(text, tone=tone, strength=1) | |
| print(f"=== {tone} ===") | |
| print(r.text) | |
| low = r.text.lower() | |
| assert "aid enhance" not in low | |
| assert "assist enhance" not in low | |
| assert "package" not in low | |
| print() | |
| sample = ( | |
| "Climate change is reshaping agriculture across many regions of the world.\n\n" | |
| "Farmers must adapt their methods to survive longer droughts and unpredictable rainfall." | |
| ) | |
| r = rewrite_text(sample, tone="Neutral", strength=1) | |
| print("=== multi-para ===") | |
| print(r.text) | |
| assert "\n\n" in r.text | |
| print("OK") | |