function countNLPTagsWNames(catalog,selected_project_names){
var counts = {}
var tag_holder = {}
var project = {"name":"NASA Open Source","projects":[]}
for (var i = 0; i < catalog.length; i++){
for (var j = 0; j < catalog[i]["Categories_NLP"].length; j++){
var tag = catalog[i]["Categories_NLP"][j]
var name = catalog[i]["Software"]
var children_1_list = project['projects']
var nlp_tag = catalog[i]["Categories_NLP"][j]
var isProjNameInSelectedProjectsClusters = false
for (var w = 0; w < selected_project_names.length; w++){
if (selected_project_names[w] == name){
isProjNameInSelectedProjectsClusters = true
}
}
if (counts[nlp_tag] && tag_holder[nlp_tag] && isProjNameInSelectedProjectsClusters) {
tag_holder[nlp_tag].push(name)
counts[nlp_tag]+= 1
var count = counts[nlp_tag]
var tags = tag_holder[nlp_tag]
children_1_list.push({"names": tags, tag_name: nlp_tag, "value": count})
}
else {
if (!tag_holder[nlp_tag]){tag_holder[nlp_tag] = [name]}
if (!counts[nlp_tag]){counts[nlp_tag] = 1}
children_1_list.push({"names": [name], tag_name: nlp_tag, "value": 1})
}
}
}
var results = {"name":"NASA Open Source","children":[]}
var tag_array = Object.keys(counts)
for (var k = 0; k < tag_array.length; k++){
var tag = tag_array[k]
if (counts[tag] >= min_tag_counts && counts[tag] <= max_tag_counts){
results["children"].push({"name":tag,"value":counts[tag],"projects":tag_holder[tag]})
}
}
return results
}