Skip to contents

v_w = sum of the character n-gram vectors of the word. The boundary-marked whole word is always a gram.

Usage

morie_kamath_fasttext_subword(word, ngram_embeddings, n_min, n_max)

morie_kamath_word_ngrams(word, n_min, n_max, boundary = "<>")

Arguments

word

Word.

ngram_embeddings

Named list gram -> vector.

n_min, n_max

Gram length range.

boundary

Two-character boundary marker.

Value

List with vector, ngrams, n_known, missing.

Examples

morie_kamath_fasttext_subword("ab", list(`<a` = 1, ab = 2, `b>` = 3,
    `<ab>` = 4), 2, 2)
#> $vector
#> [1] 10
#> 
#> $estimate
#> [1] 10
#> 
#> $ngrams
#> [1] "<a"   "ab"   "b>"   "<ab>"
#> 
#> $n_known
#> [1] 4
#> 
#> $n_missing
#> [1] 0
#> 
#> $missing
#> character(0)
#> 
#> $n
#> [1] 4
#> 
#> $method
#> [1] "FastText subword sum v_w = sum z_g"
#>