hv-reader / example.py
zeechimp's picture
Create example.py
6f36505 verified
Raw History Blame Contribute Delete
1.2 kB
"""Minimal usage example for hv-reader."""
from hv_reader import HVReader
TEXT = (
"The old man walked slowly to the boat. He stopped, looked at the "
"water, and then continued. The sea was quiet that morning. He "
"pushed the boat into the water and climbed in. The oars were cold "
"in his hands. He rowed out past the harbor and into the open sea."
)
def main() -> None:
model = HVReader()
profile = model.analyze(TEXT)
print("=" * 60)
print("hv-reader")
print("=" * 60)
print(model.render(profile))
print()
print("=" * 60)
print("Numeric summary")
print("=" * 60)
print(f" sentences : {profile.n_sentences}")
print(f" words : {profile.n_words}")
print(f" pace : {profile.pace:.4f}")
print(f" memory : {profile.memory:.4f}")
print(f" passes : {profile.passes:.4f}")
print(f" slip : {profile.slip:.4f}")
print(f" wall : {profile.wall:.4f}")
print(f" ttu_s : {profile.ttu_s:.2f}")
print(f" mean_wpm : {profile.mean_wpm:.1f}")
print(f" hunger_final : {profile.hunger_final:+.2f}")
print()
if __name__ == "__main__":
main()