Combining predictors in NLP model

Hi All,

I’m trying to modify the code from IMDB lesson 3 for a problem I’m working on.

This is simplified example of the problem. Basically I want to generate sentences based on other variables in my dataset.

data = [{‘sentence’: “I am GOING to SCHOOL TOMORROW”, ‘I’:True, ‘GOING’: True, ‘SCHOOL’:True, ‘TOMORROW’: True, ‘HARRY’:False, ‘WALKING’:False, ‘TOWN’:False, ‘TODAY’:False},
{‘sentence’: “HARRY is WALKING to TOWN TODAY”, ‘I’:False, ‘GOING’: False, ‘SCHOOL’:False, ‘TOMORROW’: False, ‘HARRY’:True, ‘WALKING’:True, ‘TOWN’:True, ‘TODAY’:True}]

The approach I have taken at the moment is by creating a new variable (comment) that is a concatenation of these with the sentence at the end

Example row 1
comment = “xxGOING = True | xxSCHOOL = True | xxTOMMOROW = True … | xxsentence = HARRY is WALKING to TOWN TODAY”

For prediction, I can then provide the first part of the comment and get a sentence prediction back.

So far it’s working with not a great performance. Is there another way in which I could tackle this problem, or a different way to pass parameters to the NLP model?

Thanks