Java Reference
In-Depth Information
Determining the question type
The relationships detected suggest ways to detect different types of questions. For example,
to determine whether it is a "who" type question, we can check whether the relationship is
nominal subject and the governor is who .
In the following code, we iterate over the question type dependencies to determine whether
it matches this combination, and if so, call the processWhoQuestion method to pro-
cess the question:
for (TypedDependency dependency : tdl) {
if ("nominal subject".equals(
dependency.reln().getLongName())
&& "who".equalsIgnoreCase(
dependency.gov().originalText())) {
processWhoQuestion(tdl);
}
}
This simple distinction worked reasonably well. It will correctly identify all of the follow-
ing variations to the same question:
Who is the 32nd president of the United States?
Who was the 32nd president of the United States?
The 32nd president of the United States was who?
The 32nd president is who of the United States?
We can also determine other question types using different selection criteria. The following
questions typify other question types:
What was the 3rd President's party?
When was the 12th president inaugurated?
Where is the 30th president's home town?
We can determine the question type using the relations as suggested in the following table:
Search WWH ::




Custom Search