Conversation
| Start int // The token's start in bytes in sanitized text. | ||
| End int // The token's end in bytes in sanitized text. |
There was a problem hiding this comment.
confusing comments, please make it simplier as the concept of "sanitized" is outside this struct
| } | ||
|
|
||
| func hasAnyPrefix(s string, prefixes []string) bool { | ||
| func hasAnyPrefix(s string, prefixes []string) int { |
There was a problem hiding this comment.
please add some comment explaning that -1 is the same as false
|
I did not understand how this change is supposed to break the API. Could you please explain better? |
|
Thank you for reviewing. See, what is expected is that The fear though is that the library depends on this sanitizing step. |
This update is to keep track of original locations in the provided text, however I couldn't figure out how better to deal with sanitized (clean) text step inside
Tokenizewithout breaking API here:Obviously
cleanbecomes the actual source forStartandEnd, and not the original text.Possible solution: Leave sanitizing up to caller so that they can have both the original string & the locations in it.