Keyword search - #3
Open
gaoDean wants to merge 8 commits into
Open
Conversation
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.
I didn't want to remember the exact label for each reference in my database, so this patch allows you to enter some keywords as the argument to the citation, and get your reference. The result is score based, so it returns the reference with the highest score.
Cons:
.cthas to be on a separate line, because all keywords after .ct are used. (This means you can have spaces in your references and citations).This patch is best used with the 'title as label' patch, as the score-based matching allows you to match just a few words.
The search works by for each keyword, getting each token of the label of the reference in the database, comparing it to the keyword and adding it to a scores array the size of all the references. Returns the highest scoring reference.
Also, prints to stderr if multiple references with the same score are found, very rare tho unless you did like one keyword. Files before this patch should also be compatible but haven't been tested.
I also haven't tested.[ and .] citations, as I don't use them.