Splunkify Text
by johnwun
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.1/locale/af.js"></script>
Text to Timestamped CSV
(see console)
JavaScript
// Speech to flow
var data = `An informative speech as just like an informative essay that is intended to provide
information about a particular subject to a group of listeners.
The purpose of speeches is to help a speaker in delivering
a detailed account to the listeners and enable them to know
and to understand the facts you are providing.
An informative speech can be about anything or subject.
One of the purposes of a speech for the speaker is to
educate the listeners about a specific point through
information collected from credible resources in a single address.`;
// clean data into array of sentences without periods.
var sentenceArray = _.compact(data.split('\n').join(' ').split('.')).map(line => _.compact(line.split(' ')).map(word => _.trim(_.compact(word.toLowerCase().split(' ')))).join(' '));
var triads = sentenceArray.map(line => line.split(' ').reduce((t,c,i,a)=>{
if(i>0 && i < a.length-1){
t.push(`${a[i-1]}-${c}-${a[i+1]}`)
}
return t;
},[]))
var csvArray = _.flatMap(triads).join('\n');
csvArray