3 ms·
For people just wanting to get their feet wet and understand one of the simpler algorithms, I implemented a simple diff algorithm in Python a decade ago with co
by paulgb 10y ago
For people just wanting to get their feet wet and understand one of the simpler algorithms, I implemented a simple diff algorithm in Python a decade ago with code readability in mind and it's since been translated to a handful of languages.
https://github.com/paulgb/simplediff/blob/master/python/simplediff/__init__.py https://github.com/paulgb/simplediff/blob/master/python/simp...
- aidos 10y agoLovely. Quick question, is this the sort of technique that used for general text diffing? I see you effectively tokenize the string using whitespace to split and then pass in 2 lists of tokens. Is that the way it's generally done, and you just choose a suitable tokenizer for your specific use-case?
- paulgb 10y agoUsually for source code, the diff is line-based. I didn't actually have a use case at the time, I just wanted to see if it would work.