MCPcopy Create free account
hub / github.com/Open-Quant/openquant / match_length

Function match_length

crates/openquant/src/microstructural_features.rs:561–586  ·  view source on GitHub ↗
(message: &str, start: usize, window: usize)

Source from the content-addressed store, hash-verified

559}
560
561fn match_length(message: &str, start: usize, window: usize) -> usize {
562 let mut matched = 0usize;
563 let start_window = start.saturating_sub(window);
564 for length in 0..window {
565 let end1 = start + length + 1;
566 if end1 > message.len() {
567 break;
568 }
569 let msg1 = &message[start..end1];
570 for j in start_window..start {
571 let end0 = j + length + 1;
572 if end0 > message.len() {
573 continue;
574 }
575 let msg0 = &message[j..end0];
576 if msg0.len() != msg1.len() {
577 continue;
578 }
579 if msg0 == msg1 {
580 matched = msg1.len();
581 break;
582 }
583 }
584 }
585 matched + 1
586}
587
588pub fn get_konto_entropy(message: &str, window: usize) -> f64 {
589 if message.len() < 2 {

Callers 1

get_konto_entropyFunction · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected