FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

intersection query for relevant_pages and corresp test by bionascu · Pull Request #402 · aimacode/aima-python · GitHub

Repository navigation

intersection query for relevant_pages and corresp test - #402

Closed
bionascu wants to merge 1 commit into
aimacode:masterfrom
bionascu:patch-nlp
Closed

bionascu wants to merge 1 commit into
aimacode:masterfrom
bionascu:patch-nlp

Conversation

Copy link
Copy Markdown

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

Comment thread nlp.py
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 commented May 31, 2017

Copy link
Copy Markdown
Member

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

norvig closed this May 31, 2017
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL