in ts/nlp/preprocessor.ts [149:182]
constructor() {
super();
// Cardinal Directions
this.rules.add(XRegExp("\\be\\b", "g"), "east");
this.rules.add(XRegExp("\\bn\\b", "g"), "north");
this.rules.add(XRegExp("\\bs\\b", "g"), "south");
this.rules.add(XRegExp("\\bw\\b", "g"), "west");
this.rules.add(XRegExp("\\bne\\b", "g"), "north east");
this.rules.add(XRegExp("\\bnw\\b", "g"), "north west");
this.rules.add(XRegExp("\\bse\\b", "g"), "south east");
this.rules.add(XRegExp("\\bsw\\b", "g"), "south west");
// Address Abbreviations
// Word boundary doesn't work after the "." so we need look-ahead.
this.rules.add(XRegExp("\\baly\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "alley");
this.rules.add(XRegExp("\\bave?\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "avenue");
this.rules.add(XRegExp("\\bblvd\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "boulevard");
this.rules.add(XRegExp("\\bbnd\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "bend");
this.rules.add(XRegExp("\\bcres\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "crescent");
this.rules.add(XRegExp("\\bcir\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "circle");
this.rules.add(XRegExp("\\bct\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "court");
this.rules.add(XRegExp("\\bdr\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "drive");
this.rules.add(XRegExp("\\best\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "estate");
this.rules.add(XRegExp("\\bln\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "lane");
this.rules.add(XRegExp("\\bpkwy\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "parkway");
this.rules.add(XRegExp("\\bpl\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "place");
this.rules.add(XRegExp("\\brd\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "road");
// Assume "st" at the beginning is for "saint".
this.rules.add(XRegExp("^st\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "saint");
// If "st" does not occur at the start of the string, then we cannot known if it is for "saint" or "street".
this.rules.add(XRegExp("\\bst\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "street");
this.rules.add(XRegExp("\\bxing\.?(?=[\\s\\p{P}\\p{S}]|$)", "g"), "crossing");
}