-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest_quality.py
More file actions
30 lines (28 loc) · 1.13 KB
/
test_quality.py
File metadata and controls
30 lines (28 loc) · 1.13 KB
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
#!/usr/bin/env python3
"""Test humanization quality."""
from texthumanize import humanize
text = (
"The implementation of artificial intelligence in healthcare represents "
"a significant paradigm shift. This comprehensive approach leverages "
"cutting-edge technology to facilitate unprecedented improvements in "
"diagnostic accuracy. Furthermore, these innovative solutions demonstrate "
"remarkable potential to transform the landscape of modern medicine."
)
result = humanize(text, lang="en", intensity=70)
print("INPUT:", text[:200])
print()
print("OUTPUT:", result["text"][:500])
print()
print("CHANGES:", len(result.get("changes", [])))
for c in result.get("changes", []):
orig = c.get("original", "")
repl = c.get("replacement", "")
desc = c.get("description", "")
if orig:
print(f" {c['type']}: '{orig}' -> '{repl}'")
elif desc:
print(f" {c['type']}: {desc}")
print()
print("SCORE BEFORE:", result.get("metrics_before", {}).get("artificiality_score"))
print("SCORE AFTER:", result.get("metrics_after", {}).get("artificiality_score"))
print("CHANGE RATIO:", result.get("change_ratio"))