-1

Apologies for the basic question as I am quite new to the topic.

 conlltags = [(word, pos, chunktag) for ((word,pos),chunktag)
                     in zip(sentence, chunktags))]

Can you please break the code above in the format given below:

for i in exampleSentence:
    letterByLetter = i
    print(letterByLetter)
Lihka_nonem
  • 352
  • 1
  • 8

2 Answers2

1

The simpliest form I know:

conlltags = []
for i in range(min(len(sentence), len(chunktags))):
    conlltags.append((sentence[i][0], sentence[i][1], chunktags[i]))
0

I think it is better for you to look up the following subjects:

  • List comprehensions - link
  • zip() function - link

This will give you a better understanding of what is happening and it is very useful to use in one of your future projects!

Xander
  • 418
  • 2
  • 12