Spaces:
Running
Running
unknown
Claude Opus 5.5
Harden rewrite integrity, stop the final polish undoing humanization, add tests
585f232 Download tests/test_pubrules.py from Rasheed/Test_AI_writing: direct link, hf CLI and curl.
- Browser
- Download file 2.58 kB
-
https://huggingface.co/spaces/Rasheed/Test_AI_writing/resolve/main/tests/test_pubrules.py
- Command line
-
hf download hf://spaces/Rasheed/Test_AI_writing/tests/test_pubrules.py
-
curl -L -o test_pubrules.py https://huggingface.co/spaces/Rasheed/Test_AI_writing/resolve/main/tests/test_pubrules.py
2.58 kB
| import pubrules as PR | |
| def test_identical_and_faithful_rewrites_pass(): | |
| o = "The value rose to 5 % at 20 °C, which suggests a thermal effect." | |
| assert PR.violations(o, o) == [] | |
| assert PR.violations(o, "The value rose to 5% at 20°C, suggesting a thermal effect.") == [] | |
| def test_numbers_and_units(): | |
| assert "numbers or units changed" in PR.violations("The drop was 5 ms.", "The drop was 5 s.") | |
| assert "numbers or units changed" in PR.violations("We used 30 samples.", "We used 31 samples.") | |
| def test_negation_direction_and_strength(): | |
| assert "negation changed" in PR.violations("The filter does not remove noise.", "The filter removes noise.") | |
| assert any(v.startswith("direction reversed") for v in | |
| PR.violations("The error increased with depth.", "The error decreased with depth.")) | |
| assert "hedging removed (claim made stronger)" in PR.violations("This may reduce drift.", "This reduces drift.") | |
| assert "claim made stronger" in PR.violations("The model reduces drift.", "The model clearly reduces drift.") | |
| def test_reporting_verbs_are_not_hedges(): | |
| # "indicate" -> "show" is a normal paraphrase; "suggests" -> "shows" strengthens the claim | |
| assert PR.violations("The results indicate that X does not moderate Y.", | |
| "The results show that X does not moderate Y.") == [] | |
| assert PR.violations("This suggests that X moderates Y.", "This shows that X moderates Y.") == \ | |
| ["hedging removed (claim made stronger)"] | |
| assert PR.violations("This suggests that X moderates Y.", "This implies that X moderates Y.") == [] | |
| def test_one_sentence_in_one_out_and_acronyms(): | |
| assert "sentence split or merged" in PR.violations("The CNN works and it is fast.", "The CNN works. It is fast.") | |
| assert "acronym dropped" in PR.violations("The CNN works well here.", "The network works well here.") | |
| assert "acronym added" in PR.violations("The network works well here.", "The CNN works well here.") | |
| def test_no_added_cause_or_voice(): | |
| o = "The findings reveal that support mediates this relationship, suggesting that supported staff stay engaged." | |
| assert "causal link added" in PR.violations(o, "Because support mediates this relationship, supported staff " | |
| "are likely to stay engaged.") | |
| assert "first person plural added" in PR.violations("This study examines 412 workers.", "We examine 412 workers.") | |
| assert PR.violations("We examine 412 workers because data exist.", "We study 412 workers because data exist.") == [] | |