src/researches/buildKeywordForms.js
function( keyphrase, synonyms, language = "en", morphologyData ) {
	const synonymsSplit = parseSynonyms( synonyms );

	const keyphraseForms = buildForms( keyphrase, language, morphologyData );
	const synonymsForms = synonymsSplit.map( synonym => buildForms( synonym, language, morphologyData ) );

	return {
		keyphraseForms: keyphraseForms,
		synonymsForms: synonymsForms,
	};
}
function( keyphrase, synonyms, language = "en", morphologyData ) {
	const synonymsSplit = parseSynonyms( synonyms );

	const keyphraseForms = buildForms( keyphrase, language, morphologyData );
	const synonymsForms = synonymsSplit.map( synonym => buildForms( synonym, language, morphologyData ) );

	return {
		keyphraseForms: keyphraseForms,
		synonymsForms: synonymsForms,
	};
}
Builds morphological forms of words of the keyphrase and of each synonym phrase.

@param {string} keyphrase The paper's keyphrase.
@param {string} synonyms The paper's synonyms.
@param {string} language The paper's language.
@param {Object} morphologyData The available morphology data to be used by the getForms function (language specific).

@returns {Object} Object with an array of keyphrase forms and an array of arrays of synonyms forms.