Class UnicodeBlockRanges
java.lang.Object
org.apache.tika.ml.junkdetect.UnicodeBlockRanges
Static codepoint-range → bucket-index lookup table used by Feature 2
(block-transition log-probability). Replaces
Character.UnicodeBlock.of(int) so that the model's block
semantics are fully decoupled from the JVM's Unicode-data release —
training on one JDK and serving on another produces identical scores
by construction.
The 338 named blocks are a snapshot from JDK 25's
Character.UnicodeBlock (Unicode 16.x). Codepoints in gaps
between named blocks resolve to the UNASSIGNED bucket
(338). The total bucket count is
bucketCount() = 339.
If the block list is ever updated, bump SCHEME_VERSION —
the model file's block_scheme_version byte must match. This
forces a clean retrain rather than silent re-mapping.
Lookup cost: O(log N) binary search. Thread-safe, immutable.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intBumped whenever the static range table below changes.static final intBucket index returned for codepoints in no named block. -
Method Summary
Modifier and TypeMethodDescriptionstatic intTotal number of buckets (named blocks + 1 unassigned).static intbucketOf(int cp) Returns the bucket id for the given codepoint, orUNASSIGNEDif the codepoint falls outside every named block range.
-
Field Details
-
SCHEME_VERSION
public static final int SCHEME_VERSIONBumped whenever the static range table below changes. A model trained against scheme version X cannot be served by code at version Y ≠ X — the loader rejects the mismatch.- See Also:
-
UNASSIGNED
public static final int UNASSIGNEDBucket index returned for codepoints in no named block.- See Also:
-
-
Method Details
-
bucketCount
public static int bucketCount()Total number of buckets (named blocks + 1 unassigned). -
bucketOf
public static int bucketOf(int cp) Returns the bucket id for the given codepoint, orUNASSIGNEDif the codepoint falls outside every named block range.Binary search over the sorted-by-
start_cprange list: O(log N) where N = 338 (the number of named blocks).
-