Skip to content
roberto zanoli edited this page Feb 12, 2015 · 1 revision

The visualization tool visualizes the annotations of a given text and hypothesis and the alignments between them, in an html format.

The tool is defined at the eu.excitementproject.eop.alignmentedas.p1eda.visualization package, of the alignmentedas project. The package contains the Visualizer interface and its implementation.

The Visualizer interface provide two options for generating a stand-alone html string, with filtering options:

  • For a given JCas: the html will contain annotations and alignments.
  • For a given TEDecisionWithAlignment: the html will contain annotations, alignments, entailment decision, and the extracted feature vector.
public interface Visualizer {
	
	/**
	 * Generates an html string, which visualizes the various annotations 
	 * and alignments defined in the JCas (with filtering options).
	 * 
	 * @param jcas JCas object, composed of text, hypothesis and their annotations 
	 *  (e.g., part-of-speech, dependency relations, alignments)
	 * @return an html string, which visualizes the various annotations
	 *  and alignments defined in the JCas.
	 * @throws VisualizerGenerationException
	 */
	String generateHTML(JCas jcas) 
                 throws VisualizerGenerationException;
	
	/**
	 * Generates an html string, which visualizes the various annotations
	 * and alignments defined in the JCas (with filtering options), 
	 * and some details on the entailment decision
	 * 
	 * @param decision TEDecisionWithAlignment object, composed of JCas, 
	 *  feature vector and entailment decision
	 * @return an html string, which visualizes the various annotations 
	 *  and alignments defined in the JCas, the features, 
	 *  and the entailment decision.
	 * @throws VisualizerGenerationException
	 */
	String generateHTML(TEDecisionWithAlignment decision) 
               throws VisualizerGenerationException;
}

The P1EdaVisualizer class implements the Visualizer interface for the P1Eda engine. The returned html contains POS and dependency-tree annotations and all alignments, with filtering options.

Note: There might be problems with the generated html in case the strings in the given JCas (i.e., the text and the hypothesis) contain empty spaces. It is high recommended to trim these spaces while generating the provided JCas.

In order use the tool, you should generate a P1EdaVisualizer object, and call the generateHTML() method with a TEDecisionWithAlignment parameter, given by the process() method of the P1Eda. An example is given in the VisualizerTest program. The returned stand-alone html string can be saved as a file and opened in any browser.

The visualization tool is now part of the EOP demo application. In order to visualize the decision for each pair, click the 'Show Ins.' cell in the right.

Clone this wiki locally