I watched the NLP lecture in Part I and was wondering if we can use RNNs to fill in the blanks of a sentence instead of predicting the next word given the previous word(s).
For example, if my input is: shirt, blue, can an RNN be trained to generate a complete sentence like “The man in the park was wearing a blue shirt”.
Can someone please tell me the kind of things that I will need to consider and any tips/tricks?
Here’s what I think about your question. Hope it helps in some way
I think for the case you are asking about, you want the model to generate a series of surrounding words given any two (or more) words. The model would need to learn (during training) to generate the next words based on the current word as well as the previous words given the current word. So it needs to know how to construct sentences in both directions.
During inference, it would take the input words, and start generating words to the left and right until reaching the end of sentence.
I believe you can achieve this by training two language models, one trained on the original sentences. The other trained on the inverse of those sentences.
When you become familiar with this, I think bi-directional RNNs were designed for this purpose (check this link perhaps)
2 language models might be a good start. It probably would not produce an overall coherent sentence, since they would be generating words independent of each other (left phrase wouldn’t be related to right phrase)
As a final note, I don’t think a simple language model given (shirt, blue), would put it in a correct order ‘blue shirt’ unless it was optimized for it -but I might be wrong.