Skip to content

intersection query for relevant_pages and corresp test #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

bionascu
Copy link

Updated relevant_pages() in nlp.py to do an intersection query by intersecting the hit lists of the query terms, as described in the textbook. Previously the function was (incorrectly) returning pages that contain the query in its entirety (as a phrase).
Also updated corresponding test. This fixes issue #392

for addr in pagesIndex:
if query_word.lower() in pagesContent[addr].lower():
hit_list.add(addr)
intersection = hit_list if not intersection else intersection.intersection(hit_list)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would lead to problems when the intersection is an empty set. When the set becomes empty it is replaced by hit_list instead of staying empty. I've fixed this and the merge conflict in #509 .

@norvig
Copy link
Collaborator

norvig commented May 31, 2017

Due to @Chipe1 comment about #509, I'm going to close this for now ... could bring back the test later.

@norvig norvig closed this May 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy