如何判断一个句子是否是疑问句(疑问句)? [英] How to find out if a sentence is a question (interrogative)?

查看:142
本文介绍了如何判断一个句子是否是疑问句(疑问句)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有开源 Java 库/算法可用于查找特定文本片段是否为问题?
我正在开发一个问答系统,需要分析用户输入的文本是否是一个问题.
我认为这个问题可能可以通过使用开源 NLP 库来解决,但它显然比简单的词性标记更复杂.因此,如果有人可以通过使用现有的开源 NLP 库来告诉它的算法,那也很好.
如果您知道使用数据挖掘来解决此问题的库/工具包,也请告诉我.虽然很难获得足够的数据用于训练,但我将能够使用堆栈交换数据进行训练.

Is there an open source Java library/algorithm for finding if a particular piece of text is a question or not?
I am working on a question answering system that needs to analyze if the text input by user is a question.
I think the problem can probably be solved by using opensource NLP libraries but its obviously more complicated than simple part of speech tagging. So if someone can instead tell the algorithm for it by using an existing opensource NLP library, that would be good too.
Also let me know if you know a library/toolkit that uses data mining to solve this problem. Although it will be difficult to get sufficient data for training purposes, I will be able to use stack exchange data for training.

推荐答案

在一个问题的句法分析中,正确的结构形式如下:

In a syntactic parse of a question, the correct structure will be in the form of:

(SBARQ (WH+ (W+) ...)
       (SQ ...*
           (V+) ...*)
       (?))

因此,使用任何可用的句法解析器,带有嵌入 SQ(可选)的 SBARQ 节点的树将指示输入是问题.WH+ 节点 (WHNP/WHADVP/WHADJP) 包含问题词干(who/what/when/where/why/how),SQ 包含倒置短语.

So, using anyone of the syntactic parsers available, a tree with an SBARQ node having an embedded SQ (optionally) will be an indicator the input is a question. The WH+ node (WHNP/WHADVP/WHADJP) contains the question stem (who/what/when/where/why/how) and the SQ holds the inverted phrase.

即:

(SBARQ 
  (WHNP 
    (WP What)) 
  (SQ 
    (VBZ is) 
    (NP 
      (DT the) 
      (NN question)))
  (. ?))

当然,有很多前面的子句会导致解析错误(可以解决),写得不好的问题也会如此.例如,这篇文章的标题如何判断一个句子是否是一个问题?"将有一个 SBARQ,但没有一个 SQ.

Of course, having a lot of preceeding clauses will cause errors in the parse (that can be worked around), as will really poorly-written questions. For example, the title of this post "How to find out if a sentence is a question?" will have an SBARQ, but not an SQ.

这篇关于如何判断一个句子是否是疑问句(疑问句)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