Class RecognizerPanel

java.lang.Object
  |
  +--RecognizerPanel

public class RecognizerPanel
extends java.lang.Object
implements java.awt.event.ActionListener, UserOptions

this class builts the window for comparing two turns of the dialogue with respect to the recognized words


Field Summary
(package private)  javax.swing.text.SimpleAttributeSet black
           
(package private)  javax.swing.text.SimpleAttributeSet blue
           
(package private)  javax.swing.JButton compare
           
(package private)  javax.swing.JDialog dialog
           
(package private)  javax.swing.JButton dismiss
           
(package private)  javax.swing.text.DefaultStyledDocument doc
           
(package private)  javax.swing.text.DefaultStyledDocument doc1
           
(package private)  java.lang.String in
          the input string
(package private)  java.lang.String[] InWords
          array of strings containing the words in the iput string
(package private)  javax.swing.JFrame mainframe
           
(package private)  javax.swing.JTextPane orig
           
(package private)  java.lang.String orig_in
           
(package private)  java.lang.String orig_rec
           
(package private)  java.lang.String rec
          the recognized string
(package private)  javax.swing.JTextPane recognized
           
(package private)  java.lang.String[] RecWords
          array of strings containing the words in the recognized string
(package private)  javax.swing.text.SimpleAttributeSet red
           
(package private)  UserInterface ui
           
 
Fields inherited from interface UserOptions
DEFAULTSFILENAME, FREQUENCY_SAVE_TURNS, MAXIMUM_WORDS_STRING, NO_TURNS, REPLACEMASKSIZE, TRANSLATION_SEGMENTS
 
Constructor Summary
RecognizerPanel(javax.swing.JFrame mainframe, UserInterface ui)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          define the actions on the buttons
 void changed(Judgements j)
          fires changes in the main document
 void compare_algorithm()
           
private  java.lang.String DeleteDotsAndCommas(java.lang.String a_string)
          deletes from a string all punctuation signs
private  int detect(java.lang.String s, java.lang.String[] v)
          detects if a string is contained in an array of strings ignoring the Upper or Lower cases
private  boolean find_pos(int s, int[] v)
          checks the appartenence of a number to a vector of integers
 javax.swing.JDialog getTranslationDialog()
           
private  void highlightWordsInput(int[][] s)
          highlits the not recognized words in the input string
private  void highlightWordsOutput(int[][] s)
          highlights the not recognized words in the output string
 void initial_state()
           
private  boolean isDotOrComma(char a_char, java.lang.String s, int i)
          checks if a character is a punctuation sign
 int isRecognitionPerfect(Judgements judgement)
          bulits the arrays of strings of recognized words and checks if the strings were perfect recognized
 void ShowDialog()
          pops-up the window
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

dialog

javax.swing.JDialog dialog

orig

javax.swing.JTextPane orig

recognized

javax.swing.JTextPane recognized

mainframe

javax.swing.JFrame mainframe

ui

UserInterface ui

dismiss

javax.swing.JButton dismiss

compare

javax.swing.JButton compare

InWords

java.lang.String[] InWords
array of strings containing the words in the iput string

RecWords

java.lang.String[] RecWords
array of strings containing the words in the recognized string

in

java.lang.String in
the input string

rec

java.lang.String rec
the recognized string

orig_in

java.lang.String orig_in

orig_rec

java.lang.String orig_rec

doc

javax.swing.text.DefaultStyledDocument doc

doc1

javax.swing.text.DefaultStyledDocument doc1

red

javax.swing.text.SimpleAttributeSet red

black

javax.swing.text.SimpleAttributeSet black

blue

javax.swing.text.SimpleAttributeSet blue
Constructor Detail

RecognizerPanel

public RecognizerPanel(javax.swing.JFrame mainframe,
                       UserInterface ui)
Method Detail

ShowDialog

public void ShowDialog()
pops-up the window

initial_state

public void initial_state()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
define the actions on the buttons
Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
StringCompare.assignClasses(), StringCompare.result(), isRecognitionPerfect(Judgements)

compare_algorithm

public void compare_algorithm()

highlightWordsInput

private void highlightWordsInput(int[][] s)
highlits the not recognized words in the input string
Parameters:
s - is the matrix provided by the String compare algorithm

highlightWordsOutput

private void highlightWordsOutput(int[][] s)
highlights the not recognized words in the output string

find_pos

private boolean find_pos(int s,
                         int[] v)
checks the appartenence of a number to a vector of integers

detect

private int detect(java.lang.String s,
                   java.lang.String[] v)
detects if a string is contained in an array of strings ignoring the Upper or Lower cases

getTranslationDialog

public javax.swing.JDialog getTranslationDialog()
Returns:
a referrence to this window

changed

public void changed(Judgements j)
fires changes in the main document

isRecognitionPerfect

public int isRecognitionPerfect(Judgements judgement)
bulits the arrays of strings of recognized words and checks if the strings were perfect recognized
Parameters:
judgement - the turn

DeleteDotsAndCommas

private java.lang.String DeleteDotsAndCommas(java.lang.String a_string)
deletes from a string all punctuation signs
Parameters:
a_string - the string to be changed
Returns:
the new string

isDotOrComma

private boolean isDotOrComma(char a_char,
                             java.lang.String s,
                             int i)
checks if a character is a punctuation sign
Parameters:
a_char - the char to be checked
s - the string to which the char belongs
i - the position in s where the char appears return true if the character is a punctuation sign