src/stringProcessing/relevantWords.js
function calculateOccurrences( wordCombinations ) {
	const occurrences = {};

	forEach( wordCombinations, function( wordCombination ) {
		const combination = wordCombination.getCombination();

		if ( ! has( occurrences, combination ) ) {
			occurrences[ combination ] = wordCombination;
		}

		occurrences[ combination ].incrementOccurrences();
	} );

	return values( occurrences );
}
function calculateOccurrences( wordCombinations ) {
	const occurrences = {};

	forEach( wordCombinations, function( wordCombination ) {
		const combination = wordCombination.getCombination();

		if ( ! has( occurrences, combination ) ) {
			occurrences[ combination ] = wordCombination;
		}

		occurrences[ combination ].incrementOccurrences();
	} );

	return values( occurrences );
}
Calculates occurrences for a list of word combinations.

@param {WordCombination[]} wordCombinations The word combinations to calculate occurrences for.
@returns {WordCombination[]} Word combinations with their respective occurrences.