<gh_stars>1-10
"""
fasttext embedding functionality

The important function here is 'embed' which has signature
embed :: String -> [Float], everything else should just be part of it
"""

#-- Imports ---------------------------------------------------------------------
# base
import functools

from typing import List, NewType

# third party
import fastText
import toml


#-- Type synonyms ---------------------------------------------------------------
Model = NewType('Model', fastText.FastText._FastText)


#-- Definitions -----------------------------------------------------------------

# variables
config = toml.load('config.ini')
model = fastText.load_model(config['fasttext']['model'])


def embedding(m: Model, x : str) -> List[float]:
    return m.get_word_vector(x)

embed_ = functools.partial(embedding, model)
embed  = functools.partial(map, embed_)

"""
fasttext embedding functionality

The important function here is 'embed' which has signature
embed :: String -> [Float], everything else should just be part of it
"""

#-- Imports ---------------------------------------------------------------------
# base
import functools

from typing import List, NewType

# third party
import fastText
import toml


#-- Type synonyms ---------------------------------------------------------------
Model = NewType('Model', fastText.FastText._FastText)


#-- Definitions -----------------------------------------------------------------

# variables
config = toml.load('config.ini')
model = fastText.load_model(config['fasttext']['model'])


def embedding(m: Model, x : str) -> List[float]:
    return m.get_word_vector(x)

embed_ = functools.partial(embedding, model)
embed  = functools.partial(map, embed_)
fasttext embedding functionality  The important function here is 'embed' which has signature embed :: String -> [Float], everything else should just be part of it #-- Imports --------------------------------------------------------------------- # base # third party #-- Type synonyms --------------------------------------------------------------- #-- Definitions ----------------------------------------------------------------- # variables