AI Features

Generating Embeddings with ELMo

Learn to generate embeddings with ELMo and other embedding techniques.

Once the input is prepared, generating embeddings is quite easy. First, we’ll transform the inputs to the stipulated format of the ELMo layer. Here, we are using some example titles from the BBC dataset:

# Titles of 001.txt - 005.txt in bbc/business
elmo_inputs = format_text_for_elmo([
"Ad sales boost Time Warner profit",
"Dollar gains on Greenspan speech",
"Yukos unit buyer faces loan claim",
"High fuel prices hit BA's profits",
"Pernod takeover talk lifts Domecq"
])
...
Ask