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:
>> 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
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)
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
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