如何使用stanford解析器对java类中的字符串进行标记?
我只能找到documentProcessor和PTBTokenizer从外部文件中获取文本的示例.
DocumentPreprocessor dp = new DocumentPreprocessor("hello.txt");
for (List sentence : dp) {
System.out.println(sentence);
}
// option #2: By token
PTBTokenizer ptbt = new PTBTokenizer(new FileReader("hello.txt"),
new CoreLabelTokenFactory(), "");
for (CoreLabel label; ptbt.hasNext(); ) {
label = (CoreLabel) ptbt.next();
System.out.println(label);
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
我需要与正面和负面的单词的列表的权重根据他们是多么的强大和周分配给的话.我有 :
1.)WordNet - 它为每个单词提供+或 - 分数.
2.)SentiWordNet - 给出[0,1]范围内的正负值.
我用几句话检查了这些,
爱 - wordNet给出了名词和动词的0.0,我不知道为什么我认为它至少应该是积极的因素.
压制 - wordNet给出-9.93
- SentiWordNet给出了pos和neg的0.0.(应该是否定的)
休息 - wordNet - 2.488
- SentiWordNet - {pos - 0.125,neg - 0.5}(应为正)
我需要一些帮助来决定使用哪一个.
谢谢.
我正在使用 Angular 7 和 primeng 库作为 UI 组件。CSS 未应用于 HTML 元素。我已将这些 css 文件导入到angular.json:
"styles": [
"node_modules/font-awesome/css/font-awesome.min.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/themes/nova-light/theme.css",
"node_modules/primeng/resources/primeng.min.css",
"src/styles.scss"
]
Run Code Online (Sandbox Code Playgroud)
在演示页面上: http: //primefaces.org/primeng/#/inputgroup
输入框生成了这些类:ui-inputtext ui-corner-all ui-state-default ui-widget
我生成的 html 中缺少这些,如果我手动应用这些类,则应用 css。这是 HTML 代码:
<h3 class="first">Addons</h3>
<div class="ui-g ui-fluid">
<div class="ui-g-12 ui-md-4">
<div class="ui-inputgroup">
<span class="ui-inputgroup-addon"><i class="pi pi-user" style="line-height: 1.25;"></i></span>
<input type="text" pInputText placeholder="Username">
</div>
</div>
<div class="ui-g-12 ui-md-4">
<div class="ui-inputgroup">
<span class="ui-inputgroup-addon">$</span>
<input type="text" pInputText placeholder="Price">
<span class="ui-inputgroup-addon">.00</span>
</div>
</div>
<div class="ui-g-12 ui-md-4">
<div class="ui-inputgroup"> …Run Code Online (Sandbox Code Playgroud) 我想从 spring 控制器方法返回一个 JSONArray(org.json.jar) 对象,这是我的 java spring 控制器:
import org.json.JSONArray;
import org.json.JSONException;
@RestController
public class BICOntroller{
@RequestMapping(value="/getStatus", method = RequestMethod.GET)
public ResponseEntity<JSONArray> getStatus() throws JSONException{
ResponseEntity<JSONArray> response = null;
JSONArray arr = new JSONArray();
JSONObject obj = new JSONObject();
//process data
arr.put(obj);
response = new ResponseEntity<JSONArray>(arr, HttpStatus.OK);
return response;
}
}
Run Code Online (Sandbox Code Playgroud)
角度js调用:
$http({
url: 'getStatus',
method: 'GET',
responseType: 'json'
}).then(function(response){
console.log(response);
return response;
}, function(error){
console.log(error);
return error;
});
Run Code Online (Sandbox Code Playgroud)
这给出了 500 错误:
java.lang.IllegalArgumentException: No converter found for return value of …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Nodemailer 通过以下配置发送电子邮件:
var transporter = nodemailer.createTransport(smtpTransport({
host: 'smtp.outlookhost',
port: 25,
auth: {
user: '',
pass: ''
},
secure:false,
logger: true,
debug: true
}));
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Error: unable to get local issuer certificate
Run Code Online (Sandbox Code Playgroud)
我正在使用 Outlook 发送电子邮件。怎样才能提供证书。
修改了配置:
var transporter = nodemailer.createTransport(smtpTransport({
host: 'smtp.outlookhost',
port: 25,
auth: {
user: '',
pass: ''
},
secure:true,
logger: true,
debug: true,
tls: {
// do not fail on invalid certs
rejectUnauthorized: false
}
}));
Run Code Online (Sandbox Code Playgroud)
错误 :
Error: 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c
Run Code Online (Sandbox Code Playgroud) 我有一个主表Blends和一个表cards,它们之间存在一对一的关系。在添加一个card我给一个下拉选择一个时blend,卡有一列blend_id。
添加一个card我想保存card在表中的blend_id值等于从下拉列表中选择的混合ID。
我正在使用 spring 休眠,这是我提交卡片表单的例外情况:
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.terp.entity.BlendEntity
org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:243)
org.hibernate.type.EntityType.getIdentifier(EntityType.java:456)
org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:265)
org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:275)
org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:295)
org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3403)
org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:520)
org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:230)
org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:154)
org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy26.addCard(Unknown Source)
com.terp.controller.CardController.addCard(CardController.java:122)
com.terp.controller.CardController$$FastClassByCGLIB$$43e17ccc.invoke(<generated>)
net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:617)
com.terp.controller.CardController$$EnhancerByCGLIB$$4627162d_2.addCard(<generated>)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:427)
org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:415)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) …Run Code Online (Sandbox Code Playgroud) 我试图得到一个句子的主要主题,即一个句子在说什么(不是可能不同的语法主题).
到目前为止,我有
1.)Java中的OpenNLP,它给我句子检测,POS标记,解析,标记器和名字查找器.
2.)MatlParser,stanford Parser - 它可以通过依赖解析给出一个简单句子的语法主题.
我认为名词或名词短语总是在更一般意义上的主语,但句子可以有许多名词和名词短语.任何帮助将非常感激.