Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
Untitled diff
Created
7 years ago
Diff never expires
Clear
Export
Share
Explain
35 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
60 lines
Copy
25 additions
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
52 lines
Copy
Copy
Copied
Copy
Copied
const
algorithmia
= require(
'algorithmia'
)
import
algorithmia
from
'algorithmia'
;
const algorithmiaApiKey = require('../credentials/algorithmia.json').apiKey
const algorithmiaApiKey = require('../credentials/algorithmia.json').apiKey
Copy
Copied
Copy
Copied
const
sentenceBoundaryDetection
= require(
'sbd'
)
import
sentenceBoundaryDetection
from
'sbd'
;
import { IContent } from './robots.api';
Copy
Copied
Copy
Copied
async function robot(content
) {
async function robot(content
: IContent
) {
await fetchContentFromWikipedia(content)
await fetchContentFromWikipedia(content)
sanitizeContent(content)
sanitizeContent(content)
breakContentIntoSentences(content)
breakContentIntoSentences(content)
Copy
Copied
Copy
Copied
async function fetchContentFromWikipedia(content
) {
async function fetchContentFromWikipedia(content
: IContent
) {
const algorithmiaAuthenticated = algorithmia(algorithmiaApiKey)
const algorithmiaAuthenticated = algorithmia(algorithmiaApiKey)
const wikipediaAlgorithm = algorithmiaAuthenticated.algo('web/WikipediaParser/0.1.2')
const wikipediaAlgorithm = algorithmiaAuthenticated.algo('web/WikipediaParser/0.1.2')
const wikipediaResponde = await wikipediaAlgorithm.pipe(content.searchTerm)
const wikipediaResponde = await wikipediaAlgorithm.pipe(content.searchTerm)
Copy
Copied
Copy
Copied
const
wikipediaContent
= wikipediaResponde.get()
const
{
wikipediaContent
}
= wikipediaResponde.get()
content.sourceContentOriginal = wikipediaContent
.content
content.sourceContentOriginal = wikipediaContent
}
}
Copy
Copied
Copy
Copied
function sanitizeContent(content
) {
function sanitizeContent(content
: IContent
) {
const withoutBlankLinesAndMarkdown = removeBlankLinesAndMarkdown(content.sourceContentOriginal)
const withoutBlankLinesAndMarkdown = removeBlankLinesAndMarkdown(content.sourceContentOriginal)
const withoutDatesInParentheses = removeDatesInParentheses(withoutBlankLinesAndMarkdown)
const withoutDatesInParentheses = removeDatesInParentheses(withoutBlankLinesAndMarkdown)
content.sourceContentSanitized = withoutDatesInParentheses
content.sourceContentSanitized = withoutDatesInParentheses
Copy
Copied
Copy
Copied
function removeBlankLinesAndMarkdown(text
)
{
function removeBlankLinesAndMarkdown(text
: string): string
{
const allLines = text.split('\n')
const allLines = text.split('\n')
Copy
Copied
Copy
Copied
const
withoutBlankLinesAndMarkdown = allLines.
filter
(
(line
) =>
{
const
filter
Func =
(line
: string
) =>
if
(line.trim().length === 0 || line.trim().startsWith('='))
{
!
(line.trim().length === 0 || line.trim().startsWith('='))
return false
}
return
allLines.filter(filterFunc)
.join(' ')
return true
})
return
withoutBlankLinesAndMarkdown
.join(' ')
}
}
}
}
Copy
Copied
Copy
Copied
function removeDatesInParentheses(text
)
{
function removeDatesInParentheses(text
: string): string
{
return text.replace(/\((?:\([^()]*\)|[^()])*\)/gm, '').replace(/ /g,' ')
return text.replace(/\((?:\([^()]*\)|[^()])*\)/gm, '').replace(/ /g,' ')
}
}
Copy
Copied
Copy
Copied
function breakContentIntoSentences(content
) {
function breakContentIntoSentences(content
: IC
ontent
) {
c
ontent
.sentences = []
const sentences = sentenceBoundaryDetection.sentences(content.sourceContentSanitized)
const sentences = sentenceBoundaryDetection.sentences(content.sourceContentSanitized)
Copy
Copied
Copy
Copied
sentences.forEach((sentence) => {
content.sentences = sentences.map((text: string) => ({
content.sentences.push({
text,
text: sentence,
keywords: [],
keywords: [],
images: []
images: []
})
)
})
}
)
}
}
}
}
module.exports = robot
module.exports = robot
Saved diffs
Original text
Open file
const algorithmia = require('algorithmia') const algorithmiaApiKey = require('../credentials/algorithmia.json').apiKey const sentenceBoundaryDetection = require('sbd') async function robot(content) { await fetchContentFromWikipedia(content) sanitizeContent(content) breakContentIntoSentences(content) async function fetchContentFromWikipedia(content) { const algorithmiaAuthenticated = algorithmia(algorithmiaApiKey) const wikipediaAlgorithm = algorithmiaAuthenticated.algo('web/WikipediaParser/0.1.2') const wikipediaResponde = await wikipediaAlgorithm.pipe(content.searchTerm) const wikipediaContent = wikipediaResponde.get() content.sourceContentOriginal = wikipediaContent.content } function sanitizeContent(content) { const withoutBlankLinesAndMarkdown = removeBlankLinesAndMarkdown(content.sourceContentOriginal) const withoutDatesInParentheses = removeDatesInParentheses(withoutBlankLinesAndMarkdown) content.sourceContentSanitized = withoutDatesInParentheses function removeBlankLinesAndMarkdown(text) { const allLines = text.split('\n') const withoutBlankLinesAndMarkdown = allLines.filter((line) => { if (line.trim().length === 0 || line.trim().startsWith('=')) { return false } return true }) return withoutBlankLinesAndMarkdown.join(' ') } } function removeDatesInParentheses(text) { return text.replace(/\((?:\([^()]*\)|[^()])*\)/gm, '').replace(/ /g,' ') } function breakContentIntoSentences(content) { content.sentences = [] const sentences = sentenceBoundaryDetection.sentences(content.sourceContentSanitized) sentences.forEach((sentence) => { content.sentences.push({ text: sentence, keywords: [], images: [] }) }) } } module.exports = robot
Changed text
Open file
import algorithmia from 'algorithmia'; const algorithmiaApiKey = require('../credentials/algorithmia.json').apiKey import sentenceBoundaryDetection from 'sbd'; import { IContent } from './robots.api'; async function robot(content: IContent) { await fetchContentFromWikipedia(content) sanitizeContent(content) breakContentIntoSentences(content) async function fetchContentFromWikipedia(content: IContent) { const algorithmiaAuthenticated = algorithmia(algorithmiaApiKey) const wikipediaAlgorithm = algorithmiaAuthenticated.algo('web/WikipediaParser/0.1.2') const wikipediaResponde = await wikipediaAlgorithm.pipe(content.searchTerm) const { wikipediaContent } = wikipediaResponde.get() content.sourceContentOriginal = wikipediaContent } function sanitizeContent(content: IContent) { const withoutBlankLinesAndMarkdown = removeBlankLinesAndMarkdown(content.sourceContentOriginal) const withoutDatesInParentheses = removeDatesInParentheses(withoutBlankLinesAndMarkdown) content.sourceContentSanitized = withoutDatesInParentheses function removeBlankLinesAndMarkdown(text: string): string { const allLines = text.split('\n') const filterFunc = (line: string) => !(line.trim().length === 0 || line.trim().startsWith('=')) return allLines.filter(filterFunc).join(' ') } } function removeDatesInParentheses(text: string): string { return text.replace(/\((?:\([^()]*\)|[^()])*\)/gm, '').replace(/ /g,' ') } function breakContentIntoSentences(content: IContent) { const sentences = sentenceBoundaryDetection.sentences(content.sourceContentSanitized) content.sentences = sentences.map((text: string) => ({ text, keywords: [], images: [] })) } } module.exports = robot
Find difference