function splitOnWords( sentence, stopwords ) {
	const splitSentences = [];

	// Split the sentence on each found stopword and push this part in an array.
	forEach( stopwords, function( stopword ) {
		const sentenceSplit = sentence.split( stopword );
		if ( ! isEmpty( sentenceSplit[ 0 ] ) ) {
			splitSentences.push( sentenceSplit[ 0 ] );
		}
		const startIndex = sentence.indexOf( stopword );
		const endIndex = sentence.length;
		sentence = stripSpaces( sentence.substr( startIndex, endIndex ) );
	} );

	// Push the remainder of the sentence in the sentence parts array.
	splitSentences.push( sentence );
	return splitSentences;
}
function splitOnWords( sentence, stopwords ) {
	const splitSentences = [];

	
	forEach( stopwords, function( stopword ) {
		const sentenceSplit = sentence.split( stopword );
		if ( ! isEmpty( sentenceSplit[ 0 ] ) ) {
			splitSentences.push( sentenceSplit[ 0 ] );
		}
		const startIndex = sentence.indexOf( stopword );
		const endIndex = sentence.length;
		sentence = stripSpaces( sentence.substr( startIndex, endIndex ) );
	} );

	
	splitSentences.push( sentence );
	return splitSentences;
}
function splitOnWords ( sentence , stopwords ) { const splitSentences = [ ] ; // Split the sentence on each found stopword and push this part in an array. forEach ( stopwords , function ( stopword ) { const sentenceSplit = sentence . split ( stopword ) ; if ( ! isEmpty ( sentenceSplit [ 0 ] ) ) { splitSentences . push ( sentenceSplit [ 0 ] ) ; } const startIndex = sentence . indexOf ( stopword ) ; const endIndex = sentence . length ; sentence = stripSpaces ( sentence . substr ( startIndex , endIndex ) ) ; } ) ; // Push the remainder of the sentence in the sentence parts array. splitSentences . push ( sentence ) ; return splitSentences ; }
Splits sentences into sentence parts based on stopwords.

@param {string} sentence The sentence to split.
@param {Array} stopwords The array with matched stopwords.
@returns {Array} The array with sentence parts.
Splits sentences into sentence parts based on stopwords .