4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator Class Reference

Class consisting of traversing method and compare method. More...

Inheritance diagram for cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator:
Inheritance graph
Collaboration diagram for cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator:
Collaboration graph

Classes

class  IndexAndlength
 Auxiliary class with index, offset and word length. More...
 
enum  TraversingMethod
 Names of traversing methods. More...
 

Public Member Functions

TraversingMethod getTraversingMethod ()
 
CompareMethod getCompareMethod ()
 
void setmaxLenghtEnlargement (double maxLenghtEnlargement)
 
 Comparator (CompareMethod compareMethod, TraversingMethod traversingMethod)
 
 Comparator (CompareMethod compareMethod, TraversingMethod traversingMethod, double maxLenghtEnlargement, double maxLenghtReduction)
 
String toString ()
 
UpdatableFragment compare (UpdatableFragment queryFragment, Node node) throws XPathExpressionException
 

Static Public Member Functions

static String getNodeContent (Node node)
 

Private Member Functions

UpdatableFragment selectBestPart (UpdatableFragment origFragment, UpdatableFragment newFragment) throws XPathExpressionException
 
int countWordsLengthBeg (int count, String words[])
 
int countWordsLengthEnd (int count, String words[], int wholeLength)
 
UpdatableFragment selectBestSubFragment (UpdatableFragment origFragment, ArrayList< UpdatableFragment > BestSubParts) throws XPathExpressionException
 
UpdatableFragment wordMatchMethod (Node node, UpdatableFragment queryFragment) throws XPathExpressionException
 
UpdatableFragment firstAndLastWordMatchMethod (Node node, UpdatableFragment queryFragment, ArrayList< IndexAndlength > firstWordsHit, ArrayList< IndexAndlength > lastWordsHit) throws XPathExpressionException
 
Integer matchFirstWord (String[] nodeWords, String firstWord, String lastWord, IndexAndlength IaL, ArrayList< IndexAndlength > firstWordsHit, ArrayList< IndexAndlength > lastWordsHit)
 
UpdatableFragment matchLastWord (String[] nodeWords, String word, IndexAndlength IaL, int maxLength, int minLength, String XPath) throws XPathExpressionException
 
String createFragmentStringFromWords (String[] words, int firstWordIndex, int lastWordIndex)
 
UpdatableFragment firstAndLastLetterMatchMethod (Node node, UpdatableFragment queryFragment, ArrayList< IndexAndlength > firstWordsHit, ArrayList< IndexAndlength > lastWordsHit) throws XPathExpressionException
 
UpdatableFragment matchSameLastLetter (String[] nodeWords, String word, IndexAndlength IaL, int maxLength, int minLength, String XPath) throws XPathExpressionException
 
UpdatableFragment matchSameFirstLetter (String[] nodeWords, String word, IndexAndlength IaL, int maxLength, int minLength, String XPath) throws XPathExpressionException
 
UpdatableFragment matchMostSimiliar (String[] nodeWords, IndexAndlength IaL, int maxLength, int minLength, String XPath, String originalFragment) throws XPathExpressionException
 

Private Attributes

TraversingMethod traversingMethod
 
CompareMethod compareMethod
 
double maxLenghtEnlargement = 1.5
 
double maxLenghtReduction = 0.5
 

Detailed Description

Class consisting of traversing method and compare method.

Comparator class consisting of traversing method and compare method

Author
Michael Angelov

Definition at line 37 of file Comparator.java.

Constructor & Destructor Documentation

cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.Comparator ( CompareMethod  compareMethod,
TraversingMethod  traversingMethod 
)

Constructor

Parameters
compareMethodcompare method used to determine if strings match
traversingMethodtraversing method in strings

Definition at line 91 of file Comparator.java.

cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.Comparator ( CompareMethod  compareMethod,
TraversingMethod  traversingMethod,
double  maxLenghtEnlargement,
double  maxLenghtReduction 
)

Constructor

Parameters
compareMethodcompare method used to determine if strings match
traversingMethodtraversing method in strings
maxLenghtEnlargementmaximum annotation length enlargement
maxLenghtReductionmaximum annotation length reduction

Definition at line 104 of file Comparator.java.

Member Function Documentation

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.compare ( UpdatableFragment  queryFragment,
Node  node 
) throws XPathExpressionException

Fragment compare method

Parameters
queryFragmentfragment to be matched in node
nodenode in which string content of queryFrament should be matched
Returns
result fragment, null if there was no match

