Preparing Inputs for ELMo
Learn to prepare the inputs for ELMo embeddings.
We'll cover the following...
Here, we’ll define a function that will convert a given list of strings to the format ELMo expects the inputs to be in. Remember that we set the signature of ELMo to be tokens
. An example input to the signature tokens
would look as follows.
{'tokens': [['the', 'cat', 'sat', 'on', 'the', 'mat'],['the', 'mat', 'sat', '', '', '']],'sequence_len': [6, 3]}
Let’s take a moment to process what the input comprises. First, it has the key tokens
, which has a list of tokens. Each list of tokens can be thought of as ...