Gets positions of the first character of a word in the input text.

@param {string} text The original text, for which the indices of word beginnings need to be determined.

@returns {Array} indices The array of indices in the text at which words start.
function getIndicesOfWords( text ) {
	const indices = [];
	const words = getWords( text );
	let startSearchFrom = 0;

	words.forEach( function( word ) {
		const currentIndex = text.indexOf( word, startSearchFrom );
		indices.push( currentIndex );
		startSearchFrom = currentIndex + word.length;
	} );

	return indices;
}