Splitting Tree

subhabangalore at gmail.com subhabangalore at gmail.com
Sun Dec 2 07:09:32 EST 2012


Dear Group,

I am using NLTK and I used the following command,

chunk=nltk.ne_chunk(tag)
print "The Chunk of the Line Is:",chunk


The Chunk of the Line Is: (S
  ''/''
  It/PRP
  is/VBZ
  virtually/RB
  a/DT
  homecoming/NN
  ,/,
  ''/''
  said/VBD
  (PERSON Gen/NNP Singh/NNP)
  on/IN
  arrival/NN)

Now I am trying to split the output preferably by ",/,".

But how would I split a Tree object in python.

If I use command like,
chunk_word=chunk.split()

It is giving me the error as,

File "C:/Python27/docstructure1.py", line 38, in document_structure1
    chunk1=chunk.split()
AttributeError: 'Tree' object has no attribute 'split'

If anyone of the learned members of the room can kindly help.

Regards,
Subhabrata. 



More information about the Python-list mailing list