Compute and return thresholds considering the occurrence of all tokens.
(
minimum_coverage,
length,
high_length,
_MIN_MATCH_HIGH_LENGTH=MIN_MATCH_HIGH_LENGTH,
_MIN_MATCH_LENGTH=MIN_MATCH_LENGTH,
)
| 2627 | |
| 2628 | |
| 2629 | def compute_thresholds_occurences( |
| 2630 | minimum_coverage, |
| 2631 | length, |
| 2632 | high_length, |
| 2633 | _MIN_MATCH_HIGH_LENGTH=MIN_MATCH_HIGH_LENGTH, |
| 2634 | _MIN_MATCH_LENGTH=MIN_MATCH_LENGTH, |
| 2635 | ): |
| 2636 | """ |
| 2637 | Compute and return thresholds considering the occurrence of all tokens. |
| 2638 | """ |
| 2639 | if minimum_coverage == 100: |
| 2640 | min_matched_length = length |
| 2641 | min_high_matched_length = high_length |
| 2642 | return minimum_coverage, min_matched_length, min_high_matched_length |
| 2643 | |
| 2644 | if length < 3: |
| 2645 | min_high_matched_length = high_length |
| 2646 | min_matched_length = length |
| 2647 | minimum_coverage = 100 |
| 2648 | |
| 2649 | elif length < 10: |
| 2650 | min_matched_length = length |
| 2651 | min_high_matched_length = high_length |
| 2652 | minimum_coverage = 80 |
| 2653 | |
| 2654 | elif length < 30: |
| 2655 | min_matched_length = length // 2 |
| 2656 | min_high_matched_length = min(high_length, _MIN_MATCH_HIGH_LENGTH) |
| 2657 | minimum_coverage = 50 |
| 2658 | |
| 2659 | elif length < 200: |
| 2660 | min_matched_length = _MIN_MATCH_LENGTH |
| 2661 | min_high_matched_length = min(high_length, _MIN_MATCH_HIGH_LENGTH) |
| 2662 | # minimum_coverage = max(15, int(length//10)) |
| 2663 | |
| 2664 | else: # if length >= 200: |
| 2665 | min_matched_length = length // 10 |
| 2666 | min_high_matched_length = high_length // 10 |
| 2667 | # minimum_coverage = int(length//10) |
| 2668 | |
| 2669 | return minimum_coverage, min_matched_length, min_high_matched_length |
| 2670 | |
| 2671 | |
| 2672 | def compute_thresholds_unique( |