0

I am working on a NLP problem where I am given a sentence and I have to print some parts of sentence according to a specific rule (for example for "a truck is big" I have to print Nouns and adjective so output will be "truck big") Till now I have used POS tagger to tag sentences and used hardcoded If conditions to display output.

if arr[0][1]== 'DT' and arr[1][1]=='NN' and arr[2][1]=='VBZ' and arr[3][1]=='JJ':
    return arr[1][0] + " "+ arr[3][0]

Now I want to write rules in a text or csv and generate if conditions accordingly for example: if

DT NN VBZ JJ , NN JJ

is written in file it should display corresponding NN and JJ words ("truck big" in this case). In simple words I need inputs of my present if conditions from txt file. I know it's a very specific problem but it would be a big help to me.

Edit: arr is list of tuples.

Utsav Shukla
  • 47
  • 2
  • 8

0 Answers0