本文整理了Java中net.didion.jwnl.JWNL
类的一些代码示例,展示了JWNL
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JWNL
类的具体详情如下:
包路径:net.didion.jwnl.JWNL
类名称:JWNL
[英]Contains system info as well as JWNL properties.
[中]包含系统信息以及JWNL属性。
代码示例来源:origin: CogComp/cogcomp-nlp
protected WordNetManager() throws JWNLException {
if (wordnet == null) {
synchronized (WordNetManager.class) {
if (wordnet == null) {
JWNL.initialize();
// Create dictionary object
wordnet = Dictionary.getInstance();
}
}
}
}
代码示例来源:origin: net.sf.jwordnet/jwnl
/**
* Resolve <var>msg</var> in one of the resource bundles used by the system
* @param params parameters to insert into the resolved message
*/
public static String resolveMessage(String msg, Object[] params) {
checkInitialized(UNINITIALIZED);
return insertParams(_bundle.getString(msg), params);
}
代码示例来源:origin: net.sf.jwordnet/jwnl
public static void shutdown() {
_initStage = UNINITIALIZED;
Dictionary.uninstall();
_version = null;
createResourceBundle();
}
代码示例来源:origin: eu.fbk.pikes/pikes-resources
private static Dictionary getDictionary() {
synchronized (WordNet.class) {
if (dictionary == null) {
JWNL.shutdown(); // in case it was previously initialized
try {
final String properties = Resources.toString(
WordNet.class.getResource("jwnl.xml"), Charsets.UTF_8).replace(
"DICTIONARY_PATH_PLACEHOLDER", dictionaryPath);
final InputStream stream = new ByteArrayInputStream(
properties.getBytes(Charsets.UTF_8));
JWNL.initialize(stream);
dictionary = Dictionary.getInstance();
} catch (final Throwable ex) {
JWNL.shutdown();
throw new Error("Cannot initialize JWNL using dictionary path '"
+ dictionaryPath + "'", ex);
}
}
return dictionary;
}
}
代码示例来源:origin: net.sf.jwordnet/jwnl
public static void initialize(InputStream propertiesStream) throws JWNLException {
checkInitialized(UNINITIALIZED);
_bundle.setLocale(getLocale(
getAttribute(root, LANGUAGE_ATTRIBUTE),
getAttribute(root, COUNTRY_ATTRIBUTE)));
String resource = getAttribute(resourceNodes.item(i), CLASS_ATTRIBUTE);
if (resource != null) {
_bundle.addResource(resource);
String number = getAttribute(version, NUMBER_ATTRIBUTE);
_version = new Version(
getAttribute(version, PUBLISHER_ATTRIBUTE),
(number == null) ? 0.0 : Double.parseDouble(number),
getLocale(getAttribute(version, LANGUAGE_ATTRIBUTE), getAttribute(version, COUNTRY_ATTRIBUTE)));
throw new JWNLException("JWNL_EXCEPTION_005");
createElementFromNode(dictionaryNodeList.item(0)).install();
代码示例来源:origin: net.sf.jwordnet/jwnl
/** Get the current WordNet version */
public static Version getVersion() {
checkInitialized(VERSION_SET);
return _version;
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison
protected WordNetManager() throws JWNLException {
if (wordnet == null) {
synchronized (WordNetManager.class) {
if (wordnet == null) {
JWNL.initialize();
// Create dictionary object
wordnet = Dictionary.getInstance();
}
}
}
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public WordNet(String configPath) {
try {
JWNL.initialize(this.getClass().getClassLoader().getResourceAsStream(configPath));
dict = Dictionary.getInstance();
}
catch (JWNLException e) {
e.printStackTrace();
}
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public WordNet() {
try {
JWNL.initialize(this.getClass().getClassLoader().getResourceAsStream("wordnet_properties.xml"));
dict = Dictionary.getInstance();
}
catch (JWNLException e) {
e.printStackTrace();
}
}
代码示例来源:origin: com.github.steveash.mallet/mallet
public static void main(String[] args) {
if (args.length != 1) {
System.out.println(USAGE);
System.exit(-1);
}
String propsFile = args[0];
try {
// initialize JWNL (this must be done before JWNL can be used)
JWNL.initialize(new FileInputStream(propsFile));
new Examples().go();
} catch (Exception ex) {
ex.printStackTrace();
System.exit(-1);
}
}
代码示例来源:origin: cc.mallet/mallet
public static void main(String[] args) {
if (args.length != 1) {
System.out.println(USAGE);
System.exit(-1);
}
String propsFile = args[0];
try {
// initialize JWNL (this must be done before JWNL can be used)
JWNL.initialize(new FileInputStream(propsFile));
new Examples().go();
} catch (Exception ex) {
ex.printStackTrace();
System.exit(-1);
}
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
public static void main(String[] args) {
if (args.length != 1) {
System.out.println(USAGE);
System.exit(-1);
}
String propsFile = args[0];
try {
// initialize JWNL (this must be done before JWNL can be used)
JWNL.initialize(new FileInputStream(propsFile));
new Examples().go();
} catch (Exception ex) {
ex.printStackTrace();
System.exit(-1);
}
}
代码示例来源:origin: de.julielab/jcore-mallet-0.4
public static void main(String[] args) {
if (args.length != 1) {
System.out.println(USAGE);
System.exit(-1);
}
String propsFile = args[0];
try {
// initialize JWNL (this must be done before JWNL can be used)
JWNL.initialize(new FileInputStream(propsFile));
new Examples().go();
} catch (Exception ex) {
ex.printStackTrace();
System.exit(-1);
}
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public WordNet(InputStream propertiesStream) {
try {
JWNL.initialize(propertiesStream);
dict = Dictionary.getInstance();
}
catch (JWNLException e) {
e.printStackTrace();
}
}
代码示例来源:origin: Noahs-ARK/semafor
private WordNetAPI(InputStream propsFile) throws Exception {
info("Initialize WordNet...: ");
if (propsFile == null)
throw new RuntimeException("Missing required property 'WN_PROP'");
try {
JWNL.initialize(propsFile);
wDict = Dictionary.getInstance();
pUtils = PointerUtils.getInstance();
morphProcessor = wDict.getMorphologicalProcessor();
} catch (Exception e) {
throw new RuntimeException("Initialization failed", e);
}
info("Done initializing WordNet...");
}
代码示例来源:origin: de.julielab/dragontool
public WordNetDidion(String workDir){
String propsFile;
try{
if(!FileUtil.exist(workDir) && FileUtil.exist(EnvVariable.getDragonHome()+"/"+workDir))
workDir=EnvVariable.getDragonHome()+"/"+workDir;
propsFile=workDir+"/file_properties.xml";
if(!checkDataDirectory(propsFile,workDir)){
System.out.println("The wordnet data directory is not correct!");
return;
}
JWNL.initialize(new FileInputStream(propsFile));
dict = Dictionary.getInstance();
}
catch(Exception e)
{
e.printStackTrace();
}
}
代码示例来源:origin: hltfbk/Excitement-Open-Platform
JWNL.initialize(new FileInputStream(this.configurationFile));
内容来源于网络,如有侵权,请联系作者删除!