-
Notifications
You must be signed in to change notification settings - Fork 1
1. General Example Usage
At the very basic level, the fragment fingerprinter is a simple string matching-based functionality for creating bit and count vectors based on a set of initialisation strings that the fingerprinter checks given sets of strings for.
The following illustrates this with a basic example:
List tmpInitialisationStrings = List.of("Hannah", "Sam", "John", "Hugo", "Tim");
//Initialising the fingerprinter with the list of names
FragmentFingerprinter tmpFingerprinter = new FragmentFingerprinter(tmpInitialisationStrings);
//Creating a set of names to generate a fingerprint for
List tmpMyPartyPeople = List.of("Hugo", "Hannah", "Sam", "Maria");
//Generating the bit fingerprint
IBitFingerprint tmpMyPartyPeopleFP = tmpFingerprinter.getBitFingerprint(tmpMyPartyPeople);
System.out.println(tmpMyPartyPeopleFP.cardinality());
Output: 3
I.e. 3 positive bits in the fingerprint. Maria is ignored since she was not part of the initialisation set.
System.out.println(tmpMyPartyPeopleFP.asBitSet().toString());
Output: {0, 1, 3}
Hannah is represented by position 0, Sam by position 1, and Hugo by position 3 in the fingerprint and these positions are positive in the bit fingerprint.
//Printing the bit definitions and whether they are positive or not in the "party" set of names
for (int i = 0; i < tmpFingerprinter.getSize(); i++) {
System.out.println(tmpFingerprinter.getBitDefinition(i) + ": " + tmpMyPartyPeopleFP.get(i));
}
Output:
Hannah: true
Sam: true
John: false
Hugo: true
Tim: false