/**
 * @copyright Sister Software
 * @license AGPL-3.0
 * @author Teffen Ellis, et al.
 */
import { Span } from "mailwoman/core/tokenization";
export class WordClassifier {
    /**
     * A mapping of words to their originating languages.
     *
     * Each key is a word, and each value is a set of ISO 639-1 language codes.
     */
    index;
    languages;
    constructor({ languages } = {}) {
        this.languages = languages ? Array.from(languages) : undefined;
    }
    classifyTokens(context) {
        for (const [sectionIndex, section] of context.sections.entries()) {
            let childIndex = 0;
            for (const child of section.children) {
                this.explore(child, sectionIndex, childIndex);
                childIndex++;
            }
        }
    }
    classify(input) {
        const span = Span.from(input);
        this.explore(span);
        return span;
    }
}
//# sourceMappingURL=WordClassifier.js.map