""" Minimal usage example for hv-tempo. python example.py Runs the predictor on five contrasting texts and prints a comparison. """ from hv_tempo import HVTempo TEXTS = { "fiction": ( "The old man walked slowly to the boat. He stopped, looked at " "the water, and then continued. The sea was quiet that morning." ), "academic": ( "A black hole is a region of spacetime where gravity is so " "strong that nothing - no particles or even electromagnetic " "radiation such as light - can escape from it." ), "technical": ( "To install the package, first verify that your Python version " "is 3.9 or later. Then run the following command in your " "terminal. After installation, you may need to configure the " "API key." ), "list": ( "The main contributions are: " "1. A new algorithm for feature extraction. " "2. A proof of the reconstruction floor. " "3. Empirical validation on four encoders." ), "mixed": ( "Although the results are preliminary, they suggest that the " "method may generalize to other domains. However, the sample " "size is small, so the conclusions should be treated with " "caution. Further work is needed." ), } def main() -> None: m = HVTempo() print("=" * 72) print("hv-tempo comparison") print("=" * 72) print(f" {'name':<12} {'words':>6} {'wpm':>6} " f"{'duration':>9} {'variance':>9}") print(" " + "-" * 62) for name, text in TEXTS.items(): r = m.analyze(text) var = f"{r.pace_variance:.3f}" if r.pace_variance is not None else "n/a" print(f" {name:<12} {r.word_count:>6} {r.mean_wpm:>6.0f} " f"{r.total_duration_s:>8.2f}s {var:>9}") print() print("=" * 72) print("Detailed profile: academic") print("=" * 72) r = m.analyze(TEXTS["academic"]) print(m.render(r)) if __name__ == "__main__": main()