本文整理汇总了Java中net.sf.extjwnl.dictionary.Dictionary.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Dictionary.getInstance方法的具体用法?Java Dictionary.getInstance怎么用?Java Dictionary.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.extjwnl.dictionary.Dictionary
的用法示例。
在下文中一共展示了Dictionary.getInstance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDictionary
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
public static Dictionary getDictionary(String jwnlPropertiesPath) throws SMatchException {
try {
if (null != jwnlPropertiesPath) {
log.info("Initializing extJWNL (" + jwnlPropertiesPath + ")");
InputStream is = MiscUtils.getInputStream(jwnlPropertiesPath);
try {
return Dictionary.getInstance(is);
} finally {
if (null != is) {
is.close();
}
}
} else {
log.info("Initializing extJWNL (default resource instance)");
return Dictionary.getDefaultResourceInstance();
}
} catch (JWNLException | DISIException | IOException e) {
throw new SMatchException(e.getClass().getSimpleName() + ": " + e.getMessage(), e);
}
}
示例2: importWordnet
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
public static void importWordnet(String propertyFile, String tablesScript, String driverClass, String connectionURL, String username, String password) throws IOException, JWNLException, SQLException {
Dictionary dictionary = Dictionary.getInstance(new FileInputStream(propertyFile));
Connection conn = null;
try {
ConnectionManager mgr = new ConnectionManager(dictionary, driverClass, connectionURL, username, password);
conn = mgr.getConnection();
conn.setReadOnly(false);
DictionaryToDatabase d2d = new DictionaryToDatabase(dictionary, conn);
d2d.createTables(tablesScript);
d2d.insertData();
} finally {
if (null != conn) {
conn.close();
}
}
}
示例3: main
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
public static void main(String[] args) throws FileNotFoundException, JWNLException, CloneNotSupportedException {
Dictionary dictionary = null;
if (args.length != 1) {
dictionary = Dictionary.getDefaultResourceInstance();
} else {
if (HELP_KEYS.contains(args[0])) {
System.out.println(USAGE);
} else {
FileInputStream inputStream = new FileInputStream(args[0]);
dictionary = Dictionary.getInstance(inputStream);
}
}
if (null != dictionary) {
new Examples(dictionary).go();
}
}
示例4: BaseFormsDictionary
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
public BaseFormsDictionary(BaseformOverrideDictionary overrides) throws Exception {
BaseformOverrides = overrides;
String propsFile = ConfigurationManager.getConfiguration().getString("WordnetPropertiesFile");
InputStream stream = getClass().getResourceAsStream(propsFile);
wnDict = Dictionary.getInstance(stream);
bfDict = new HashMap<String,CSList<String>>();
supportedPartsOfSpeech = new CSList<String>(new String[]{"noun","verb","adjective","adverb"}); // JWNL 1.3 and 1.4 only support these POSes
}
示例5: RepresentativeProvider
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
private RepresentativeProvider() throws JWNLException, FileNotFoundException {
dictionary = Dictionary.getInstance(new FileInputStream(wordnetPath));
try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(representativesPath))) {
representative = (HashMap<String, String>) ois.readObject();
} catch (Exception e) {
representative = new HashMap<>();
}
}
示例6: setUp
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
@Before
public void setUp() throws JWNLException, IOException {
dictionary = Dictionary.getInstance(getProperties());
mapDictionary = Dictionary.getInstance(getProperties());
}
示例7: runOnceBeforeAllTests
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
@BeforeClass
public static void runOnceBeforeAllTests() throws FileNotFoundException, JWNLException {
dic = Dictionary.getInstance(TestRelationshipList.class.getResourceAsStream("/test_file_properties.xml"));
}
示例8: initDictionary
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
@BeforeClass
public static void initDictionary() throws IOException, JWNLException {
dictionary = Dictionary.getInstance(
ITReadMapBackedDictionary.class.getResourceAsStream("/test_map_properties.xml"));
}
示例9: initDictionary
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
@BeforeClass
public static void initDictionary() throws IOException, JWNLException {
dictionary = Dictionary.getInstance(
ITReadDatabaseBackedDictionary.class.getResourceAsStream("/test_h2_properties.xml"));
}
示例10: DictionaryToMap
import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
/**
* Initialize with the given map destination directory, using the properties file(usually file_properties.xml)
*
* @param propFile properties file
* @param destinationDirectory destination directory for in-memory map files
* @throws JWNLException JWNLException
* @throws IOException IOException
*/
public DictionaryToMap(String propFile, String destinationDirectory) throws JWNLException, IOException {
dictionary = Dictionary.getInstance(new FileInputStream(propFile));
HashMap<String, Param> params = new HashMap<>();
params.put(DictionaryCatalog.DICTIONARY_PATH_KEY, new NameValueParam(dictionary, DictionaryCatalog.DICTIONARY_PATH_KEY, destinationDirectory));
params.put(DictionaryCatalog.DICTIONARY_FILE_TYPE_KEY, new NameValueParam(dictionary, DictionaryCatalog.DICTIONARY_FILE_TYPE_KEY, PrincetonObjectDictionaryFile.class.getCanonicalName()));
destinationFiles = new DictionaryCatalogSet<>(dictionary, params, ObjectDictionaryFile.class);
}