Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
transcript-parser
Advanced tools
Readme
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.
The npm package transcript-parser receives a total of 0 weekly downloads. As such, transcript-parser popularity was classified as not popular.
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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.