File size: 1,538 Bytes
0fcc7ea | 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | """Minimal usage example for hv-wall."""
from hv_wall import HVWall
TEXT = (
"The data suggests some correlation between the policy and the outcome. "
"Results appear to indicate a modest effect in some subpopulations. "
"The mechanism remains unclear, and further work is needed to establish "
"causality. "
"Therefore, the policy definitively causes the outcome in all cases, "
"and this is unquestionably proven by the evidence."
)
def main() -> None:
model = HVWall()
report = model.analyze(TEXT)
print("=" * 60)
print("hv-wall")
print("=" * 60)
print(model.render(report))
print()
print("=" * 60)
print("Numeric summary")
print("=" * 60)
print(f" sentences : {report.n_sentences}")
print(f" words : {report.n_words}")
print(f" wall_id : {report.wall_id}")
print(f" wall_type : {report.wall_type}")
print(f" wall_score : {report.wall_score:.4f}")
print(f" conf style : {report.confidence_style}")
print(f" evid style : {report.evidence_style}")
print(f" trust curve : "
+ " ".join(f"{v:.2f}" for v in report.trust_curve))
print()
print("=" * 60)
print("Wall sentence")
print("=" * 60)
print(f" \"{report.wall_text}\"")
print()
print("=" * 60)
print("Reasons")
print("=" * 60)
if report.wall_id is not None:
for r in report.profiles[report.wall_id].reasons:
print(f" - {r}")
print()
if __name__ == "__main__":
main() |