);
    return sortedNgrams.map(entry => ({ ng: entry[0], cnt: entry[1] }));
}

function displayngram()
{
    const contentsDiv = document.getElementById('contents');
    let fulltxt = "";
    let parts = [];
    for (k in selecteddb) {
        if (selecteddb[k]) {
            parts.push(renderPage(db[k],false).text);
        }
    }
    fulltxt = parts.join('\n\n');

    if(fulltxt=="")
    {
        contentsDiv.innerText = "Error: You must select at least 1 item to calculate N-Grams!";
 