diff --git a/README.md b/README.md index 17ac97f..348f662 100644 --- a/README.md +++ b/README.md @@ -22,15 +22,29 @@ cat ./spam/example_spam1.txt | ./isspam ``` ## Example output ``` -File: ./not_spam/not_spam1.txt -Capitalized words: 1 -Sentences: 5 -Words: 52 -Numbers: 0 -Forbidden words: 0 -Word count per sentence: 10 - -Memory usage: 29 KB, 479 (re)allocated, 327 unqiue free'd, 0 in use. +File: ./spam/example_spam3.txt +Capitalized words: 39 +Sentences: 20 +Words: 420 +Numbers: 1 +Forbidden words: 15 +<0:recovery> +<1:techie> +<2:https> +<3:digital> +<4:hack> +<5://> +<6:com> +<7:@> +<8:crypto> +<9:bitcoin> +<10:whatsapp> +<11:cryptocurrency> +<12:stolen> +<13:contact> +<14:understanding> +Word count per sentence: 21 +Memory usage: 1 MB, 6.460 (re)allocated, 4.222 unqiue free'd, 0 in use. ``` ## Valgrind status Date: 2024-11-28 @@ -45,4 +59,4 @@ Memory usage: 1 MB, 6.460 (re)allocated, 4.222 unqiue free'd, 0 in use. ==131498== ==131498== For lists of detected and suppressed errors, rerun with: -s ==131498== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) -``` \ No newline at end of file +``` diff --git a/isspam b/isspam index a4e5d89..8c32a25 100755 Binary files a/isspam and b/isspam differ diff --git a/isspam.c b/isspam.c index 96f42d0..95b3aac 100644 --- a/isspam.c +++ b/isspam.c @@ -321,7 +321,7 @@ void analyze(FILE *f) { stra(all, sbuf); free(sbuf); strd(all); - ulonglong word_count_per_sentence = words->count / sentences->count; + ulonglong word_count_per_sentence = words->count / (sentences->count ? sentences->count : 1); printf("Word count per sentence: %llu\n", word_count_per_sentence); slf(capitalized_words);