List of usage examples for opennlp.tools.dictionary Dictionary Dictionary
public Dictionary(InputStream in) throws IOException
From source file:com.civprod.writerstoolbox.OpenNLP.training.TokenizerTrainer.java
private void cmdLoadAbbreviationDictionaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdLoadAbbreviationDictionaryActionPerformed final TokenizerTrainer tempThis = this; new Thread(() -> { tempThis.setVisible(false);//from w w w. j av a2 s.c om int returnval = myFileChooser.showOpenDialog(tempThis); if (returnval == JFileChooser.APPROVE_OPTION) { final File selectedFile = myFileChooser.getSelectedFile(); InputStream DictionaryInputStream = null; try { DictionaryInputStream = new java.io.BufferedInputStream(new FileInputStream(selectedFile)); mAbbreviationDictionary = new Dictionary(DictionaryInputStream); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } finally { if (DictionaryInputStream != null) { try { DictionaryInputStream.close(); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } } } } tempThis.setVisible(true); }).start(); }
From source file:com.civprod.writerstoolbox.OpenNLP.training.SentenceDetectorTrainer.java
private void cmdLoadAbbreviationDictionaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdLoadAbbreviationDictionaryActionPerformed final SentenceDetectorTrainer tempThis = this; new Thread(() -> { tempThis.setVisible(false);/*w w w .j a va 2s. c o m*/ int returnval = myFileChooser.showOpenDialog(tempThis); if (returnval == JFileChooser.APPROVE_OPTION) { final File selectedFile = myFileChooser.getSelectedFile(); InputStream DictionaryInputStream = null; try { DictionaryInputStream = new java.io.BufferedInputStream(new FileInputStream(selectedFile)); mAbbreviationDictionary = new Dictionary(DictionaryInputStream); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } finally { if (DictionaryInputStream != null) { try { DictionaryInputStream.close(); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } } } } tempThis.setVisible(true); }).start(); }
From source file:com.civprod.writerstoolbox.OpenNLP.training.WordSplitingTokenizerTrainer.java
private void cmdLoadAbbreviationDictionaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdLoadAbbreviationDictionaryActionPerformed final WordSplitingTokenizerTrainer tempThis = this; new Thread(() -> { tempThis.setVisible(false);/* w w w . ja v a2s. co m*/ int returnval = myFileChooser.showOpenDialog(tempThis); if (returnval == JFileChooser.APPROVE_OPTION) { final File selectedFile = myFileChooser.getSelectedFile(); InputStream DictionaryInputStream = null; try { DictionaryInputStream = new java.io.BufferedInputStream(new FileInputStream(selectedFile)); mAbbreviationDictionary = new Dictionary(DictionaryInputStream); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } finally { if (DictionaryInputStream != null) { try { DictionaryInputStream.close(); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } } } } tempThis.setVisible(true); }).start(); }
From source file:com.civprod.writerstoolbox.OpenNLP.training.WordSplitingTokenizerTrainer.java
private void cmdLoadSpellingDictionaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdLoadSpellingDictionaryActionPerformed final WordSplitingTokenizerTrainer tempThis = this; new Thread(() -> { tempThis.setVisible(false);/*from ww w. j a va2s . c o m*/ int returnval = myFileChooser.showOpenDialog(tempThis); if (returnval == JFileChooser.APPROVE_OPTION) { final File selectedFile = myFileChooser.getSelectedFile(); InputStream DictionaryInputStream = null; try { DictionaryInputStream = new java.io.BufferedInputStream(new FileInputStream(selectedFile)); mSpellingDictionary = new Dictionary(DictionaryInputStream); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } finally { if (DictionaryInputStream != null) { try { DictionaryInputStream.close(); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } } } } tempThis.setVisible(true); }).start(); }
From source file:com.civprod.writerstoolbox.OpenNLP.training.ThoughtAndSpeechTrainer.java
private void cmdLoadSaidDictionaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdLoadSaidDictionaryActionPerformed final ThoughtAndSpeechTrainer tempThis = this; new Thread(() -> { tempThis.setVisible(false);// w w w .j a v a2s.co m int returnval = myFileChooser.showOpenDialog(tempThis); if (returnval == JFileChooser.APPROVE_OPTION) { final File selectedFile = myFileChooser.getSelectedFile(); InputStream DictionaryInputStream = null; try { DictionaryInputStream = new java.io.BufferedInputStream(new FileInputStream(selectedFile)); this.saidWordsDictionary = new Dictionary(DictionaryInputStream); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } finally { if (DictionaryInputStream != null) { try { DictionaryInputStream.close(); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } } } } tempThis.setVisible(true); }).start(); }
From source file:com.civprod.writerstoolbox.OpenNLP.training.ThoughtAndSpeechTrainer.java
private void cmdLoadThoughtWordDictionaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdLoadThoughtWordDictionaryActionPerformed final ThoughtAndSpeechTrainer tempThis = this; new Thread(() -> { tempThis.setVisible(false);//from ww w . ja v a 2 s . c o m int returnval = myFileChooser.showOpenDialog(tempThis); if (returnval == JFileChooser.APPROVE_OPTION) { final File selectedFile = myFileChooser.getSelectedFile(); InputStream DictionaryInputStream = null; try { DictionaryInputStream = new java.io.BufferedInputStream(new FileInputStream(selectedFile)); this.thoughtWordsDictionary = new Dictionary(DictionaryInputStream); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } finally { if (DictionaryInputStream != null) { try { DictionaryInputStream.close(); } catch (IOException ex) { Logger.getLogger(DictionaryEditor.class.getName()).log(Level.SEVERE, null, ex); } } } } tempThis.setVisible(true); }).start(); }