Definition at line 148 of file Comparator.java.

int cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.countWordsLengthBeg ( int  count,
String  words[] 
)
private

What is the offset of the n-th word from the beginning in the string with gaps?

Parameters
countn
wordsAll words
Returns
offset of the n-th word from the beginning od the string

Definition at line 407 of file Comparator.java.

Here is the caller graph for this function:

int cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.countWordsLengthEnd ( int  count,
String  words[],
int  wholeLength 
)
private

What is the offset of the n-th word from the end in the string with gaps?

Parameters
countn
wordsAll words
wholeLengthLength of the whole string with gaps
Returns
offset of the n-th word from the end od the string

Definition at line 423 of file Comparator.java.

Here is the caller graph for this function:

String cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.createFragmentStringFromWords ( String[]  words,
int  firstWordIndex,
int  lastWordIndex 
)
private

Creates a new fragment string from the words in array words. Inserts spaces between the words.

Parameters
wordsWords array used for the creation of the fragment string
firstWordIndexIndex of the first word.
lastWordIndexIndex of the last word.
Returns
String with the new fragment.

Definition at line 698 of file Comparator.java.

Here is the caller graph for this function:

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.firstAndLastLetterMatchMethod ( Node  node,
UpdatableFragment  queryFragment,
ArrayList< IndexAndlength firstWordsHit,
ArrayList< IndexAndlength lastWordsHit 
) throws XPathExpressionException
private

Method which is matching first or last word and last or first letter of the original fragment It's based in similiar idea as firstAndLastWordMatchMethod

Parameters
nodenode in which string content of queryFrament should be matched
queryFragmentfragment to be matched in node
firstWordsHitInitialized arraylist with stored first words of the fragment match hit in the node.
lastWordsHitInitialized arraylist with stored last words of the fragment match hit in the node.
Returns
result fragment, null if there was no match
Exceptions
XPathExpressionException

Definition at line 722 of file Comparator.java.

Here is the caller graph for this function:

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.firstAndLastWordMatchMethod ( Node  node,
UpdatableFragment  queryFragment,
ArrayList< IndexAndlength firstWordsHit,
ArrayList< IndexAndlength lastWordsHit 
) throws XPathExpressionException
private

Method which is matching first and last word of the original fragment

Parameters
nodenode in which string content of queryFrament should be matched
queryFragmentfragment to be matched in node
firstWordsHitInitialized arraylist for storing first word of the fragment match hit in the node.
lastWordsHitInitialized arraylist for storing last word of the fragment match hit in the node.
Returns
result fragment, null if there was no match
Exceptions
XPathExpressionException

Definition at line 565 of file Comparator.java.

Here is the caller graph for this function:

CompareMethod cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.getCompareMethod ( )

Getter for compare method used in comparator

Returns
compare method used in comparator

Definition at line 71 of file Comparator.java.

static String cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.getNodeContent ( Node  node)
static

Gets content of XML node

Parameters
nodeNode with content
Returns
If it's text node or CDATA, returns textual content of XML node, null otherwise

Definition at line 289 of file Comparator.java.

Here is the caller graph for this function:

TraversingMethod cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.getTraversingMethod ( )

Getter for traversing method used in comparator

Returns
traversing method used in comparator

Definition at line 62 of file Comparator.java.

Integer cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.matchFirstWord ( String[]  nodeWords,
String  firstWord,
String  lastWord,
IndexAndlength  IaL,
ArrayList< IndexAndlength firstWordsHit,
ArrayList< IndexAndlength lastWordsHit 
)
private

Finds the first occurrence of the word in the String array nodeWords

Parameters
nodeWordsWords of the node
firstWordFirst word which we are looking for
lastWordLast word which we are looking for
IaLVariable with the starting index and the starting offset
firstWordsHitArray to which found positions of first word will be stored
lastWordsHitArray to which found positions of last word will be stored
Returns
new offset

Definition at line 629 of file Comparator.java.

Here is the caller graph for this function:

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.matchLastWord ( String[]  nodeWords,
String  word,
IndexAndlength  IaL,
int  maxLength,
int  minLength,
String  XPath 
) throws XPathExpressionException
private

Finds the last occurrence of the word in the String array nodeWords

Parameters
nodeWordsWords of the node
wordWord which we are looking for
IaLVariable with the starting index and the starting offset
maxLengthMaximum length of the new fragment
minLengthMinimal length of the new fragment
XPathNew fragment XPath
Returns
New fragment or null if no fragment was found.
Exceptions
XPathExpressionException

