Skip to content
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

Updated _initialize(self,corpus) function #8

Merged
merged 3 commits into from
Jun 4, 2020

Conversation

Sarthakjain1206
Copy link
Contributor

Hey, I have improvised the initialize function. The previous implementation was taking a lot of time due to unnecessary searching for 'word' if present in 'nd'. In time complexity terms, it was taking O(n) time for every outer iteration. Whereas we can do that part in O(1) time.

Test it out by taking a huge corpus, In that case, you will see a lot of time difference.
And, this time difference matters a lot for searching.

Hey, I have improvised the initialize function. The previous implementation was taking a lot of time due to unnecessary searching for 'word' if present in 'nd'. In time complexity terms, it was taking O(n) time for every outer iteration. Whereas we can do that part in O(1) time.

Test it out by taking a huge corpus, In that case, you will see a lot of time difference.
And, this time difference matters a lot for searching.
Copy link
Owner

@dorianbrown dorianbrown left a comment

Choose a reason for hiding this comment

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

Makes sense, good change. This seems to make things a fair bit faster!

There are a few comments on the changes, could you take a look at them? I'll merge it once those are cleaned up.

rank_bm25.py Outdated Show resolved Hide resolved
rank_bm25.py Outdated Show resolved Hide resolved
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.

2 participants