예제 #1
0
 private void nextButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_nextButtonActionPerformed
   if (this.sentIndex < (corpusText.size() - 1)) {
     this.sentIndex++;
     backButton.setEnabled(true);
     showAnnotation();
   }
   if (this.sentIndex == corpusText.size()) nextButton.setEnabled(false);
 } // GEN-LAST:event_nextButtonActionPerformed
예제 #2
0
 private void showTreeMenuItemActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_showTreeMenuItemActionPerformed
   Sentence s = corpusText.get(this.sentIndex);
   s = parserAnnotator.annotate(s);
   treeViewDialog.setTree(s.getParseTree());
   treeViewDialog.repaint();
   treeViewDialog.setVisible(true);
 } // GEN-LAST:event_showTreeMenuItemActionPerformed
예제 #3
0
 private void loadText(String text) {
   this.corpusText = textReader.read(text);
   this.sentIndex = 0;
   this.writer = null;
   if (corpusText.size() > 1) nextButton.setEnabled(true);
   /*for (Sentence s : corpusText) {
       s = annotator.annotate(s);
   }*/
   showAnnotation();
 }
예제 #4
0
 private void showAnnotation() {
   Sentence s = corpusText.get(sentIndex);
   try {
     s = annotator.annotate(s);
   } catch (Exception ex) {
     JOptionPane.showMessageDialog(
         this, ex.getMessage(), "Exception occured", JOptionPane.ERROR_MESSAGE);
   }
   updateTable(s);
   updateTextPane(s);
 }
예제 #5
0
 private void showDepGraphMenuItemActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_showDepGraphMenuItemActionPerformed
   Sentence s = corpusText.get(this.sentIndex);
   if (!s.isAnnotatedBy("PARSED")) s = parserAnnotator.annotate(s);
   Tree t = s.getParseTree();
   EnglishGrammaticalStructure egs = new EnglishGrammaticalStructure(t);
   Collection<TypedDependency> tld = egs.typedDependenciesCCprocessed(true);
   try {
     String path = System.getProperty("java.io.tmpdir") + "tmp.png";
     com.chaoticity.dependensee.Main.writeImage(t, tld, "tmp.png");
     Desktop.getDesktop().open(new File("tmp.png"));
   } catch (Exception ex) {
     System.err.println(ex.getMessage());
   }
 } // GEN-LAST:event_showDepGraphMenuItemActionPerformed