File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,12 @@ int32_t fossil_soap_count_offensive(const char *input);
5454 */
5555int32_t fossil_soap_count_rotbrain (const char *input);
5656
57+ /* *
58+ * Check if a string is context-aware.
59+ * Returns EXIT_FAILURE if the string is context-aware, EXIT_SUCCESS otherwise.
60+ */
61+ int32_t fossil_soap_context_aware (const char *input);
62+
5763#ifdef __cplusplus
5864}
5965
@@ -114,6 +120,14 @@ namespace fossil {
114120 static int32_t count_rotbrain (const char *input) {
115121 return fossil_soap_count_rotbrain (input);
116122 }
123+
124+ /* *
125+ * Check if a string is context-aware.
126+ * Returns EXIT_FAILURE if the string is context-aware, EXIT_SUCCESS otherwise.
127+ */
128+ static int32_t context_aware (const char *input) {
129+ return fossil_soap_context_aware (input);
130+ }
117131 };
118132 }
119133}
Original file line number Diff line number Diff line change @@ -174,3 +174,15 @@ int32_t fossil_soap_count_offensive(const char *input) {
174174int32_t fossil_soap_count_rotbrain (const char * input ) {
175175 return count_matches (input , FOSSIL_SOAP_ROTBRAIN , sizeof (FOSSIL_SOAP_ROTBRAIN ) / sizeof (* FOSSIL_SOAP_ROTBRAIN ));
176176}
177+
178+ int32_t fossil_soap_context_aware (const char * input ) {
179+ int offensive_count = fossil_soap_count_offensive (input );
180+ int rotbrain_count = fossil_soap_count_rotbrain (input );
181+
182+ if (offensive_count > 0 ) {
183+ return 1 ; // Offensive content detected
184+ } else if (rotbrain_count > 0 ) {
185+ return 2 ; // Rotbrain content detected
186+ }
187+ return 0 ; // No offensive or rotbrain content detected
188+ }
You can’t perform that action at this time.
0 commit comments