| Akron | 5cf5fca | 2017-10-09 19:01:47 +0200 | [diff] [blame] | 1 | package Krawfish::Compile::Segment::Sort::Substring; |
| Akron | fac366e | 2017-02-23 15:54:26 +0100 | [diff] [blame] | 2 | use Krawfish::Log; |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | |
| Akron | 0f8fb08 | 2017-10-09 15:54:41 +0200 | [diff] [blame] | 6 | warn 'NOT USED YET'; |
| 7 | |
| Akron | fac366e | 2017-02-23 15:54:26 +0100 | [diff] [blame] | 8 | # To support C2-Wort-Type sorting based on word endings, |
| 9 | # It's necessary to support sorting based on substrings. |
| 10 | # |
| 11 | # EXAMPLE: |
| 12 | # Sort based on the last two characters of a word in the |
| 13 | # correct order: substring(-2,2) |
| 14 | # |
| 15 | # match1: D[er] al[te] Ma[nn] |
| 16 | # match2: D[er] gu[te] Schäf[er] |
| 17 | # |
| Akron | 184b2cf | 2017-08-20 20:51:21 +0200 | [diff] [blame] | 18 | # This requires that all terms of a class are fetched from |
| 19 | # the dictionary (or at least X characters). |
| Akron | fac366e | 2017-02-23 15:54:26 +0100 | [diff] [blame] | 20 | # Equal sequences will receive the same rank and can then be |
| 21 | # sorted alphabetically in the next run. |
| 22 | # Equal may mean that this is case insensitive. |
| 23 | |
| 24 | sub new { |
| 25 | my $class = shift; |
| 26 | bless { |
| 27 | offset => shift, # Supports negative offset |
| 28 | length => shift, |
| 29 | reverse => shift, # The substring is read from right to left |
| 30 | caseinsensitive => shift, |
| 31 | resolve_diacritiques => shift |
| 32 | }, $class; |
| 33 | }; |
| 34 | |
| 35 | |
| 36 | 1; |