|
/** |
|
* Use this to clean your Zoom transcript and anonymize given names. Note that you should |
|
* select and copy the Zoom transcript from online instead of downloading the official |
|
* transcript (i.e., DON'T use the official .vtt file). |
|
* Change the value of `namesAndReplacements` with the names of attendees and |
|
* what you would like them to be replaced with (e.g., "Participant 1234"). |
|
*/ |
|
|
|
const fs = require('fs'); |
|
|
|
const transcriptFilename = 'transcript.txt'; |
|
const newTranscriptFilename = 'newTranscript.txt'; |
|
const namesAndReplacements = [{ |
|
name: 'Name 1', |
|
replacement: 'Codename 1' |
|
}, |
|
{ |
|
name: 'Name 2', |
|
replacement: 'Codename 2' |
|
} |
|
]; |
|
|
|
function getFirstLines(txt, numLines) { |
|
firstFewLines = txt.split('\n', numLines); |
|
return firstFewLines.join('\n'); |
|
} |
|
|
|
console.log('Let\'s get rid of those pesky time stamps and user avatars!\n'); |
|
|
|
fs.readFile(transcriptFilename, 'utf8', (err, origTranscript) => { |
|
if (err) { |
|
console.log('Error reading file: ' + err); |
|
} else { |
|
console.log('---------------------------\n' + |
|
'Data incoming! Here\'s the first ten lines or so:'); |
|
console.log(getFirstLines(origTranscript, 10)); |
|
|
|
console.log('\n---------------------------\n' + |
|
'And here\'s the new output:\n'); |
|
|
|
// Replace the time stamps with spaces: |
|
let newTranscript = origTranscript.replace(/\n\d\d:\d\d:\d\d\n/g, ' '); |
|
// Replace the words, "user avatar" with a newline: |
|
newTranscript = newTranscript.replace(/user avatar/g, '\n'); |
|
// Replace all names with codenames plus a colon: |
|
namesAndReplacements.forEach((nameAndRepl) => { |
|
regex = new RegExp(nameAndRepl.name, 'g'); |
|
newTranscript = newTranscript.replace(regex, nameAndRepl.replacement + ":"); |
|
}); |
|
|
|
console.log(getFirstLines(newTranscript, 10) + '\n'); |
|
|
|
// Export to file: |
|
fs.writeFile(newTranscriptFilename, newTranscript, () => { |
|
console.log('---------------------------\n' + |
|
'Saved to file, ' + newTranscriptFilename + '.') |
|
}); |
|
} |
|
}); |