Tokenizing a string having double quotes

Viewed 703

I have a string in the form :

'I am going to visit "Huge Hotel" and the "Grand River"'

I want it tokenized as

['I', 'am', 'going',..., 'Huge Hotel','and' ,'the' ,'Grand River']

As seen 'Huge Hotel' and 'Grand River' are taken as a single word as they were present in quotes.

import nltk
text = 'I am going to visit "Huge Hotel" and the "Grand River"'
b = nltk.word_tokenize(text)

I have written above code but it does'nt work

1 Answers
Related