intersection query for relevant_pages and corresp test#402
Closed
bionascu wants to merge 1 commit intoaimacode:masteraimacode/aima-python:masterfrom
Closed
intersection query for relevant_pages and corresp test#402bionascu wants to merge 1 commit intoaimacode:masteraimacode/aima-python:masterfrom
bionascu wants to merge 1 commit intoaimacode:masteraimacode/aima-python:masterfrom
Conversation
Chipe1
reviewed
Apr 18, 2017
| 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) |
Contributor
There was a problem hiding this comment.
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 .
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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