![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
transcript-parser
Advanced tools
Parses plaintext speech/debate/radio transcripts into JavaScript objects.
Parses plaintext speech/debate/radio transcripts into JavaScript objects. It is still in early development. Pull requests are welcome.
Tests can be run with npm test
and a benchmark can be run with npm run benchmark
. For a full coverage report using Istanbul, run npm run travis-test
.
Tested for Node.js >= v4.4.6
npm install transcript-parser
'use strict';
const fs = require('fs');
const TranscriptParser = require('transcript-parser');
const tp = new TranscriptParser();
//Synchronous example
const parsed = tp.parseOneSync(fs.readFileSync('transcript.txt', 'utf8'));
console.log(parsed);
//Asynchronous example
fs.readFile('transcript.txt', (err, data) => {
if(err) return console.error('Error:', err);
tp.parseOne(data, (err, parsed) => {
if(err) return console.error('Error:', err);
console.log(parsed);
}));
});
//Stream example
const stream = fs.createReadStream('transcript.txt', 'utf8');
tp.parseStream(stream, (err, parsed) => {
if(err) return console.error('Error:', err);
console.log(parsed);
});
The constructor for TranscriptParser
accepts a settings object.
removeActions
true
(APPLAUSE)
).removeAnnotations
true
[]
).removeTimestamps
true
removeAnnotations
is true[##:##:##]
format).removeUnknownSpeakers
false
none
.blacklist
[]
aliases
{}
Array
of the aliases' regular expressions as the value.{ "Mr. Robot": [ /[A-Z\ ]*SLATER[A-Z\ ]*/ ] }
Settings can be changed after object creation by changing the corresponding properties of tp.settings
, where tp
is an instance of TranscriptParser
.
The parseStream()
method parses a Stream
and returns an object representing it.
This is the preferred method for parsing streams asynchronously as it doesn't have to load the entire transcript into memory (unlike parseOne()
).
tp.parseOneSync(stream, callback)
stream
Readable
stream to read.callback(err, data)
The parseOneSync()
method parses a string and returns an object representing it.
tp.parseOneSync(transcript)
transcript
string
.The parseOne()
method parses a string and returns an object representing it.
tp.parseOne(transcript, callback)
transcript
string
.callback(err, data)
The resolveAliasesSync()
method resolves all aliases specified in the configuration passed to the TranscriptParser
's constructor (see above).
Renames the names in the order
list to match the new names in the transcript. Note that there is a signifigant performance penalty, so don't use this method unless you need it.
tp.resolveAliasesSync(data)
data
The resolveAliases()
method resolves all aliases specified in the configuration passed to the TranscriptParser
's constructor (see above).
Renames the names in the order
list to match the new names in the transcript. Note that there is a signifigant performance penalty, so don't use this method unless you need it.
tp.resolveAliases(data, callback)
data
callback(err, resolved)
A: I like Node.js.
A: I also like C#.
B: I like Node.js too!
A: I especially like the Node Package Manager.
{
speaker: {
A: [
'I like Node.js.',
'I also like C#.',
'I especially like the Node Package Manager.'
],
B: ['I like Node.js too!']
},
order: ['A', 'A', 'B', 'A']
}
FAQs
Parses plaintext speech/debate/radio transcripts into JavaScript objects.
We found that transcript-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.