当前位置: 首页>>代码示例>>Java>>正文


Java Dictionary.getInstance方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:s-match,项目名称:s-match-wordnet,代码行数:22,代码来源:WordNet.java

示例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();
        }
    }
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:18,代码来源:DictionaryToDatabase.java

示例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();
    }
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:18,代码来源:Examples.java

示例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 
}
 
开发者ID:datancoffee,项目名称:sirocco,代码行数:9,代码来源:BaseFormsDictionary.java

示例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<>();
    }        
}
 
开发者ID:UCLA-BD2K,项目名称:aztec-text-analysis-tools,代码行数:9,代码来源:RepresentativeProvider.java

示例6: setUp

import net.sf.extjwnl.dictionary.Dictionary; //导入方法依赖的package包/类
@Before
public void setUp() throws JWNLException, IOException {
    dictionary = Dictionary.getInstance(getProperties());
    mapDictionary = Dictionary.getInstance(getProperties());
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:6,代码来源:BaseData.java

示例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"));
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:5,代码来源:TestRelationshipList.java

示例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"));
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:6,代码来源:ITReadMapBackedDictionary.java

示例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"));
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:6,代码来源:ITReadDatabaseBackedDictionary.java

示例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);
}
 
开发者ID:extjwnl,项目名称:extjwnl,代码行数:16,代码来源:DictionaryToMap.java


注:本文中的net.sf.extjwnl.dictionary.Dictionary.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。