File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -249,10 +249,10 @@ impl<'g> HallucinationDetector<'g> {
249249
250250 for unit in self . graph . units ( ) {
251251 let u_lower = unit. name . to_lowercase ( ) ;
252- if u_lower. starts_with ( & lower) || lower. starts_with ( & u_lower) {
253- if !results. iter ( ) . any ( |( n, _) | * n == unit. name ) {
254- results . push ( ( unit . name . clone ( ) , 0 ) ) ;
255- }
252+ if ( u_lower. starts_with ( & lower) || lower. starts_with ( & u_lower) )
253+ && !results. iter ( ) . any ( |( n, _) | * n == unit. name )
254+ {
255+ results . push ( ( unit . name . clone ( ) , 0 ) ) ;
256256 }
257257 }
258258
@@ -263,7 +263,7 @@ impl<'g> HallucinationDetector<'g> {
263263
264264/// Split text into individual claim sentences.
265265fn split_into_claims ( text : & str ) -> Vec < String > {
266- text. split ( | c : char | c == '.' || c == '\n' )
266+ text. split ( [ '.' , '\n' ] )
267267 . map ( |s| s. trim ( ) . to_string ( ) )
268268 . filter ( |s| !s. is_empty ( ) && s. len ( ) > 5 )
269269 . collect ( )
You can’t perform that action at this time.
0 commit comments