Interface StatisticalUtilityAIConfig

Base configuration for any IUtilityAI implementation.

interface StatisticalUtilityAIConfig {
    utilityId?: string;
    defaultLanguage?: string;
    resourcePath?: string;
    defaultStopWordsLanguage?: string;
    customStopWordsPaths?: Record<string, string>;
    summarizerConfig?: {
        lexRank?: {
            similarityThreshold?: number;
            dampingFactor?: number;
            maxIterations?: number;
            epsilon?: number;
        };
    };
    classifierConfig?: {
        naiveBayes?: {
            modelStoragePath?: string;
            defaultModelId?: string;
            defaultAlpha?: number;
        };
    };
    sentimentConfig?: {
        lexiconPath?: string;
        defaultLexiconLanguage?: string;
    };
    languageDetectionConfig?: {
        nGramProfilePath?: string;
    };
    readabilitySyllableAlgorithm?: "regex_approx" | "dictionary_lookup";
}

Hierarchy (view full)

Properties

utilityId?: string

Unique identifier for this specific utility AI service instance.

defaultLanguage?: string

Default language for processing if not specified in method options (e.g., 'en', 'es'). BCP-47 format preferred.

resourcePath?: string

The folder a relative path in customStopWordsPaths, sentimentConfig.lexiconPath or a call's lexiconNameOrPath is read under. Naive Bayes models are kept under classifierConfig.naiveBayes.modelStoragePath.

defaultStopWordsLanguage?: string

Not read: stop words follow a call's language, else defaultLanguage.

customStopWordsPaths?: Record<string, string>

A stop-word file for each language code, one word a line.

summarizerConfig?: {
    lexRank?: {
        similarityThreshold?: number;
        dampingFactor?: number;
        maxIterations?: number;
        epsilon?: number;
    };
}

Not read: summarize() answers the first sentences of a text.

Type declaration

  • Optional lexRank?: {
        similarityThreshold?: number;
        dampingFactor?: number;
        maxIterations?: number;
        epsilon?: number;
    }
    • Optional similarityThreshold?: number
    • Optional dampingFactor?: number
    • Optional maxIterations?: number
    • Optional epsilon?: number
classifierConfig?: {
    naiveBayes?: {
        modelStoragePath?: string;
        defaultModelId?: string;
        defaultAlpha?: number;
    };
}

Type declaration

  • Optional naiveBayes?: {
        modelStoragePath?: string;
        defaultModelId?: string;
        defaultAlpha?: number;
    }
    • Optional modelStoragePath?: string
    • Optional defaultModelId?: string
    • Optional defaultAlpha?: number
sentimentConfig?: {
    lexiconPath?: string;
    defaultLexiconLanguage?: string;
}

Type declaration

  • Optional lexiconPath?: string

    A sentiment lexicon of your own: a JSON object of word to value, or one entry a line, the word, white space and the value (an AFINN file). Its entries join the lexicon of defaultLexiconLanguage, each replacing the built-in value of its word, and are read on that lexicon's scale: -5 to 5 where it is AFINN, -1 to 1 where it is pattern or senticon. In a language natural has no lexicon for, they are the lexicon, read on AFINN's scale. A relative path is read under resourcePath. A file that cannot be read or parsed logs a warning and adds nothing.

  • Optional defaultLexiconLanguage?: string

    The language a call that names none is scored in, and the language lexiconPath adds to. defaultLanguage unless given.

languageDetectionConfig?: {
    nGramProfilePath?: string;
}

Not read: detectLanguage() uses the package's built-in profiles.

Type declaration

  • Optional nGramProfilePath?: string
readabilitySyllableAlgorithm?: "regex_approx" | "dictionary_lookup"

Not read: syllables are counted by vowel groups.