CoreLibraries icon indicating copy to clipboard operation
CoreLibraries copied to clipboard

Extend the difference engine to include a string tokenization strategy

Open thargy opened this issue 11 years ago • 4 comments

Rather than only allowing strings to be differenced at a character level, it would be useful to support differencing at a Word, Sentence and Line level as well.

thargy avatar Nov 20 '15 09:11 thargy

Moved commits to branch string_token_strategy as part of #28

billings7 avatar Oct 04 '16 12:10 billings7

For visibility, found these helpful specifications for boundaries: Word Breaks, Line Breaks, Sentence Breaks, which provide helpful guidelines and tests which should be used for tokenisation logic.

thargy avatar Apr 10 '17 10:04 thargy

So what we have here is the proverbial can of worms. After further research there are two key documents. Text Segmentation Unicode® Standard Annex 29 deals with Grapheme, Word and Sentence boundaries, and Line Breaking Unicode® Standard Annex 14 deals with an algorithm for line breaking.

Line breaking even has several approaches suggested, the better probably being the Pair Based Implementation, for which sample code is provided in C++.

Text Segmentation, however, is vastly more complex, and the most commonly used algorithm is implemented by ICU, of which there are several .NET NuGets available, the most useful being ICU-dotnet. However, all these solutions require you to install the ICU code on the target machine. A pure C# implementation appears absent.

As such, a nice enhancement, that appears to be needed by the .NET community is a pure .NET implementation of the above standards.

thargy avatar Apr 11 '17 10:04 thargy

Probably need to rename UnicodeChar to UChar - as technically char is a UTF-16 (Unicode) character, whereas UChar is a UTF-32 character. Also, need to consider adding a UString implementation.

Ultimately, we may want to consider moving this to a new case.

thargy avatar Apr 18 '17 14:04 thargy