代码拉取完成,页面将自动刷新
// const myers = require('myers-diff');
const myers = require('./src/');
const fs = require('fs')
// const lhs = fs.readFileSync('./tmp/outen.md', {encoding:'utf8', flag:'r'})
// const rhs = fs.readFileSync('./tmp/su.txt', {encoding:'utf8', flag:'r'})
const lhs = fs.readFileSync('./tmp/out.md', {encoding:'utf8', flag:'r'})
const rhs = fs.readFileSync('./tmp/br.txt', {encoding:'utf8', flag:'r'})
const diff = myers.diff(lhs, rhs, {
// compare: 'chars',
compare: 'words',
ignoreWhitespace: true,
ignoreCase: true,
ignoreAccents: true,
ignorePunctuation: true
})
console.log(myers.formats.GnuNormalFormat(diff));
// console.log(diff);
// const str = ''
// const segmenterJa = new Intl.Segmenter('zh-CN', { granularity: 'word' })
// const segments = segmenterJa.segment(str)
// console.table(Array.from(segments));
// const str = 'We believed in Jesus Christ, who died for us sins, who rose again.'
// const segmenterJa = new Intl.Segmenter('en-US', { granularity: 'word' })
// const segments = segmenterJa.segment(str)
// console.table(Array.from(segments).filter(it => it.isWordLike));
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。