diff --git a/jest_rust/README.md b/jest_rust/README.md index ff93277..038c064 100644 --- a/jest_rust/README.md +++ b/jest_rust/README.md @@ -116,6 +116,22 @@ capitalized word percentage: 2% benchmark: 5033ms ``` +count forbidden word once only: +``` +file count: 904 +failed file count: 0 +sentence count: 5602301 +word count: 81701260 +capitalized count: 1753639 +numeric count: 14981248 +forbidden count: 1143234 +words per sentence average: 14.6 +forbidden word percentage: 1% +capitalized word percentage: 2% + +benchmark: 4737ms +``` + muncher: ``` file count: 904 @@ -130,4 +146,19 @@ forbidden word percentage: 0% capitalized word percentage: 16% benchmark: 504ms +``` +with forbidden words: +``` +file count: 904 +failed file count: 0 +sentence count: 5338705 +word count: 86765116 +capitalized count: 13640820 +numeric count: 10902254 +forbidden count: 279717 +words per sentence average: 16.3 +forbidden word percentage: 0% +capitalized word percentage: 16% + +benchmark: 6078ms ``` \ No newline at end of file diff --git a/jest_rust/src/main.rs b/jest_rust/src/main.rs index 19a93fd..9066c52 100644 --- a/jest_rust/src/main.rs +++ b/jest_rust/src/main.rs @@ -58,8 +58,8 @@ impl Stats { return; }; self.file_count += 1; - self.muncher(&text); - // self.for_loops(&text); + // self.muncher(&text); + self.for_loops(&text); } #[allow(dead_code)] /// probably buggy. for example, are new lines sentences? what if the text has no last period? @@ -89,6 +89,7 @@ impl Stats { for forbidden_word in FORBIDDEN_WORDS { if lowercase_word.contains(forbidden_word) { self.forbidden_count += 1; + break; //if you find one count it as a whole word } } word = String::new(); @@ -113,6 +114,7 @@ impl Stats { for forbidden_word in FORBIDDEN_WORDS { if lowercase_word.contains(forbidden_word) { self.forbidden_count += 1; + break; //if you find one count it as a whole word } } word = String::new(); @@ -161,6 +163,7 @@ impl Stats { for forbidden_word in FORBIDDEN_WORDS { if lowercase_word.contains(forbidden_word) { self.forbidden_count += 1; + break; //if you find one count it as a whole word } } }