com.sun.tdk.specdiff.assertdiff

## Class DefaultNormalizer

- java.lang.Object
- - com.sun.tdk.specdiff.assertdiff.DefaultNormalizer

- All Implemented Interfaces:
    Normalizer

      public class DefaultNormalizer
      extends java.lang.Object
      implements Normalizer

  Default implementation of normalizer.
  See Also:
    `normalize(java.util.List)`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultNormalizer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `getMinimalLegnth()` Returns the minimal length of words to accept.
    `java.util.List<java.lang.String>` | `normalize(java.util.List<java.lang.String> words)` Normalizes given list of words.
    `protected java.lang.String` | `normalizeWord(java.lang.String word)` Normalized the given word.
    `protected java.lang.String` | `replaceWithSynonym(java.lang.String word)` Looks up for synonym.
    `protected void` | `setMinimalLegnth(int ml)` Sets minimal length of words.
    `protected java.lang.String` | `trimWord(java.lang.String word)` Trims the word.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultNormalizer

          public DefaultNormalizer()

  - ### Method Detail

    - #### normalize

          public java.util.List<java.lang.String> normalize(java.util.List<java.lang.String> words)

      Normalizes given list of words. This implementation:
      - normalizes each separate word
      - skips duplicates
      - sorts lexicographically
      Specified by:
        `normalize` in interface `Normalizer`
      Parameters:
        `words` - list to be normalized
      Returns:
        normalized list
      See Also:
        `normalizeWord(java.lang.String)`

    - #### normalizeWord

          protected java.lang.String normalizeWord(java.lang.String word)

      Normalized the given word. This method does the following:
      - converts to lower case
      - trims the word (remove leading and trailing symbols, which are not characters)
      - replaces with the synonym, if has.
      Parameters:
        `word` -
      Returns:
        normalized word, could return null if word could be ignored
      See Also:
        `trimWord(java.lang.String)`, `replaceWithSynonym(java.lang.String)`

    - #### trimWord

          protected java.lang.String trimWord(java.lang.String word)

      Trims the word. Removes leading and trailing characters if not letters. Words of length that less than minLenght are ignored.
      Parameters:
        `word` -
      Returns:
        normalized word or null if the word could be ignored

    - #### replaceWithSynonym

          protected java.lang.String replaceWithSynonym(java.lang.String word)

      Looks up for synonym.
      Parameters:
        `word` -
      Returns:
        synonym if found, or the original word if not

    - #### setMinimalLegnth

          protected void setMinimalLegnth(int ml)

      Sets minimal length of words. Words of length less than given value will be ignored.

    - #### getMinimalLegnth

          protected int getMinimalLegnth()

      Returns the minimal length of words to accept.