Questions tagged [nltk-book]

48 questions
-1
votes
2 answers

How do I read the following lines of code?

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…
Lihka_nonem
  • 352
  • 1
  • 8
-1
votes
2 answers

Python NLTK Inaugural Text Corpora hands-on solution needed

I am doing a course in NLTK Python which has a hands-on problem(on Katacoda) on "Text Corpora" and it is not accepting my solution mentioned below. Have been stuck on this problem since long. Need to complete this hands-on to proceed foreword in…
Tanuj Chadha
  • 1
  • 1
  • 2
-2
votes
3 answers

How do I write this into a function in Python 3?

How would I write this into a function that gives the same output? from nltk.book import text2 sorted([word.lower() for word in text2 if len(word)>4 and len(word)<12])
sarkle
  • 23
  • 3
1 2 3
4