net.didion.jwnl.JWNL.initialize()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(100)

本文整理了Java中net.didion.jwnl.JWNL.initialize()方法的一些代码示例,展示了JWNL.initialize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JWNL.initialize()方法的具体详情如下:
包路径:net.didion.jwnl.JWNL
类名称:JWNL
方法名:initialize

JWNL.initialize介绍

暂无

代码示例

代码示例来源: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: 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: 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: 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() {
  try {
    JWNL.initialize(this.getClass().getClassLoader().getResourceAsStream("wordnet_properties.xml"));
    dict = Dictionary.getInstance();
  }
  catch (JWNLException e) {
    e.printStackTrace();
  }
}

代码示例来源: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: SmartDataAnalytics/DL-Learner

public WordNet(InputStream propertiesStream) {
  try {
    JWNL.initialize(propertiesStream);
    dict = Dictionary.getInstance();
  }
  catch (JWNLException e) {
    e.printStackTrace();
  }
}

代码示例来源: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: 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));

相关文章

JWNL类方法