Running a Character-by-character Comparison
This section discusses how you can perform character-by-character comparison. For the resources associated with this sample, see here.
-
Document Comparator - Uses Java API calls to customise a pre-existing pipeline with a number of extension points.
This document comprises two sections:
Background: some background to the character by character processing, including why it is implemented as a post comparison output filter and at what stage in the output filtering it should be applied;
Tutorial: a discussion on what results to expect from the character by character processing, how to make use of the code and how to run the sample.
Background
Character-by-character comparison serves as a parameter that can be enabled and then the Character by character processing applies exclusively to regions of text that have already been aligned, specifically targeting modified deltaxml:textGroup elements.
Character by character analysis focuses on text groups rather than applying analysis solely on modified words, which may not capture simple words splitting and joining. Additionally, character-by-character comparison takes place after other word and block-level filters have adjusted text alignment.
This method aims to minimise the number of modified text groups and enhance the likelihood of comparing similar text accurately. Furthermore, the introduction of the @deltaxml:character-by-character attribute enables the selective enabling or disabling of character-by-character comparison for specific subtrees or elements. This attribute offers greater flexibility in controlling the scope of character-by-character comparison.
Tutorial
Expected results
The sample output file contains many examples of the output of character by character processing, along with an explanation of why those results were produced.
For the purposes of this document, we will choose to discuss a few of these examples.
The sample file demonstrates character-by-character processing's capability to detect changes.
Initially, we examine pluralisation modifications within a sentence.
-
"The quick brown foxes jump
sover the lazy dogs."
The following example shows how changing a letter in a word is represented.
-
"The quick brown fox jumps over the lazy
dhog."
Character-by-character processing scenarios.
Correction of Spelling Mistakes
Examples include corrected misspelled words.
"It is easy to omit letters when typing."
"It is easy to swawp letters when typing."
However, sometimes the amount of change required to correct a spelling breaks the max number of allowed changes. For example:
“one green cartwo red cars parked”
Capitalisation
Examples showcase changes in capitalisation.
"fForgetting to capitalise a sentence is easy."
"It is also easy to Iinappropriately capitalise a word."
Running the sample (in Java)
For the resources associated with this sample, see the Bitbucket repository.
The sample resources should be checked-out, cloned or downloaded and unzipped into the samples directory of the DeltaNova release. They should be located such that they are two levels below the top level release directory for example DeltaNova-year.x.y.z/samples/CharacterByCharacter.