Open hippalus opened 3 years ago
Yes, WordSegmenter uses a bad algorithm that works ok in most cases but fails miserably in some cases. It should have been using a dynamic programming approach but sadly it is not. Unfortunately I do not have much spare time to fix this, I would advise using a different algorithm for this.
One idea that may alleviate this issue is to split input from spaces before processing with this. Also please provide an example that may cause this bad recursion.
The dfs recursive method in the WordSegmenter class causes high CPU usage in some scenarios. See below screenshot of JVM profiler and CPU profiler.