silpa-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[silpa-discuss] Re: Optimization idea


From: Vasudev Kamath
Subject: [silpa-discuss] Re: Optimization idea
Date: Sat, 24 Apr 2010 20:16:02 +0530

Hi,
Idea looks good but i've some doubts here.
1. Index file is it based on first letters or language. What i meant is we will have a single file with words for all languages in it and index file contains starting line number for each languages or is it for each letter in each language?.
2. I looked at the linecache module, we have getline function which allows us  to get a particualar line specifed by line number. So we may need to loop to read all the words incrementing the line number
3. How we will know where the words starting with a letter comes to end. i.e is it sufficient only to have starting line number in the index file or do we need ending line number?. There is one way to calculate ending line number since index file contains next letter's starting index we can stop 1 line before that number but how about the processing complexity or implementation strategy?.

I may be wrong but it looks like over all processing requirements increases. What do you think about this there may be a better idea with you on all what i mentioned above.

On Sat, Apr 24, 2010 at 7:43 PM, Santhosh Thottingal <address@hidden> wrote:
Vasudev,
That is great idea. If we can keep the words in different buckets
based on the start letter, we effectively reduce the time to search
and get suggestions.
Having said that I guess there is another interesting way to achieve
this. How about this idea:
1. Keep all the words in single file itself.
2. Have an index file which will say : for this starting letter x,
this is the dictionary file and this is the starting line. Eg:
ക:456678 # all the words starting with ക is from line 456678
3. While reading the dictionary, we will do "random access" to the
dictionary file. Not by reading lines from top to bottom.

Look at the linecache  module of the python to see how we can achieve this.

Thanks
Santhosh



--
Vasudev Kamath
address@hidden
address@hidden
http://vasudevkamath.blogspot.com/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]