惠州seo优化_上海的网络推广_凡科轻站_广东网站建设公司排名
router.get('/wordcloud',function(request,response){//正则表达式去掉一些无用的字符,与高频但无意义的词。const regex = /[\t\s\r\n\d\w]|[\+\-\(\),\.。,!?《》@、【】::%-\/“”]/g;var fetchSql = "select keywords from fetches;";mysql.query(fetchSql,function(err, result,fields){response.writeHead(200, {"Content-Type": "application/json"});var word_freq = {};result.forEach(function (content){var newcontent = content["keywords"].replace(regex,",");if(newcontent.length !== 0){// console.log();// var words = nodejieba.cut(newcontent);var words = newcontent.split(",");words.forEach(function (word){word = word.toString();if(word.indexOf("/undefined/")==-1){word_freq[word] = (word_freq[word] +1 ) || 1;}});};});var final = [];for(var key in word_freq){if(key!=""){var tmp = {};tmp["name"] = key;tmp["value"] = word_freq[key]final.push(tmp)}}console.log(final);response.write(JSON.stringify({message:'data',result:final}));response.end();});">