Created
March 26, 2018 10:54
-
-
Save InsiderPhD/6361856a515beb157635e2c6a01975ab to your computer and use it in GitHub Desktop.
Works with the InvertedIndex.py
This file contains 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
# OR query | |
searchQuery = "about company" | |
searchTokens = tokeniser.tokenize(searchQuery) | |
searchNormalised = list() | |
for t in searchTokens: | |
searchNormalised.append(porter.stem(t)) | |
postingsList = list() | |
for t in invertedIndex: | |
for search in searchNormalised: | |
if t[0] == search: | |
for posting in t[1]: | |
appearsInPostings = None | |
for p in postingsList: | |
if(p == posting): appearsInPostings = True | |
if(appearsInPostings != True): | |
postingsList.append(posting) | |
print(postingsList) | |
for posting in postingsList: | |
print(documents[posting-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment