我正在 JWNL 工作。我希望用户输入查询,然后我需要找到构成查询的单词。我需要从这些词中识别名词。这是我写的代码:
public class graph
{
public static void main(String[] args) throws JWNLException
{
WordNetHelper.initialize("F:\\file_properties.xml");
System.out.println("Enter the query term!!!");
Scanner sc= new Scanner(System.in);
while(sc.hasNext())
{
String s= sc.next();
String[] result = s.split("\\s");
for (int x=0; x<result.length; x++)
{
System.out.println(result[x]);
}
}
}
}
我应该如何进一步进行?如果代码中需要任何更改,请指定。