File size: 1,078 Bytes
5dd85ab 2279b28 5dd85ab | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | """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")
|