Class DocumentAnalyzer

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, org.apache.uima.collection.base_cpm.BaseStatusCallbackListener, org.apache.uima.collection.StatusCallbackListener

public class DocumentAnalyzer extends JFrame implements org.apache.uima.collection.StatusCallbackListener, ActionListener
A simple GUI for the RunTextAnalysis application library. Note that currently this will only run under Windows since it relies on Windows-specific commands for invoking a web browser to view the annotated documents.
See Also:
  • Field Details

    • outputFileSelector

      protected FileSelector outputFileSelector
      The output file selector.
    • xmlFileSelector

      protected FileSelector xmlFileSelector
      The xml file selector.
    • outputFileSelected

      protected String outputFileSelected
      The output file selected.
    • currentTypeSystem

      protected org.apache.uima.cas.TypeSystem currentTypeSystem
      The current type system.
    • currentTaeOutputTypes

      protected String[] currentTaeOutputTypes
      The current tae output types.
    • useGeneratedStyleMap

      protected boolean useGeneratedStyleMap
      The use generated style map.
    • interactiveTempFN

      protected String interactiveTempFN
      The interactive temp FN.
    • interactive

      protected boolean interactive
      The interactive.
    • xmlRB

      protected final JRadioButton xmlRB
      The xml RB.
    • javaViewerRBisSelected

      protected boolean javaViewerRBisSelected
      The java viewer R bis selected.
    • javaViewerUCRBisSelected

      protected boolean javaViewerUCRBisSelected
      The java viewer UCR bis selected.
    • prefsMed

      protected PrefsMediator prefsMed
      The prefs med.
    • statsString

      protected String statsString
      The stats string.
    • taeDescFile

      protected File taeDescFile
      The tae desc file.
    • taeDescFileName

      protected String taeDescFileName
      The tae desc file name.
    • cas

      protected org.apache.uima.cas.CAS cas
      The cas.
  • Constructor Details

    • DocumentAnalyzer

      public DocumentAnalyzer()
      Constructor. Sets up the GUI.
    • DocumentAnalyzer

      public DocumentAnalyzer(String outputFileSelected, boolean interactiveDA, boolean jvucrbis)
      Instantiates a new document analyzer.
      Parameters:
      outputFileSelected - the output file selected
      interactiveDA - the interactive DA
      jvucrbis - the jvucrbis
  • Method Details

    • analyzeInputarea

      public void analyzeInputarea()
      JMP addition Opens a dialog for the user to enter text, which will be saved to a file and then processed as by analyzeDocumenbts below.
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • analyzeDocuments

      public void analyzeDocuments(String analysisText)
      Invokes the RunTextAnalysis application library that actually analyzes the documents and generates the output. Displays a progress bar while processing is occuring. When processing is complete, allows the user to view the results. JMP added arg for input text to analyze.
      Parameters:
      analysisText - the analysis text
    • entityProcessComplete

      public void entityProcessComplete(org.apache.uima.cas.CAS aCas, org.apache.uima.collection.EntityProcessStatus aStatus)
      Entity process complete.
      Specified by:
      entityProcessComplete in interface org.apache.uima.collection.StatusCallbackListener
      Parameters:
      aCas - the a cas
      aStatus - the a status
      See Also:
      • StatusCallbackListener.entityProcessComplete(org.apache.uima.cas.CAS, org.apache.uima.collection.EntityProcessStatus)
    • aborted

      public void aborted()
      Aborted.
      Specified by:
      aborted in interface org.apache.uima.collection.base_cpm.BaseStatusCallbackListener
      See Also:
      • BaseStatusCallbackListener.aborted()
    • batchProcessComplete

      public void batchProcessComplete()
      Batch process complete.
      Specified by:
      batchProcessComplete in interface org.apache.uima.collection.base_cpm.BaseStatusCallbackListener
      See Also:
      • BaseStatusCallbackListener.batchProcessComplete()
    • collectionProcessComplete

      public void collectionProcessComplete()
      Collection process complete.
      Specified by:
      collectionProcessComplete in interface org.apache.uima.collection.base_cpm.BaseStatusCallbackListener
      See Also:
      • BaseStatusCallbackListener.collectionProcessComplete()
    • initializationComplete

      public void initializationComplete()
      Initialization complete.
      Specified by:
      initializationComplete in interface org.apache.uima.collection.base_cpm.BaseStatusCallbackListener
      See Also:
      • BaseStatusCallbackListener.initializationComplete()
    • paused

      public void paused()
      Paused.
      Specified by:
      paused in interface org.apache.uima.collection.base_cpm.BaseStatusCallbackListener
      See Also:
      • BaseStatusCallbackListener.paused()
    • resumed

      public void resumed()
      Resumed.
      Specified by:
      resumed in interface org.apache.uima.collection.base_cpm.BaseStatusCallbackListener
      See Also:
      • BaseStatusCallbackListener.resumed()
    • showAnalysisResults

      public void showAnalysisResults(org.apache.uima.util.AnalysisEnginePerformanceReports aReports, File aOutputDir)
      Pops up a dialog that displays the performance stats. This dialog will have a "Show Annotated Documents" button that takes the user to a list of the Annotated Docuemnts produced by this analysis.
      Parameters:
      aReports - performance stats for the analysis
      aOutputDir - directory containing annotated files
    • showAnalysisResults

      public void showAnalysisResults(File aOutputDir)
      Show analysis results.
      Parameters:
      aOutputDir - the a output dir
    • createCasFromDescriptor

      protected org.apache.uima.cas.CAS createCasFromDescriptor(String aDescriptorFile) throws org.apache.uima.resource.ResourceInitializationException, org.apache.uima.util.InvalidXMLException, IOException
      Creates a CAS from an descriptor. Supports both local AE descriptors and remote service specifiers. In the latter case the service is contacted to obtain its type system.
      Parameters:
      aDescriptorFile - the a descriptor file
      Returns:
      the cas
      Throws:
      org.apache.uima.resource.ResourceInitializationException - -
      org.apache.uima.util.InvalidXMLException - -
      IOException - -
    • readStylemapFile

      protected String readStylemapFile(File smapFile)
      Read stylemap file.
      Parameters:
      smapFile - the smap file
      Returns:
      the string
    • savePreferences

      public void savePreferences()
      Save user's preferences using Java's Preference API.
    • restorePreferences

      public void restorePreferences()
      Reset GUI to preferences last saved via savePreferences().
    • displayError

      public void displayError(String aErrorString)
      Displays an error message to the user.
      Parameters:
      aErrorString - error message to display
    • displayError

      public void displayError(Throwable aThrowable)
      Displays an error message to the user.
      Parameters:
      aThrowable - Throwable whose message is to be displayed.
    • main

      public static void main(String[] args)
      Runs the application.
      Parameters:
      args - the arguments
    • runProcessingThread

      public void runProcessingThread(File inputDir, String inputFileFormat, Boolean lenient, File outputDir, File aeSpecifierFile, String xmlTag, String language, String encoding)
      Run processing thread.
      Parameters:
      inputDir - the input dir
      inputFileFormat - the input file format
      lenient - the lenient
      outputDir - the output dir
      aeSpecifierFile - the ae specifier file
      xmlTag - the xml tag
      language - the language
      encoding - the encoding
    • getStyleMapFile

      public File getStyleMapFile()
      Gets the style map file.
      Returns:
      Returns the styleMapFile.
    • setStyleMapFile

      public void setStyleMapFile(File styleMapFile)
      Sets the style map file.
      Parameters:
      styleMapFile - The styleMapFile to set.