Created
June 6, 2022 12:27
-
-
Save BURG3R5/8ca2bed351696717197debeb8b33d141 to your computer and use it in GitHub Desktop.
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
# IN: documents, keywords | |
inverted_index = { | |
keyword: tuple( | |
document_id | |
for document_id, document_content in documents.items() | |
if (keyword in document_content) | |
) | |
for keyword in keywords | |
} | |
# OUT: inverted_index |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment