问题
The base R function diff
computes a first difference, useful for lagged data comparisons.
I am looking for the GNU diff
function accessible in R: https://www.computerhope.com/unix/udiff.htm
This function is useful for version control, but also useful in natural language processes to identify changes or edits between two similar text elements. This is also an underlying engine of git and so on.
Ideally the function would be gnudiff(text1,text2)
and if tied to quanteda
or another library, that would be awesome.
How do I get the diff
of two text elements?
回答1:
Try using diffObj()
library(diffobj)
diffObj(text1, text2)
来源:https://stackoverflow.com/questions/64999090/using-r-how-to-get-the-diff-of-two-strings