分享方式:


microsoftml.n_gram:使用 n-gram 將文字轉換成特徵

使用方式

microsoftml.n_gram(ngram_length: numbers.Real = 1,
    skip_length: numbers.Real = 0, all_lengths: bool = True,
    max_num_terms: list = [10000000], weighting: str = 'Tf')

Description

從文字中擷取 NGram,並使用字典將其轉換成向量。

引數

ngram_length

Ngram 長度 (設定)。

skip_length

建構 ngram 時所要略過的 Token 數目上限 (設定)。

all_lengths

是否包括最多 NgramLength 的所有 ngram 長度,還是只包括 NgramLength (設定)。

max_num_terms

要儲存在字典中的 ngram 數目上限 (設定)。

weighting

加權準則 (設定)。

另請參閱

n_gram_hashfeaturize_text