适用于Java的任何字典定义API?
作者:互联网
我试图找到一个java的字典定义API,但似乎找不到没有任何互联网连接的任何工作.有人知道任何可能有用的API吗?谢谢
解决方法:
你可以使用ukp_jwktl
Wiktionary is a multilingual, web-based, freely available dictionary,
thesaurus and phrase book, designed as the lexical companion to
Wikipedia. Lately, it has been recognized as a promising lexical
semantic resource for natural language processing applications.
用法示例:
public static void main(String[] args)
{
DBConfig db = new DBConfig("localhost/uby_database","com.mysql.jdbc.Driver","mysql","user", "password", true, false);
Uby uby = new Uby(db);
Lexicon lex = uby.getLexiconByName("WiktionaryEN");
List<LexicalEntry> entries = uby.getLexicalEntries("align", EPartOfSpeech.verb, lex);
for (LexicalEntry le : entries)
{
for (Sense s: le.getSenses())
{
System.out.println("Wiktionary Sense:"+s.getDefinitionText());
List<SenseAxis> alignedSenses = uby.getSenseAxisBySense(s);
if(alignedSenses.size()>0)
{
for(SenseAxis axis : alignedSenses)
{
String definition = axis.getSenseOne().getDefinitionText();
if(definition.length()==0)
{
definition = axis.getSenseOne().getSynset().getDefinitionText();
}
System.out.println("Aligned Sense:" +definition);
}
}
}
}
}
希望,它会帮助你.
标签:java,definition,spell-checking,api 来源: https://codeday.me/bug/20190630/1332450.html