UNPKG

symspell-ex

Version:

Spelling correction & Fuzzy search based on symmetric delete spelling correction algorithm

41 lines (40 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DictionaryEntry = exports.Correction = exports.Suggestion = exports.Token = void 0; class Token { constructor(value, tag, alphabet, distance = 0) { this.value = value; this.tag = tag; this.alphabet = alphabet; this.distance = distance; } } exports.Token = Token; class Suggestion { constructor(term, suggestion, distance = 0, frequency = 0) { this.term = term; this.suggestion = suggestion; this.distance = distance; this.frequency = frequency; } } exports.Suggestion = Suggestion; class Correction { constructor(input, output, suggestions = []) { this.suggestions = []; this.input = input; this.output = output; this.suggestions = suggestions; } } exports.Correction = Correction; class DictionaryEntry extends Array { constructor(frequency, ...suggestions) { super(); this.push(frequency || 0); if (suggestions.length > 0) { this.push(...suggestions); } } } exports.DictionaryEntry = DictionaryEntry;