Solved

search algorithms for searching a body of text

Posted on 2003-12-06
4
337 Views
Last Modified: 2010-04-17
Im looking for an efficent search algorithm which searches a body of text (under 3,000 words) looking for keywords.

What would be the best algorithm to employ.

The body of text may be a XML document (in which case id like to be able to search the XML elements eg search for 'Alan Turing' in the element tag author)

Thanks in adavance for any pointers
0
Comment
Question by:mellowmoose
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Author Comment

by:mellowmoose
ID: 9888361
To clarify a few points.

The document will be one ive never seen before.

I'd prefer to be able to search the XML b4 I parse it (if the keyowrds dont match then XML doc will not be (parsed)

Ill be using DOM parsing.

Thanks
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 125 total points
ID: 9888431
Hi mellowmoose,

since you are searching only under 300 words, even linear search should be fast enough on todays hardware

however, if you do wish take the troble of implementing efficient algorithms, I would recommend Aho Corasick algorithm

you can see a demo here
http://www-sr.informatik.uni-tuebingen.de/~buehler/AC/AC1.html

details of the algorithm
http://courses.cs.vt.edu/~algnbio/algnbio_2001/lectures/AhoCorasick.html

Cheers!
Sunny:o)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Simple Linear Regression

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question