Is there a way to diff files sentence-by-sentence instead of line-by-line?

谁说我不能喝 提交于 2019-12-05 20:22:47

问题


Just trying to get diff to work better for certain kinds of documents. With LaTeX, for example, I might have a long paragraph that is strictly just one line, but I don't want to see that entire paragraph if just a sentence is changed. Particularly if I'm running some kind of version control and a co-author edits the same paragraph (but not the same sentence) as me. I wouldn't want that to show up as a conflict.

That's a secondary question. The main question is whether I can use diff to look sentence-by-sentence. Thanks.

Edit

wdiff is almost perfect. But is there a merge equivalent, as diff has with diff3?


回答1:


wdiff will give you a word-by-word diff instead of line-by-line. I'm not aware of any sentence-by-sentence diff programs.




回答2:


Preprocess the files before diffing them. Write a script to write one sentence per line and any line by line diff program will work.

I have done this on a C token level for diffing C code in order to make absolutely sure my CVS merge was correct.



来源:https://stackoverflow.com/questions/845650/is-there-a-way-to-diff-files-sentence-by-sentence-instead-of-line-by-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!