Definition at line 663 of file Comparator.java.

Here is the caller graph for this function:

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.matchMostSimiliar ( String[]  nodeWords,
IndexAndlength  IaL,
int  maxLength,
int  minLength,
String  XPath,
String  originalFragment 
) throws XPathExpressionException
private

Method creates a fragment with most compatible words and the least levenstein distance from original fragment.

Parameters
nodeWordsWords of the node
IaLVariable with the starting index and the starting offset
maxLengthMaximum length of the new fragment
minLengthMinimum length of the new fragment
XPathNew fragment XPath
originalFragmentText of the original fragment
Returns
New fragment or null if no fragment was found.
Exceptions
XPathExpressionException

Definition at line 876 of file Comparator.java.

Here is the caller graph for this function:

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.matchSameFirstLetter ( String[]  nodeWords,
String  word,
IndexAndlength  IaL,
int  maxLength,
int  minLength,
String  XPath 
) throws XPathExpressionException
private

Method searches backwards for the first word with the same first letter as the word in parameter word.

Parameters
nodeWordsWords of the node
wordWord which we are looking for
IaLVariable with the starting index and the starting offset
maxLengthMaximum length of the new fragment
minLengthMinimal length of the new fragment
XPathNew fragment XPath
Returns
New fragment or null if no fragment was found.
Exceptions
XPathExpressionException

Definition at line 834 of file Comparator.java.

Here is the caller graph for this function:

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.matchSameLastLetter ( String[]  nodeWords,
String  word,
IndexAndlength  IaL,
int  maxLength,
int  minLength,
String  XPath 
) throws XPathExpressionException
private

Method searches for the first word with the same last letter as the word in parameter word.

Parameters
nodeWordsWords of the node
wordWord which we are looking for
IaLVariable with the starting index and the starting offset
maxLengthMaximum length of the new fragment
minLengthMinimal length of the new fragment
XPathNew fragment XPath
Returns
New fragment or null if no fragment was found.
Exceptions
XPathExpressionException

Definition at line 793 of file Comparator.java.

Here is the caller graph for this function:

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.selectBestPart ( UpdatableFragment  origFragment,
UpdatableFragment  newFragment 
) throws XPathExpressionException
private

Selects the best substrings of the new matched fragment. Best == least different from the original fragment

Parameters
origFragmentOriginal fragment
newFragmentMatched fragment
Returns
least different part of the matched fragment
Exceptions
XPathExpressionException

Definition at line 309 of file Comparator.java.

Here is the caller graph for this function:

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.selectBestSubFragment ( UpdatableFragment  origFragment,
ArrayList< UpdatableFragment BestSubParts 
) throws XPathExpressionException
private

Selects the best fragment from the best substrings

Parameters
origFragmentOriginal fragment
BestSubPartsBest substrings
Returns
New selected fragment
Exceptions
XPathExpressionException

Definition at line 439 of file Comparator.java.

Here is the caller graph for this function:

void cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.setmaxLenghtEnlargement ( double  maxLenghtEnlargement)

Setter for maximum annotation length enlargement used in FIRST_AND_LAST_WORD method

Parameters
maxLenghtEnlargementmaximum annotation length enlargement

Definition at line 81 of file Comparator.java.

String cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.toString ( )

Overriden toString() method

Returns
string representation of comparator

Definition at line 118 of file Comparator.java.

UpdatableFragment cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.wordMatchMethod ( Node  node,
UpdatableFragment  queryFragment 
) throws XPathExpressionException
private

Method which is matching over all words of the fragment

Parameters
nodenode in which string content of queryFrament should be matched
queryFragmentfragment to be matched in node
Returns
result fragment, null if there was no match
Exceptions
XPathExpressionException

Definition at line 488 of file Comparator.java.

Here is the caller graph for this function:

Member Data Documentation

CompareMethod cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.compareMethod
private

Compare method

Definition at line 51 of file Comparator.java.

double cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.maxLenghtEnlargement = 1.5
private

Maximal enlargement of fragment length

Definition at line 53 of file Comparator.java.

double cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.maxLenghtReduction = 0.5
private

Maximal reduction of fragment length

Definition at line 55 of file Comparator.java.

TraversingMethod cz.vutbr.fit.knot.annotations.fragmentUpdater.Comparator.traversingMethod
private

Traversing method

Definition at line 46 of file Comparator.java.


The documentation for this class was generated from the following file: