Determine if a sentence is an inquiry

前端 未结 6 1377
一向
一向 2020-12-23 14:54

How can I detect if a search query is in the form of a question?

For example, a customer might search for \"how do I track my order\" (notice no question mark).

6条回答
  •  隐瞒了意图╮
    2020-12-23 15:34

    In support of JohnFx's answer, it gets even worse. The following are clearly questions:

    • Have you got any questions
    • Will this answer suffice
    • A question, what's that

    And then you'll find that users start entering the following kind of queries:

    • I'd like to know what questions are.

    Is that even a question? Syntactically, no, but it does deserve a reply that could easily be termed an answer. (These kinds of queries may be quite common, depending on your user population.)

    Bottom-line: if you're not going to handle questions in a special, linguistically sophisticated way (such as construct a direct answer using natural language generation), recognizing them may not even be interesting. Picking the right keywords from the query may be much more rewarding.

提交回复
热议问题