小编Jim*_*snn的帖子

情感分析java库

我有一些未贴标签的微博帖子,我想创建一个情绪分析模块.

要做到这一点,我尝试了斯坦福图书馆Alchemy Api网络服务,但结果不是很好.现在我不想训练我的分类器.

所以我想建议一些图书馆或一些网络服务.我更喜欢经过测试的图书馆.这篇文章的语言是英语.预处理也已完成.

PS

我使用的编程语言是Java EE

java machine-learning data-mining text-mining sentiment-analysis

7
推荐指数
2
解决办法
2万
查看次数

在infowindow google地图中调用javascript

我想在谷歌地图infoWindow()里面调用javascript.我知道这是一个经典的问题.我在stackoverflow中读了很多类似的问题,但我找不到解决方案:(

我的代码:

<!DOCTYPE> 
<html> 
   <head> 
<link rel="stylesheet" type="text/css" href="http://visapi-gadgets.googlecode.com/svn/trunk/termcloud/tc.css"/> 
<script type="text/javascript" src="http://visapi-gadgets.googlecode.com/svn/trunk/termcloud/tc.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script> 
   <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
   <title>Rectangle Overlay</title> 
   <style type="text/css"> 
   #map { 
   width:1200px; 
   height: 700px; 
   } 
   </style> 
   <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
   <script type="text/javascript"> 
function init() { 
var myOptions = { 
  center: new google.maps.LatLng(38.122404, 23.862591), 
  zoom: 3, 
  mapTypeId: google.maps.MapTypeId.ROADMAP 
}; 
var map = new google.maps.Map(document.getElementById('map'),myOptions); 



  var locations = [
      ['Bondi Beach', 38.6391,23.3437],
      ["<scr"+"ipt type='text/javascript'>alert('test');</scr"+"ipt>", 37.893, 23.936999999999998]
    ];


 var infowindow = new google.maps.InfoWindow();

    var marker, i;

    for (i = …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps

5
推荐指数
2
解决办法
9321
查看次数

斯坦福情感分析评分java

我使用斯坦福核心 NLP库进行情感分析。下面的代码返回一个例子的类,但我怎样才能得到分数?例如 -0.3 为负等

private int getScore(String line) {
    boolean isrun = false;
    StanfordCoreNLP pipeline = null;
    if(!isrun){
        Properties props = getProperties();
        pipeline = new StanfordCoreNLP(props);
        isrun = true;
    }
    Annotation annotation;

    int sentiment = -1;
    if (line != null && line.length() > 0) {
        annotation = pipeline.process(line);
        for (CoreMap sentence : annotation.get(CoreAnnotations.SentencesAnnotation.class)) {
            Tree tree = sentence.get(SentimentCoreAnnotations.AnnotatedTree.class);
            sentiment = RNNCoreAnnotations.getPredictedClass(tree);
        }
    }
    return sentiment;
}
Run Code Online (Sandbox Code Playgroud)

编辑

在在线演示中,当鼠标位于图形的根上时,我们可以看到该示例为负 72%。怎样才能得到这个号码?

java stanford-nlp sentiment-analysis

4
推荐指数
1
解决办法
5327
查看次数

如何在Java中捕获外部jar的异常

我尝试使用mallet 库运行 LDA 算法。当我尝试使用一组参数运行 LDA 时,一切正常,但使用另一组参数时,出现此错误:

09-Oct-2014 23:50:24.354 INFO [http-nio-8084-exec-127] cc.mallet.topics.ParallelTopicModel.estimate <50> LL/token: -8.73265 
09-Oct-2014 23:50:24.657 INFO [http-nio-8084-exec-127] null.null [beta: 0.00795]  
09-Oct-2014 23:50:24.657 INFO [http-nio-8084-exec-127] null.null <60> LL/token: -8.6299 
09-Oct-2014 23:50:24.957 INFO [http-nio-8084-exec-127] cc.mallet.topics.ParallelTopicModel.estimate <70> LL/token: -8.61982 
09-Oct-2014 23:50:25.019 INFO [http-nio-8084-exec-127] null.null [beta: 0.00583]  
09-Oct-2014 23:50:25.263 INFO [http-nio-8084-exec-127] cc.mallet.topics.ParallelTopicModel.estimate <80> LL/token: -8.89656 
09-Oct-2014 23:50:25.402 INFO [http-nio-8084-exec-127] null.null [beta: 0.00484]

java.lang.ArrayIndexOutOfBoundsException: -1    at 
cc.mallet.topics.WorkerRunnable.sampleTopicsForOneDoc(WorkerRunnable.java:489)  at 
cc.mallet.topics.WorkerRunnable.run(WorkerRunnable.java:275)    at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)     at 
java.util.concurrent.FutureTask.run(FutureTask.java:266)    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)     at 
java.lang.Thread.run(Thread.java:745) java.lang.ArrayIndexOutOfBoundsException: -1  at …
Run Code Online (Sandbox Code Playgroud)

java exception mallet

2
推荐指数
1
解决办法
5166
查看次数