feat: add C++ port of isspam with updated tokenizer and benchmark integration

Add a new C++ implementation of the isspam text analysis tool in retoor_c/isspam.cpp, mirroring the C version's functionality with thread-based file analysis. Update the Makefile with a build_cpp target and add the new binary to .gitignore. Modify bench.py to include timing for the C++ executable. Fix the C tokenizer's delimiter string from punctuation-only to include all standard whitespace characters (\f\v\r\n\t).
This commit is contained in:
2025-03-20 14:27:02 +00:00
parent 4b44ad85ec
commit ca42ad8abc
5 changed files with 140 additions and 8 deletions
+3 -3
View File
@@ -98,7 +98,7 @@ void* analyze_file(void* arg) {
}
char *saveptr;
char* token = strtok_r(text, " .?!;:\n", &saveptr);
char* token = strtok_r(text, " \f\v\r\n\t", &saveptr);
while (token != NULL) {
word_count++;
@@ -117,7 +117,7 @@ void* analyze_file(void* arg) {
forbidden_count++;
}
token = strtok_r(NULL, " .?!;:\n", &saveptr);
token = strtok_r(NULL, " \f\v\r\n\t", &saveptr);
}
result->total_word_count = word_count;
@@ -180,4 +180,4 @@ int main(int argc, char *argv[]) {
printf("Word count per sentence: %.6f\n", word_count_per_sentence);
printf("Total files read: %d\n", (int)(argc - 1));
return 0;
}
}