Create Insert Around Use Case#60
Open
jamespeacock wants to merge 28 commits into
Open
Conversation
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.
Author
|
Will create tests to cover this new usage if you let me know whether this is an acceptable addition to the Keyword Processor. |
Author
|
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 |
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.
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.