src/stringProcessing/relevantWords.js
function sortCombinations( wordCombinations ) {
	wordCombinations.sort( function( combinationA, combinationB ) {
		const difference = combinationB.getRelevance() - combinationA.getRelevance();
		// The combination with the highest relevance comes first.
		if ( difference !== 0 ) {
			return difference;
		}
		// In case of a tie on relevance, the longest combination comes first.
		return combinationB.getLength() - combinationA.getLength();
	} );
}
function sortCombinations( wordCombinations ) {
	wordCombinations.sort( function( combinationA, combinationB ) {
		const difference = combinationB.getRelevance() - combinationA.getRelevance();
		// The combination with the highest relevance comes first.
		if ( difference !== 0 ) {
			return difference;
		}
		// In case of a tie on relevance, the longest combination comes first.
		return combinationB.getLength() - combinationA.getLength();
	} );
}
function sortCombinations ( wordCombinations ) { wordCombinations . sort ( function ( combinationA , combinationB ) { const difference = combinationB . getRelevance ( ) - combinationA . getRelevance ( ) ; // The combination with the highest relevance comes first. if ( difference !== 0 ) { return difference ; } // In case of a tie on relevance, the longest combination comes first. return combinationB . getLength ( ) - combinationA . getLength ( ) ; } ) ; }
Sorts combinations based on their relevance and length.

@param {WordCombination[]} wordCombinations The combinations to sort.
@returns {void}
Sorts combinations based on their relevance and length .