| 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
|
|
|
| orig = (
|
| "Nowadays many peoples are living unhealthy life because they don't have "
|
| "enough times. Eating fast foods are becoming very common and peoples don't "
|
| "realizes how much it affect their health."
|
| )
|
|
|
| for tone, st in [("Neutral", 1), ("Academic", 2), ("Casual", 2)]:
|
| r = rewrite_text(orig, tone=tone, strength=st, preserve_length=True, ml_polish=False)
|
| print("===", tone, "strength", st, "| changed=", r.changed, "| engine=", r.engine)
|
| print(r.text)
|
| print("notes:", r.notes)
|
| print()
|
|
|
|
|
| assert "rapid food" not in " ".join(
|
| rewrite_text(orig, tone=t, strength=2, preserve_length=True).text.lower()
|
| for t in ("Neutral", "Academic", "Casual")
|
| )
|
|
|
| neutral = rewrite_text(orig, tone="Neutral", strength=1, preserve_length=True).text.lower()
|
| for bad in ("peoples", "don't realizes", "it affect "):
|
| assert bad not in neutral + " ", f"still present: {bad!r}"
|
| print("ALL ASSERTIONS PASSED")
|
|
|