async function classifyAcros(cache, acros, lang) {
	return acros.reduce(async (accumulatorP, acro) => {
		const accumulator = await accumulatorP;
		const count = await cache.getAcroCount(acro, lang);

		if (count > 1) {
			accumulator.dups.push(acro);
			return accumulator;
		} else if (count === 1) {
			accumulator.acros.push(acro);
			return accumulator;
		} else {
			console.log('No acronym found for ' + acro);
			accumulator.noDefs.push(acro);
			return accumulator;
		}
	}, Promise.resolve({ acros: [], dups: [], noDefs: [] }));
}
/**
 * Takes a list of acronyms and seperates them based on the number of definitions found.
 * @returns {Promise<object>} An object with each key being a different "classification":
 * "acros" have 1 definition
 * "dups" have more than 1
 * "noDefs" have 0
 */
Takes a list of acronyms and seperates them based on the number of definitions found.
Takes a list of acronyms and seperates them based on the number of definitions found .
async function classifyAcros(cache, acros, lang) {
	return acros.reduce(async (accumulatorP, acro) => {
		const accumulator = await accumulatorP;
		const count = await cache.getAcroCount(acro, lang);
		if (count > 1) {
			accumulator.dups.push(acro);
			return accumulator;
		} else if (count === 1) {
			accumulator.acros.push(acro);
			return accumulator;
		} else {
			console.log('No acronym found for ' + acro);
			accumulator.noDefs.push(acro);
			return accumulator;
		}
	}, Promise.resolve({ acros: [], dups: [], noDefs: [] }));
}
async function classifyAcros ( cache , acros , lang ) { return acros . reduce ( async ( accumulatorP , acro ) => { const accumulator = await accumulatorP ; const count = await cache . getAcroCount ( acro , lang ) ; if ( count > 1 ) { accumulator . dups . push ( acro ) ; return accumulator ; } else if ( count === 1 ) { accumulator . acros . push ( acro ) ; return accumulator ; } else { console . log ( 'No acronym found for ' + acro ) ; accumulator . noDefs . push ( acro ) ; return accumulator ; } } , Promise . resolve ( { acros : [ ] , dups : [ ] , noDefs : [ ] } ) ) ; }
Takes a list of acronyms and seperates them based on the number of definitions found.
Takes a list of acronyms and seperates them based on the number of definitions found .