顶会热词统计

Posted --lzx1--

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了顶会热词统计相关的知识,希望对你有一定的参考价值。

顶会热词统计

代码:

<script>

        var chart = echarts.init(document.getElementById(‘main‘));

        var postURL = "/Diploma/getData";

        var mydata = new Array();

        $.ajaxSettings.async = false;

        $.post(postURL, {}, function(rs) {

            var dataList = JSON.parse(rs);

            for (var i = 0; i < dataList.length; i++) {

                var d = {};

                d[‘name‘] = dataList[i].keyword;

                d[‘value‘] = dataList[i].value;

                mydata.push(d);

            }

        });

        $.ajaxSettings.async = true;

        var option = {

            tooltip : {},

            series : [ {

                type : ‘wordCloud‘,

                gridSize : 2,

                sizeRange : [ 20, 50 ],

                rotationRange : [ -90, 90 ],

                shape : ‘pentagon‘,

                width : 800,

                height : 600,

                drawOutOfBound : false,

                textStyle : {

                    normal : {

                        color : function() {

                            return ‘rgb(‘

                                    + [ Math.round(Math.random() * 160),

                                            Math.round(Math.random() * 160),

                                            Math.round(Math.random() * 160) ]

                                            .join(‘,‘) + ‘)‘;

                        }

                    },

                    emphasis : {

                        shadowBlur : 10,

                        shadowColor : ‘#333‘

                    }

                },

                data : mydata

            } ]

        };

        chart.setOption(option);

        chart.on(‘click‘, function(params) {

            var url = "getDiplomaLink?keyword=" + params.keyword;

            window.location.href = url;

        });

</script>

 

package com.me.servlet;

 

import java.io.IOException;

import java.sql.SQLException;

import java.util.ArrayList;

import java.util.List;

 

import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

 

import com.google.gson.Gson;

import com.me.dao.LWDao;

import com.me.domain.LunWen;

import com.me.domain.Tu;

 

@WebServlet("/PaperServlet_")

public class PaperServlet_ extends HttpServlet {

    private static final long serialVersionUID = 1L;

      

 

    public PaperServlet_() {

        super();

    }

 

 

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        response.setHeader("content-type", "text/html;charset=UTF-8");

 

        response.setCharacterEncoding("UTF-8");

 

        LWDao dao = new LWDao();

        List<LunWen> list = new ArrayList<LunWen>();

        List<Tu> list_tu = new ArrayList<Tu>();

        String [] str = new String[10000];

        String [] str_ = new String[10000];

        int [] b = new int[10000];

        int num = 0;

        int length1 = 0;

        try {

            list = dao.search_();

        } catch (SQLException e) {

            e.printStackTrace();

        }

        for(int i=0;i<list.size();i++) {

            if(list.get(i).getLianjie()!=null) {

                String ss = list.get(i).getLianjie().substring(6,list.get(i).getLianjie().length());

                list.get(i).setLianjie("http://openaccess.thecvf.com/"+ss);

            }

            String[] split = list.get(i).getGuanjian().split(" ");

            for(int j=0;j<split.length;j++) {

                str[num++] = split[j];

            }

        }

        for(int k=0;k<num;k++) {

            b[k]=0;

        }

        str_[0]=str[0];

        int tt=1;

        Boolean rt=true;

        for(int i=1;i<num;i++) {

            rt=false;

            for(int j=0;j<tt;j++) {

                if(str[i].equals(str_[j])) {

                    rt=true;

                    break;

                }

            }

            if(!rt) {

                str_[tt]=str[i];

                tt++;

            }

        }

        length1=tt;

        for(int i=0;i<length1;i++) {

            for(int j=0;j<num;j++) {

                if(str_[i].equals(str[j])) {

                    b[i]++;

                }

            }

        }

        int t3=0;

        int t2=0;

        String sr="";

        for(int i=0;i<length1-1;i++) {

            t3=i;

            for(int j=i+1;j<length1;j++) {

                if(b[t3]<b[j]) {

                    t3=j;

                }

            }

           if(t3!=i) {

               t2=b[i];

               b[i]=b[t3];

               b[t3]=t2;

               sr=str_[i];

               str_[i]=str_[t3];

               str_[t3]=sr;

           }

        }

        for(int i=0;i<100;i++) {

            Tu tu = new Tu();

            tu.name=str_[i];

            tu.value= b[i];

            list_tu.add(tu);

        }

       

        Gson gson = new Gson();

        String json = gson.toJson(list_tu);

        response.getWriter().write(json);

    }

   

 

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        // TODO Auto-generated method stub

        doGet(request, response);

    }

 

}

 

<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Insert title here</title>

<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />

<script src="js/jquery-1.11.3.min.js" type="text/javascript"></script>

<script type="text/javascript" src="js/echarts.min.js"></script>

<script type="text/javascript" src="js/china.js"></script>

<script src="js/bootstrap.min.js" type="text/javascript"></script>

<script src=‘https://cdn.bootcss.com/echarts/3.7.0/echarts.simple.js‘></script>

<script src=‘js/echarts-wordcloud.js‘></script>

</head>

<body>

<div id="main" style="width: 100%;height: 400px"></div>

<div>

  <table class="table" style="width: 100%;align-content: center;" >

    <tr>

      <th align="center">论文连接</th>

    </tr>

    <c:forEach var="item" items="${list}">

      <tr>

        <td><a href="${item.lianjie }">${item.title}</a></td>

      </tr>

    </c:forEach>

  </table>

</div>

<script>

  var chart = echarts.init(document.getElementById(‘main‘));

  var dt;

  $.ajax({

    url : "PaperServlet_",

    async : false,

    type : "POST",

    success : function(data) {

      dt = data;

     // alert(dt[0].title);

    },

    error : function() {

      alert("请求失败");

    },

    dataType : "json"

  });

  var mydata = new Array(0);

  for (var i = 0; i < dt.length; i++) {

      var d = {};

     

      d["name"] = dt[i].name;

      //alert(dt[i].name);

      d["value"] = dt[i].value;

      mydata.push(d);

  }

  var option = {

    tooltip: {},

    series: [ {

      type: ‘wordCloud‘,

      gridSize: 2,

      sizeRange: [20, 50],

      rotationRange: [-90, 90],

      shape: ‘pentagon‘,

      width: 600,

      height: 300,

      drawOutOfBound: true,

      textStyle: {

        normal: {

          color: function () {

            return ‘rgb(‘ + [

              Math.round(Math.random() * 160),

              Math.round(Math.random() * 160),

              Math.round(Math.random() * 160)

            ].join(‘,‘) + ‘)‘;

          }

        },

        emphasis: {

          shadowBlur: 10,

          shadowColor: ‘#333‘

        }

      },

      data: mydata

    } ]

  };

 

  chart.setOption(option);

  chart.on(‘click‘, function (params) {

      var url = "ClickServlet?geunjian=" + params.name;

      window.location.href = url;

    });

  window.onresize = chart.resize;

</script>

</body>

</html>

截图:

 

以上是关于顶会热词统计的主要内容,如果未能解决你的问题,请参考以下文章

6月20日 顶会热词统计

08顶会热词统计-补

原型设计(顶会热词统计)

顶会热词分析

cvpr顶会热词爬取

Lucene热词统计