-
Notifications
You must be signed in to change notification settings - Fork 602
Create Insert Around Use Case #60
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
Open
jamespeacock
wants to merge
28
commits into
vi3k6i5:master
Choose a base branch
from
jamespeacock:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
added reference to flashtext paper
added citation
corrected citation
`charactes` | `characters` `explaination` | `explanation` `matche` | `match`
Fix issue with incomplete keyword at the end of the sentence
For the following use case: Inserting a custom <span></span> tag (or any html tag) around a keyword. I want the replacement to use the original sentence word, not the keyword. If I am doing case insensitive matching (most of the time), I want the inserted tag to preserve the original word. With the current implementation, this is impossible to accomplish without switching to case sensitive matching. This small intervention allows for custom replacement without affecting anything else.
Will create tests to cover this new usage if you let me know whether this is an acceptable addition to the Keyword Processor. |
Additionally, perhaps this could be a separate method that takes in a 'prepend' and an 'append' rather than a 'replacement' and this could eliminate the need for str.replace() in keyword.py:644 |
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.
For any use case where the goal is to preserve the original text keyword and prepend/append to it, these changes allow for that without replacing the original text with the perhaps differently cased keyword text that matches.
For HTML highlighting in particular, this will be incredibly useful.
These code changes do not affect any other use case, and the custom replacement is optional. I have also included an example in the README for how this could be used.