Class Nysiis
Encodes a string into a NYSIIS value. NYSIIS is an encoding used to relate similar names, but can also be used as a general purpose scheme to find word with similar phonemes.
Inheritance
Assembly: Lucene.Net.Analysis.Phonetic.dll
Syntax
public class Nysiis : object, IStringEncoder
Remarks
NYSIIS features an accuracy increase of 2.7% over the traditional Soundex algorithm.
Algorithm description:
- Transcode first characters of name
- MAC -> MCC
- KN -> NN
- K -> C
- PH -> FF
- PF -> FF
- SCH -> SSS
- Transcode last characters of name
- EE, IE -> Y
- DT,RT,RD,NT,ND -> D
- First character of key = first character of name
- Transcode remaining characters by following these rules, incrementing by one character each time
- EV -> AF else A,E,I,O,U -> A
- Q -> G
- Z -> S
- M -> N
- KN -> N else K -> C
- SCH -> SSS
- PH -> FF
- H -> If previous or next is nonvowel, previous
- W -> If previous is vowel, previous
- Add current to key if current != last key character
- If last character is S, remove it
- If last characters are AY, replace with Y
- If last character is A, remove it
- Collapse all strings of repeated characters
- Add original first character of name as first character of key
This class is immutable and thread-safe.
See: NYSIIS on Wikipedia
See: NYSIIS on dropby.com
since 1.7
Constructors
Name | Description |
---|---|
Nysiis() | Creates an instance of the Nysiis encoder with strict mode (original form), i.e. encoded strings have a maximum length of 6. |
Nysiis(Boolean) | Create an instance of the Nysiis encoder with the specified strict mode:
|
Properties
Name | Description |
---|---|
IsStrict | Indicates the strict mode for this Nysiis encoder.
|
Methods
Name | Description |
---|---|
Encode(String) | Encodes a string using the NYSIIS algorithm. |
GetNysiis(String) | Retrieves the NYSIIS code for a given string. |