|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.knowcenter.wag.egov.egiz.pdf.AbsoluteTextSignature
public class AbsoluteTextSignature
Contains methods and helpers that implement the absolute text signature.
Constructor Summary | |
---|---|
AbsoluteTextSignature()
|
Method Summary | |
---|---|
static void |
checkBlockIntegrity(String text,
FoundBlock found_block)
Checks the integrity of a found block. |
static FoundBlock |
chooseMostPossibleBlock(List found_blocks)
Chooses the most possible (best choice) block of the list of blocks. |
static SignatureObject |
createSignatureObjectFromFoundBlock(String text,
FoundBlock found_block)
Creates a SignatureObject from a found block by extracting the corresponding values. |
static String |
cutOutBlock(String text,
FoundBlock block)
Cuts out the given found block from the text. |
static SignatureHolder |
extractLatestBlock(String text)
Extracts the latest signature block from the given text and creates a SignatureHolder object that can be verified. |
static List |
extractSignatureHoldersFromText(String text)
Extracts all signature holders from a given text. |
static List |
filterHorizontallyLargestBlocks(List found_blocks)
Filters out all blocks but the horizonally largest ones. |
static List |
filterLastDateEqualBlocks(String text,
List found_blocks)
Given a List of FoundBlock objects, this method returns the last blocks of this list that have the same date. |
static List |
filterVerticallyLargestBlocks(List found_blocks)
Filters out all blocks but the vertically largest ones. |
static int |
findEndOfValue(String text,
int start_index)
Finds the end of the value in the text. |
static List |
findIndicesWithStartingNL(String text,
String subtext)
Finds all indices of the given subtext (starting at a new line) within a given text. |
static FoundBlock |
findLatestBlock(String text)
Finds the latest signature block for a given text. |
static List |
findPotentialSignaturesForProfile(String text,
SignatureTypeDefinition block_type)
Finds the List of potential blocks within the given text for the given profile. |
static List |
findRestKeys(String text,
List keys,
List captions,
int last_caption_index)
Finds the other keys/captions according to their order starting from the last_caption index upwards. |
static EGIZDate |
getDateFromFoundBlock(String text,
FoundBlock found_block)
Parses the EGIZDate from a found block and the given text. |
static String |
getDateValue(String text,
FoundBlock block)
Returns the value of the date field as String. |
protected static boolean |
isHorizontallyEqual(FoundBlock fb0,
FoundBlock fb1)
|
protected static boolean |
isHorizontallyLarger(FoundBlock fb0,
FoundBlock fb1)
|
static boolean |
reverseCheckFoundKeys(String text,
List found_keys)
Performs a reverse (top to bottom) search for the found keys and checks that these indices are the same as those that were found during the regular (bottom up) search. |
static void |
sortFoundBlocksByDate(String text,
List found_blocks)
Sorts the List of found blocks by date. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbsoluteTextSignature()
Method Detail |
---|
public static List extractSignatureHoldersFromText(String text) throws SignatureException, SignatureTypesException
First the latest signature holder is extracted. Then the latest signature holder in the rest text, which is the second latest one, is extracted. Then the third latest signature holder is extracted and so forth until no more signature holders are found.
text
- The text.
SignatureException
- F.e.
SignatureTypesException
- F.e.public static SignatureHolder extractLatestBlock(String text) throws SignatureException, SignatureTypesException
text
- The text.
SignatureException
- F.e.
SignatureTypesException
- F.e.public static FoundBlock findLatestBlock(String text) throws SignatureException, SignatureTypesException
The latest block is the one with the highest, most recent date. Usually this block will be extracted (cut out) of the text which will result in the originally signed text of this signature to be verified using the cut out data.
text
- The text to be analyzed.
SignatureException
- F.e.
SignatureTypesException
- F.e.public static List findPotentialSignaturesForProfile(String text, SignatureTypeDefinition block_type)
text
- The text, in which potential block are to be sought.block_type
- The profile for which the text is to be sought.
public static List findIndicesWithStartingNL(String text, String subtext)
This is usually used to find the indices of the last captions.
text
- The text to be searched.subtext
- The subtext to be sought.
public static List findRestKeys(String text, List keys, List captions, int last_caption_index)
text
- The text.keys
- The list of keys.captions
- The list of captions.last_caption_index
- The index of the last caption.
public static boolean reverseCheckFoundKeys(String text, List found_keys)
If a reverse check proves that the found keys are not at the same positions as during regular search, this list of found keys should be discarded.
text
- The text.found_keys
- The found keys to be reversely checked.
public static int findEndOfValue(String text, int start_index)
This simply scans for a '\n' from a given start index. The line up to and inclusive the '\n' is considered to be the value.
Note that this method does NOT find the accurate value, if the value goes over multiple lines! This may bear a serious problem. Usually this method is only used to finding the end of the last value in a found block, because mid- values are exactly determined by their start index and the start of the next caption. Nevertheless, if the last value spans over multiple lines, this method will not retrieve it completely.
text
- The text.start_index
- The start index from where the end of the value is sought.
public static void checkBlockIntegrity(String text, FoundBlock found_block)
This is an assertive function.
text
- The text.found_block
- The found block.public static String cutOutBlock(String text, FoundBlock block)
text
- The text.block
- The found block.
public static String getDateValue(String text, FoundBlock block)
text
- The text.block
- The found block.
public static SignatureObject createSignatureObjectFromFoundBlock(String text, FoundBlock found_block) throws SignatureTypesException, SignatureException
text
- The text.found_block
- The found block.
SignatureTypesException
- F.e.
SignatureException
- F.e.public static EGIZDate getDateFromFoundBlock(String text, FoundBlock found_block)
text
- The text.found_block
- The found block.
public static void sortFoundBlocksByDate(String text, List found_blocks)
text
- The text.found_blocks
- The List of found blocks.public static List filterLastDateEqualBlocks(String text, List found_blocks)
Usually a date sorted list (earliest first, latest last) will be provided to this method. Then the last date equal blocks are returned, which are the last blocks.
text
- The text to retrieve the values of the fields from.found_blocks
- The List of FoundBlock objects.
public static FoundBlock chooseMostPossibleBlock(List found_blocks) throws SignatureException
The strategy to find the most possible block is to choose the very one block with the maximum number of captions. This block has extracted most information from the text.
If there are still multiple blocks with the same number of cations, the blocks are compared caption-wise. The block with all captions being longer or equal to all other blocks' captions wins.
found_blocks
- The List of semantically equal blocks.
SignatureException
public static List filterVerticallyLargestBlocks(List found_blocks)
A vertically largest block has the most found keys.
found_blocks
- The List of FoundBlock objects to be filtered.
public static List filterHorizontallyLargestBlocks(List found_blocks) throws SignatureException
A vertically largest block has the most found keys.
found_blocks
- The List of FoundBlock objects to be filtered. All of these
FoundBlock objects must have the same number of found keys.
SignatureException
protected static boolean isHorizontallyEqual(FoundBlock fb0, FoundBlock fb1)
protected static boolean isHorizontallyLarger(FoundBlock fb0, FoundBlock fb1)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |