2020extern " C" {
2121#endif
2222
23- /**
24- * Tokenization: Split input into words and check for offensive language and meme speak.
25- */
26- void fossil_soap_tokenize_and_process (char * input );
27-
28- /**
29- * Run fuzzer and test the enhanced sanitization.
30- * Fuzzed inputs are generated and passed through the sanitization function to check robustness.
31- */
32- void fossil_soap_fuzzer (const char * input );
33-
3423/* *
35- * Utility: Trim extra spaces and ensure proper sentence capitalization.
36- * Ensures that the input string has only single spaces between words and proper sentence capitalization.
37- */
38- void fossil_soap_correct_grammar (char * input );
39-
40- /**
41- * Main sanitization function: Handles offensive words, meme speak, synonyms, and grammar correction.
42- * Sanitizes the input string based on predefined rules for offensive words, meme speak, and synonyms.
24+ * Sanitize a string by replacing curse words with asterisks.
25+ * This function scans the input string for offensive words and replaces them with asterisks,
26+ * thereby making the string suitable for use in contexts where offensive language is not allowed.
27+ * The input string is modified in place.
28+ *
29+ * @param input The input string to be sanitized in-place.
4330 */
4431void fossil_soap_sanitize (char *input);
4532
4633/* *
47- * Check if a word is offensive.
34+ * Check if a word is an offensive word or phrase .
4835 * Returns EXIT_FAILURE if the word is considered offensive, EXIT_SUCCESS otherwise.
4936 */
5037int32_t fossil_soap_is_offensive (const char *word);
@@ -69,6 +56,68 @@ int32_t fossil_soap_count_rotbrain(const char *input);
6956
7057#ifdef __cplusplus
7158}
59+
60+ /* *
61+ * C++ wrapper for the SOAP API.
62+ */
63+ namespace fossil {
64+
65+ /* *
66+ * Namespace for I/O operations.
67+ */
68+ namespace io {
69+ /* *
70+ * SOAP API for sanitizing strings.
71+ */
72+ class Soap {
73+ public:
74+ /* *
75+ * Sanitize a string by replacing curse words with asterisks.
76+ * This function scans the input string for offensive words and replaces them with asterisks,
77+ * thereby making the string suitable for use in contexts where offensive language is not allowed.
78+ * The input string is modified in place.
79+ *
80+ * @param input The input string to be sanitized in-place.
81+ */
82+ static void sanitize (char *input) {
83+ fossil_soap_sanitize (input);
84+ }
85+
86+ /* *
87+ * Check if a word is an offensive word or phrase.
88+ * Returns EXIT_FAILURE if the word is considered offensive, EXIT_SUCCESS otherwise.
89+ */
90+ static int32_t is_offensive (const char *word) {
91+ return fossil_soap_is_offensive (word);
92+ }
93+
94+ /* *
95+ * Check if a word is meme speak.
96+ * Returns EXIT_FAILURE if the word is considered meme speak, EXIT_SUCCESS otherwise.
97+ */
98+ static int32_t is_rotbrain (const char *word) {
99+ return fossil_soap_is_rotbrain (word);
100+ }
101+
102+ /* *
103+ * Count offensive words in a string.
104+ * Returns the number of offensive words found in the input string.
105+ */
106+ static int32_t count_offensive (const char *input) {
107+ return fossil_soap_count_offensive (input);
108+ }
109+
110+ /* *
111+ * Count meme speak words in a string.
112+ * Returns the number of meme speak words found in the input string.
113+ */
114+ static int32_t count_rotbrain (const char *input) {
115+ return fossil_soap_count_rotbrain (input);
116+ }
117+ };
118+ }
119+ }
120+
72121#endif
73122
74123#endif /* FOSSIL_IO_FRAMEWORK_H */
0 commit comments