Re: [Tutor] matching words from a text to keys in a dictionary

2010-03-08 Thread Karjer Jdfjdf
I brew this up. It works, but I think it will be slow with a long text and a big dictionary def searchWord(text, dictionary):     '''search for terms in dictionary(key) and retrieve value(keywords)'''     text = text.split()     w = []     for word in text:     if word in dictionary:

Re: [Tutor] matching words from a text to keys in a dictionary

2010-03-08 Thread Karjer Jdfjdf
>>  I want to compare words in a text to a dictionary with values attached to >> the words. >> >> The dictionary  looks like: >> { word1: [1,2,3] word2: [2,3,4,a,b ] ... } >> > >Please give the actual dictionary, not something that it 'looks like' - an >actual dictionary would never 'look like' thi

Re: [Tutor] matching words from a text to keys in a dictionary

2010-03-08 Thread spir
On Mon, 8 Mar 2010 08:05:54 -0800 (PST) Karjer Jdfjdf wrote: > I want to compare words in a text to a dictionary with values attached to the > words. > > The dictionary  looks like: > { word1: [1,2,3] word2: [2,3,4,a,b ] ... } And how does your source text look like? (we have half of the data)

Re: [Tutor] matching words from a text to keys in a dictionary

2010-03-08 Thread Andre Engels
On Mon, Mar 8, 2010 at 5:05 PM, Karjer Jdfjdf wrote: > I want to compare words in a text to a dictionary with values attached to > the words. > > The dictionary looks like: > { word1: [1,2,3] word2: [2,3,4,a,b ] ... } > Please give the actual dictionary, not something that it 'looks like' - an

[Tutor] matching words from a text to keys in a dictionary

2010-03-08 Thread Karjer Jdfjdf
I want to compare words in a text to a dictionary with values attached to the words. The dictionary  looks like: { word1: [1,2,3] word2: [2,3,4,a,b ] ... } I'm trying to find a way to achieve this, but I'm having trouble getting corrects results. If I do the def below, nothing is matched. def