/**
 * @copyright Sister Software
 * @license AGPL-3.0
 * @author Teffen Ellis, et al.
 */
import { PhraseClassifier, prepareLocaleIndex } from "mailwoman/core";
export class SurnameClassifier extends PhraseClassifier {
    async ready() {
        const languages = this.languages || ["all"];
        this.index = await prepareLocaleIndex(languages, "surnames.txt", {
            lowercase: true,
            // Omit short names
            minLength: 3,
        });
        return this;
    }
    explore(span) {
        if (span.flags.has("numeral"))
            return;
        const languages = this.index.get(span.normalized);
        if (languages) {
            span.classifications.add({
                classification: "surname",
                languages,
            });
        }
    }
}
//# sourceMappingURL=SurnameClassifier.js.map