/**
 * @copyright Sister Software
 * @license AGPL-3.0
 * @author Teffen Ellis, et al.
 */
import { Alpha2LanguageCode, prepareLocaleIndex, WordClassifier } from "mailwoman/core";
export class ToponymClassifier extends WordClassifier {
    async ready() {
        const languages = this.languages ?? [Alpha2LanguageCode.English];
        this.index = await prepareLocaleIndex(languages, "toponyms.txt");
        return this;
    }
    explore(span) {
        if (span.flags.has("numeral"))
            return;
        const languages = this.index.get(span.normalized);
        if (!languages)
            return;
        span.classifications.add({
            classification: "toponym",
            confidence: 1,
            languages,
        });
    }
}
//# sourceMappingURL=ToponymClassifier.js.map