Missing normalization.

This commit is contained in:
Sergiotarxz 2023-09-04 17:48:50 +02:00
parent 4eeed20efc
commit 077ae5afd2
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package BurguillosInfo::IndexUtils;
use v5.36.0;
use strict;
use warnings;
use utf8;
use feature 'signatures';
use Unicode::Normalize qw/NFKD/;
use Moo;
sub normalize($self, $text) {
return undef if !defined $text;
my $decomposed = NFKD( $text );
$decomposed =~ s/\p{NonspacingMark}//g;
$decomposed =~ s/s\b//g;
$decomposed =~ s/a\b/o/g;
return $decomposed;
}
sub n(@args) {
normalize(@args);
}
1;