NlpTools API
Class

NlpTools\Utils\Normalizers\Normalizer

abstract class Normalizer implements TransformationInterface

The Normalizer's purpose is to transform any word from any one of the possible writings to a single writing consistently.

A lot of algorithms for stemming already expect normalized text.

The most common normalization would be to transform the words to
lower case. There are languages though that this is not enough
since there maybe other diacritics that need to be removed.

E.g.: The -> the
I -> i
WhAtEvEr -> whatever
Άγγελος -> αγγελοσ
Αριστοτέλης -> αριστοτελησ

Methods

string normalize(string $w)

Transform the word according to the class description

mixed transform($w)

Return the value transformed.

array normalizeAll(array $items)

Apply the normalize function to all the items in the array

static  factory(string $language = 'English')

Just instantiate the normalizer using a factory method.

Details

at line 30
abstract public string normalize(string $w)

Transform the word according to the class description

Parameters

string $w The word to normalize

Return Value

string

at line 35
public mixed transform($w)

Return the value transformed.

Parameters

$w

Return Value

mixed

at line 45
public array normalizeAll(array $items)

Apply the normalize function to all the items in the array

Parameters

array $items

Return Value

array

at line 60
static public factory(string $language = 'English')

Just instantiate the normalizer using a factory method.

Keep in mind that this is NOT required. The constructor IS
visible.

Parameters

string $language