Re: pseudo code
- From: Mark P <usenet@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Sep 2006 17:51:21 GMT
nicolas_laurent545@xxxxxxxxxxx wrote:
Not a programmer but need to understand this routine. Could someone
explains to me in plain words what
this pseudo code means. If you provide an example it would be very
appreciated. I understand the first part.
Many thanks
Find set of documents D in which all keywords (k1...km) in phrase occur
(using AND query processing).
Intitialize empty set, R, of retrieved documents.
For each document, d, in D:
Get array, Pi ,of positions of occurrences for each ki in d
Find shortest array Ps of the Pi's
For each position p of keyword ks in Ps
For each keyword ki except ks
Use binary search to find a position (p - s + i) in
the array Pi
If correct position for every keyword found, add d to R
Return R
You make this harder than it needs to be by not properly indicating subscripts or indices. It looks to me like the algorithm returns the subset R of the set of documents D such that, within each document of R, all of the words k_1 ... k_m occur consecutively and in that order.
e.g.,
K = "newsgroup post"
D[1] = "this is a newsgroup post"
D[2] = "this is a post to a newsgroup"
D[3] = "this newsgroup contains this post"
Then R contains only D[1].
Mark
.
- References:
- pseudo code
- From: nicolas_laurent545
- pseudo code
- Prev by Date: stack overflow error when using vector stl
- Next by Date: Re: file info
- Previous by thread: pseudo code
- Next by thread: Re: A "How would you do this" type of question.
- Index(es):
Relevant Pages
|
Loading