Commit Graph

8 Commits

Author SHA1 Message Date
Kevin Wan
cddf3875cf
refactor: simplify stringx.Replacer, and avoid potential infinite loops (#2877)
* simplify replace

* backup

* refactor: simplify stringx.Replacer

* chore: add comments and const

* chore: add more tests

* chore: rename variable
2023-02-14 10:18:02 +08:00
Kevin Wan
072db116c3
chore: refactor (#2875) 2023-02-12 22:20:36 +08:00
dahaihu
cacd5dc91a
fix Replacer suffix match, and add test case (#2867)
* fix: replace shoud replace the longest match

* feat: revert bytes.Buffer to strings.Builder

* fix: loop reset nextStart

* feat: add node longest match test

* feat: add replacer suffix match test case

* feat: multiple match

* fix: partial match ends

* fix: replace look back upon error

* feat: rm unnecessary branch

---------

Co-authored-by: hudahai <hscxrzs@gmail.com>
Co-authored-by: hushichang <hushichang@sensetime.com>
2023-02-12 21:04:35 +08:00
Kevin Wan
0a5a26385d
chore: add more tests (#2866)
* chore: add more tests

* chore: add more tests

* chore: fix test failure
2023-02-11 14:21:39 +08:00
hudahai
d9a732a273 fix: replace shoud replace the longest match 2023-02-10 04:26:50 +00:00
Kevin Wan
b3e7d2901f
Feature/trie ac automation (#1479)
* fix: trie ac automation issues

* fix: trie ac automation issues

* fix: trie ac automation issues

* fix: trie ac automation issues
2022-01-25 11:14:56 +08:00
Kevin Wan
f1102fb262
chore: optimize string search with Aho–Corasick algorithm (#1476)
* chore: optimize string search with Aho–Corasick algorithm

* chore: optimize keywords replacer

* fix: replacer bugs

* chore: reorder members
2022-01-23 23:37:02 +08:00
kevin
7e3a369a8f initial import 2020-07-26 17:09:05 +08:00