You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2026/06/11 21:05:25 UTC
(tika) branch TIKA-4692-script-block-features created (now ba3709e8dc)
This is an automated email from the ASF dual-hosted git repository.
tballison pushed a change to branch TIKA-4692-script-block-features
in repository https://gitbox.apache.org/repos/asf/tika.git
at ba3709e8dc simplify nb mojibuster
This branch includes the following new commits:
new ba3709e8dc simplify nb mojibuster
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(tika) 01/01: simplify nb mojibuster
Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tballison pushed a commit to branch TIKA-4692-script-block-features
in repository https://gitbox.apache.org/repos/asf/tika.git
commit ba3709e8dc38399a4725dff17781b8b8f454d407
Author: tballison <ti...@elastic.co>
AuthorDate: Thu Jun 11 23:04:05 2026 +0200
simplify nb mojibuster
---
.skills/tika-eval-compare.md | 3 +-
CHANGES.txt | 9 +
.../ROOT/pages/advanced/flores-eval-20260320.txt | 580 +
.../pages/advanced/generative-language-model.adoc | 240 +
.../integration-testing/tika-eval-regression.adoc | 11 +-
.../pages/advanced/language-detection-build.adoc | 2 +-
.../ROOT/pages/advanced/language-detection.adoc | 91 +-
.../pages/configuration/encoding-detectors.adoc | 202 +-
docs/modules/ROOT/pages/configuration/index.adoc | 28 +
.../src/main/java/org/apache/tika/cli/TikaCLI.java | 2 +
.../java/org/apache/tika/config/TikaExtras.java | 167 +
.../tika/detect/DefaultEncodingDetector.java | 55 +-
.../org.apache.tika.detect.EncodingDetector | 9 +-
.../org/apache/tika/config/TikaExtrasTest.java | 138 +
.../charsoup/CharSoupEncodingDetector.java | 479 +
.../org.apache.tika.detect.EncodingDetector | 3 +-
.../ml/chardetect/ByteNgramFeatureExtractor.java | 334 +
.../tika/ml/chardetect/CjkDecodeValidator.java | 21 +-
.../ml/chardetect/MojibusterEncodingDetector.java | 1327 +-
.../NaiveBayesBigramEncodingDetector.java | 28 +
.../org.apache.tika.detect.EncodingDetector | 4 +-
.../tika/ml/chardetect/CjkDecodeValidatorTest.java | 21 +
.../ml/chardetect/ZipFilenameDetectionTest.java | 3 -
.../org.apache.tika.detect.EncodingDetector | 3 +-
.../tika/eval/app/ExtractComparerRunner.java | 60 +-
.../src/main/resources/comparison-reports-pg.xml | 202 +
.../src/main/resources/comparison-reports.xml | 202 +
.../eval/core/metadata/TikaEvalMetadataFilter.java | 41 +-
.../src/main/resources/common_tokens/ace | 1835 ++
.../src/main/resources/common_tokens/afr | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/aka | 10523 +++++++
.../src/main/resources/common_tokens/alt | 3219 ++
.../src/main/resources/common_tokens/amh | 10931 +++++++
.../src/main/resources/common_tokens/ami | 3100 ++
.../src/main/resources/common_tokens/ara | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/arg | 27240 +++++++++++++++++
.../src/main/resources/common_tokens/asm | 5897 ++++
.../src/main/resources/common_tokens/ava | 3064 ++
.../src/main/resources/common_tokens/avk | 8044 +++++
.../src/main/resources/common_tokens/azb | 29351 ++++++++++++++++++
.../src/main/resources/common_tokens/aze | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/bak | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/ban | 7999 +++++
.../src/main/resources/common_tokens/bar | 17893 +++++++++++
.../src/main/resources/common_tokens/bcl | 13933 +++++++++
.../src/main/resources/common_tokens/be-x-old | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/bel | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/ben | 16902 +++++++++++
.../src/main/resources/common_tokens/bjn | 5725 ++++
.../src/main/resources/common_tokens/bod | 527 +
.../src/main/resources/common_tokens/bre | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/bul | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/bxr | 4359 +++
.../src/main/resources/common_tokens/cat | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/cdo-x-rom | 724 +
.../src/main/resources/common_tokens/ceb | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/ces | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/che | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/chv | 19092 ++++++++++++
.../src/main/resources/common_tokens/ckb | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/cnh | 19238 ++++++++++++
.../src/main/resources/common_tokens/cor | 4267 +++
.../src/main/resources/common_tokens/cos | 9249 ++++++
.../src/main/resources/common_tokens/csb | 2639 ++
.../src/main/resources/common_tokens/cym | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/dag | 5221 ++++
.../src/main/resources/common_tokens/dan | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/deu | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/diq | 29221 ++++++++++++++++++
.../src/main/resources/common_tokens/div | 13843 +++++++++
.../src/main/resources/common_tokens/dsb | 2955 ++
.../src/main/resources/common_tokens/ell | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/eng | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/epo | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/est | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/eus | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/ewe | 12051 ++++++++
.../src/main/resources/common_tokens/ext | 3724 +++
.../src/main/resources/common_tokens/fao | 11610 +++++++
.../src/main/resources/common_tokens/fas | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/fin | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/fra | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/frr | 5782 ++++
.../src/main/resources/common_tokens/fry | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/gla | 7964 +++++
.../src/main/resources/common_tokens/gle | 29093 ++++++++++++++++++
.../src/main/resources/common_tokens/glg | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/glv | 4442 +++
.../src/main/resources/common_tokens/gom | 6007 ++++
.../src/main/resources/common_tokens/grn | 5457 ++++
.../src/main/resources/common_tokens/gsw | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/guj | 6632 ++++
.../src/main/resources/common_tokens/hak-x-rom | 788 +
.../src/main/resources/common_tokens/hau | 25361 ++++++++++++++++
.../src/main/resources/common_tokens/heb | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/hil | 20997 +++++++++++++
.../src/main/resources/common_tokens/hin | 9867 ++++++
.../src/main/resources/common_tokens/hrv | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/hsb | 10177 +++++++
.../src/main/resources/common_tokens/hun | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/hye | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/hyw | 22803 ++++++++++++++
.../src/main/resources/common_tokens/ibo | 20608 +++++++++++++
.../src/main/resources/common_tokens/ido | 16061 ++++++++++
.../src/main/resources/common_tokens/ile | 3792 +++
.../src/main/resources/common_tokens/ilo | 7646 +++++
.../src/main/resources/common_tokens/ina | 10702 +++++++
.../src/main/resources/common_tokens/ind | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/isl | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/ita | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/jav | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/jbo | 1323 +
.../src/main/resources/common_tokens/jpn | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/kaa | 5731 ++++
.../src/main/resources/common_tokens/kab | 3954 +++
.../src/main/resources/common_tokens/kan | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/kat | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/kaz | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/kha | 10883 +++++++
.../src/main/resources/common_tokens/khm | 11291 +++++++
.../src/main/resources/common_tokens/kin | 9304 ++++++
.../src/main/resources/common_tokens/kir | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/kor | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/kpv | 4163 +++
.../src/main/resources/common_tokens/ksh | 3014 ++
.../src/main/resources/common_tokens/kur | 23172 ++++++++++++++
.../src/main/resources/common_tokens/lao | 1063 +
.../src/main/resources/common_tokens/lat | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/lav | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/lez | 4709 +++
.../src/main/resources/common_tokens/lfn | 6527 ++++
.../src/main/resources/common_tokens/lim | 22855 ++++++++++++++
.../src/main/resources/common_tokens/lit | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/ltz | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/lug | 6223 ++++
.../src/main/resources/common_tokens/lus | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/mal | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/mar | 11551 +++++++
.../src/main/resources/common_tokens/mhr | 6695 +++++
.../src/main/resources/common_tokens/min | 19010 ++++++++++++
.../src/main/resources/common_tokens/mkd | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/mlg | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/mlt | 20687 +++++++++++++
.../src/main/resources/common_tokens/mon | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/mrj | 3456 +++
.../src/main/resources/common_tokens/msa | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/mwl | 16636 ++++++++++
.../src/main/resources/common_tokens/mya | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/myv | 2724 ++
.../src/main/resources/common_tokens/mzn | 6049 ++++
.../src/main/resources/common_tokens/nds | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/nep | 6948 +++++
.../src/main/resources/common_tokens/nld | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/nno | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/nob | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/nqo | 3257 ++
.../src/main/resources/common_tokens/nso | 1364 +
.../src/main/resources/common_tokens/nya | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/olo | 2772 ++
.../src/main/resources/common_tokens/ori | 6390 ++++
.../src/main/resources/common_tokens/orm | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/oss | 5513 ++++
.../src/main/resources/common_tokens/pam | 4205 +++
.../src/main/resources/common_tokens/pan | 3481 +++
.../src/main/resources/common_tokens/pap | 4147 +++
.../src/main/resources/common_tokens/pfl | 2518 ++
.../src/main/resources/common_tokens/pnb | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/pol | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/por | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/pus | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/roh | 13836 +++++++++
.../src/main/resources/common_tokens/ron | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/rue | 4946 +++
.../src/main/resources/common_tokens/rus | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/sah | 21009 +++++++++++++
.../src/main/resources/common_tokens/san | 6668 ++++
.../src/main/resources/common_tokens/sat | 7800 +++++
.../src/main/resources/common_tokens/sgs | 3925 +++
.../src/main/resources/common_tokens/sin | 17988 +++++++++++
.../src/main/resources/common_tokens/skr | 7454 +++++
.../src/main/resources/common_tokens/slk | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/slv | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/sme | 2348 ++
.../src/main/resources/common_tokens/smn | 3722 +++
.../src/main/resources/common_tokens/smo | 25548 ++++++++++++++++
.../src/main/resources/common_tokens/sna | 7551 +++++
.../src/main/resources/common_tokens/snd | 16367 ++++++++++
.../src/main/resources/common_tokens/som | 10352 +++++++
.../src/main/resources/common_tokens/spa | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/sqi | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/srp | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/stq | 4126 +++
.../src/main/resources/common_tokens/sun | 19608 ++++++++++++
.../src/main/resources/common_tokens/swe | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/swh | 28082 +++++++++++++++++
.../src/main/resources/common_tokens/szl | 7639 +++++
.../src/main/resources/common_tokens/szy | 5873 ++++
.../src/main/resources/common_tokens/tam | 17977 +++++++++++
.../src/main/resources/common_tokens/tat | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/tay | 1468 +
.../src/main/resources/common_tokens/tel | 18420 ++++++++++++
.../src/main/resources/common_tokens/tet | 25352 ++++++++++++++++
.../src/main/resources/common_tokens/tgk | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/tgl | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/tha | 29913 ++++++++++++++++++
.../src/main/resources/common_tokens/tir | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/trv | 3912 +++
.../src/main/resources/common_tokens/tsn | 13078 ++++++++
.../src/main/resources/common_tokens/tso | 12350 ++++++++
.../src/main/resources/common_tokens/tuk | 13433 +++++++++
.../src/main/resources/common_tokens/tum | 5734 ++++
.../src/main/resources/common_tokens/tur | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/tyv | 6895 +++++
.../src/main/resources/common_tokens/udm | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/uig | 21818 ++++++++++++++
.../src/main/resources/common_tokens/ukr | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/urd | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/uzb | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/vep | 8748 ++++++
.../src/main/resources/common_tokens/vie | 23406 +++++++++++++++
.../src/main/resources/common_tokens/vls | 9883 ++++++
.../src/main/resources/common_tokens/vol | 4552 +++
.../src/main/resources/common_tokens/vro | 3472 +++
.../src/main/resources/common_tokens/war | 28061 +++++++++++++++++
.../src/main/resources/common_tokens/wln | 8023 +++++
.../src/main/resources/common_tokens/xho | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/xmf | 12122 ++++++++
.../src/main/resources/common_tokens/ydd | 14503 +++++++++
.../src/main/resources/common_tokens/yor | 6469 ++++
.../src/main/resources/common_tokens/yue | 15114 ++++++++++
.../src/main/resources/common_tokens/zho | 30020 +++++++++++++++++++
.../src/main/resources/common_tokens/zul | 6330 ++++
.../charsoup/GenerativeLanguageModel.java | 1079 +
.../langdetect/charsoup/GlmScriptCategory.java | 174 +
.../charsoup/langdetect-generative-v4-20260320.bin | Bin 0 -> 7493241 bytes
.../charsoup/CharSoupDetectorConfig.java | 70 +
.../charsoup/CharSoupLanguageDetector.java | 296 +-
.../charsoup/CharSoupDetectorConfigTest.java | 93 +
.../charsoup/CharSoupModelRoutingTest.java | 71 +
.../langdetect/charsoup/LangIdRegressionTest.java | 3 +-
.../charsoup/tools/CompareDetectors.java | 56 +-
.../charsoup/tools/GlmAdjudicateDiagnostic.java | 149 +
.../charsoup/tools/GlmNoiseSensitivityReport.java | 469 +
.../langdetect/charsoup/tools/GlmRerankerEval.java | 311 +
.../langdetect/charsoup/tools/RecalibrateGlm.java | 197 +
.../tools/TrainGenerativeLanguageModel.java | 442 +
.../ml/chardetect/tools/LearnQuadrantWeights.java | 332 +
.../main/java/org/apache/tika/ml/LinearModel.java | 271 +-
.../org.apache.tika.detect.EncodingDetector | 5 +-
.../tika/config/TikaEncodingDetectorTest.java | 119 +-
.../apache/tika/parser/AutoDetectParserTest.java | 4 +-
.../parser/html/HtmlEncodingDetectionTest.java | 2 +-
.../tika/parser/microsoft/rtf/RTFParserTest.java | 7 +-
.../org/apache/tika/parser/pdf/PDFParserTest.java | 2 +-
.../TIKA-2485-encoding-detector-mark-limits.json | 4 +-
.../tika-parser-html-module/pom.xml | 9 +-
.../apache/tika/parser/html/HtmlParserTest.java | 15 +-
.../tika-parser-mail-module/pom.xml | 11 +-
.../tika-parser-microsoft-module/pom.xml | 13 +-
.../tika/parser/microsoft/HSLFExtractor.java | 9 +-
.../microsoft/POIContainerExtractionTest.java | 2 +-
.../tika-parser-miscoffice-module/pom.xml | 17 +-
.../tika-parser-text-module/pom.xml | 5 +-
.../tika/parser/csv/TextAndCSVParserTest.java | 12 +-
.../org/apache/tika/parser/txt/TXTParserTest.java | 37 +-
.../configs/tika-config-ignore-charset.json | 13 -
.../tika-parsers-standard-package/pom.xml | 4 +-
.../tika/pipes/core/PerClientServerManager.java | 4 +-
.../tika/pipes/core/SharedServerManager.java | 4 +-
.../apache/tika/pipes/core/PipesClientTest.java | 8 +-
.../pipes/core/SharedServerChaosMonkeyTest.java | 5 +-
tika-server/docker-build/README.md | 6 +
.../apache/tika/server/core/TikaServerProcess.java | 6 +
273 files changed, 3725119 insertions(+), 1147 deletions(-)
diff --git a/.skills/tika-eval-compare.md b/.skills/tika-eval-compare.md
index d4549d26c8..cdb581e386 100644
--- a/.skills/tika-eval-compare.md
+++ b/.skills/tika-eval-compare.md
@@ -88,8 +88,9 @@ java -jar <tika-eval>/tika-eval-app-*.jar Compare \
| `-a` | Directory of "before" extracts (required) |
| `-b` | Directory of "after" extracts (required) |
| `-d` | H2 database path (temp file if omitted) |
-| `-r` | Auto-run Report + tar.gz after Compare |
+| `-r` | Auto-run Report + tgz the reports dir (`<reportsDir>.tgz`) after Compare |
| `-rd` | Reports output directory (default: `reports`) |
+| `-z` | Gzip the H2 db (`<db>.mv.db.gz`) after Compare for transfer; requires `-d` (no-op + warning for a temp db). Combine with `-r` to package both. |
| `-n` | Number of worker threads |
## Step 3 — Review Results
diff --git a/CHANGES.txt b/CHANGES.txt
index 31c3876a0e..e827e1fab4 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -9,6 +9,15 @@ Release 4.0.0-beta-1 - unreleased
-x/--xml, the server /tika/xml and /rmeta/xml paths (or the
X-Tika-Handler header), and the async CLI --handler x (TIKA-4663).
+ NEW FEATURES
+
+ * tika-app and tika-server can load extra jars (additional EncodingDetectors,
+ Parsers, etc.) from the directory named by the -Dtika.extras.dir system
+ property, without repackaging the application. Off by default; the directory
+ is a trusted code location whose contents run with full process privileges.
+ The extra jars are also forwarded onto forked pipes/server worker processes,
+ so they are available where parsing actually happens (TIKA-4755).
+
Release 4.0.0-alpha-1 - 5/4/2026
diff --git a/docs/modules/ROOT/pages/advanced/flores-eval-20260320.txt b/docs/modules/ROOT/pages/advanced/flores-eval-20260320.txt
new file mode 100644
index 0000000000..12bd912a97
--- /dev/null
+++ b/docs/modules/ROOT/pages/advanced/flores-eval-20260320.txt
@@ -0,0 +1,580 @@
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+=== Probe length: 8B ===
+[INFO] Maveniverse Nisse 0.7.0 loaded
+[INFO] Nisse injecting 27 properties into User Properties
+[INFO] Scanning for projects...
+[WARNING]
+[WARNING] Some problems were encountered while building the effective model for org.apache.tika:tika-parent:pom:4.0.0-SNAPSHOT
+[WARNING] 'version' contains an expression but should be a constant. @ org.apache.tika:tika-parent:${revision}, /Users/tallison/Intellij/tika-main-chardet/tika-parent/pom.xml, line 35, column 12
+[WARNING]
+[WARNING] Some problems were encountered while building the effective model for org.apache.tika:tika:pom:4.0.0-SNAPSHOT
+[WARNING] 'version' contains an expression but should be a constant. @ org.apache.tika:tika-parent:${revision}, /Users/tallison/Intellij/tika-main-chardet/tika-parent/pom.xml, line 35, column 12
+[WARNING]
+[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
+[WARNING]
+[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
+[WARNING]
+[INFO] No need for inlining
+[INFO]
+[INFO] --------------< org.apache.tika:tika-langdetect-charsoup >--------------
+[INFO] Building Apache Tika langdetect (built-in charsoup) 4.0.0-SNAPSHOT
+[INFO] from pom.xml
+[INFO] --------------------------------[ jar ]---------------------------------
+[INFO]
+[INFO] --- exec:3.6.3:java (default-cli) @ tika-langdetect-charsoup ---
+CharSoup strategy: STANDARD
+Evaluation threads: 12
+Loading test data: /Users/tallison/datasets/flores-200/flores200_dev.tsv
+ Flores-200 mode: normalizing xxx_Yyyy → xxx codes
+ (multi-script variants kept as xxx_Yyyy separate classes)
+Test sentences: 203,381
+
+Loading CharSoup model: /Users/tallison/datasets/wikipedia-model-v14/langdetect-v14.bin
+ CharSoup model: 204 classes, 32768 buckets, flags=0xE81, ~8.1 MB heap
+ Evaluation routes through CharSoupLanguageDetector (script gate + confusable group collapse).
+Loading OpenNLP detector(s)...
+SLF4J(W): No SLF4J providers were found.
+SLF4J(W): Defaulting to no-operation (NOP) logger implementation
+SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ Loaded: org.apache.tika.langdetect.opennlp.OpenNLPDetector
+ OpenNLP: 12 instance(s), ~79.2 MB heap
+Loading Lingua detector (low accuracy mode)...
+ Loaded Lingua (low accuracy mode, 75 languages), ~0.0 MB heap
+Loading Optimaize detector(s)...
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Loaded: org.apache.tika.langdetect.optimaize.OptimaizeLangDetector
+ Optimaize: 12 instance(s), ~94.5 MB heap
+
+Warming up (200 iterations)...
+ VERIFY: predictions use 204 classes, 32,768 buckets, flags=0xE81 (from file)
+
+CharSoup ∩ OpenNLP: 105 languages, 104,684 sentences
+CharSoup ∩ Lingua: 71 languages, 70,784 sentences (Lingua covers 75)
+CharSoup ∩ Optimaize: 63 languages, 61,811 sentences
+
+Evaluating @20 ... charsoup= 80.51% opennlp= 72.85% lingua= 75.88% optimaize= 84.38%
+Evaluating @50 ... charsoup= 94.09% opennlp= 85.43% lingua= 90.63% optimaize= 94.29%
+Evaluating @100 ... charsoup= 97.00% opennlp= 90.12% lingua= 95.33% optimaize= 96.50%
+Evaluating @150 ... charsoup= 97.47% opennlp= 90.97% lingua= 96.11% optimaize= 96.76%
+Evaluating @200 ... charsoup= 97.51% opennlp= 91.11% lingua= 96.20% optimaize= 96.79%
+Evaluating @500 ... charsoup= 97.52% opennlp= 91.12% lingua= 96.22% optimaize= 96.81%
+Evaluating full ... charsoup= 97.52% opennlp= 91.12% lingua= 96.22% optimaize= 96.81%
+
+=== Language Detection Comparison Report ===
+
+Test sentences: 203,381
+CharSoup ∩ OpenNLP: 105 languages, 104,684 sentences
+CharSoup ∩ Lingua: 71 languages, 70,784 sentences
+CharSoup ∩ Optimaize: 63 languages, 61,811 sentences
+
+Model heap (approx):
+ CharSoup: ~8.1 MB
+ OpenNLP: ~79.2 MB
+ Lingua: ~0.1 MB (low accuracy mode)
+ Optimaize: ~94.5 MB
+
+Coverage-adjusted accuracy — each detector scored on its own supported languages only
+ (test sentences whose true language is not in a detector's covered set are skipped)
+ ─ CharSoup ─ ─ OpenNLP ─ ── Lingua ── ─ Optimaize ─ CS(ms) ON(ms) Li(ms) Opt(ms) CS sent/s
+Length mF1 acc mF1 acc mF1 acc mF1 acc
+----------------------------------------------------------------------------------------------------------------------
+@20 82.51% 80.51% 74.87% 72.85% 76.35% 75.88% 84.87% 84.38% 932 769 10,122 400 139,061
+@50 94.44% 94.09% 86.09% 85.43% 90.99% 90.63% 94.44% 94.29% 1,000 657 18,646 2,048 129,605
+@100 96.98% 97.00% 90.25% 90.12% 95.43% 95.33% 96.51% 96.50% 1,015 1,200 30,831 2,051 127,690
+@150 97.41% 97.47% 90.98% 90.97% 96.15% 96.11% 96.72% 96.76% 1,087 1,592 37,481 2,119 119,232
+@200 97.45% 97.51% 91.11% 91.11% 96.23% 96.20% 96.75% 96.79% 1,115 1,820 39,759 2,127 116,238
+@500 97.46% 97.52% 91.12% 91.12% 96.25% 96.22% 96.76% 96.81% 1,118 2,033 40,426 2,221 115,926
+full 97.46% 97.52% 91.12% 91.12% 96.25% 96.22% 96.76% 96.81% 1,121 1,820 40,505 2,139 115,616
+
+Breadth-weighted accuracy — all 203 FLORES languages, unsupported languages score 0
+ (penalises limited coverage; use this to compare total useful output across all inputs)
+ ─ CharSoup ─ ─ OpenNLP ─ ── Lingua ── ─ Optimaize ─
+Length mF1 acc mF1 acc mF1 acc mF1 acc
+----------------------------------------------------------------------
+@20 52.43% 51.31% 42.05% 40.71% 27.46% 27.53% 26.76% 26.89%
+@50 60.01% 59.96% 48.35% 47.74% 32.72% 32.88% 29.77% 30.04%
+@100 61.63% 61.81% 50.68% 50.36% 34.32% 34.58% 30.43% 30.75%
+@150 61.90% 62.11% 51.09% 50.84% 34.58% 34.86% 30.49% 30.83%
+@200 61.93% 62.14% 51.16% 50.91% 34.61% 34.90% 30.50% 30.84%
+@500 61.93% 62.15% 51.17% 50.92% 34.61% 34.90% 30.51% 30.84%
+full 61.93% 62.15% 51.17% 50.92% 34.61% 34.90% 30.51% 30.84%
+
+Strict accuracy — CharSoup ∩ OpenNLP (105 languages, 104,684 sentences)
+ ── CharSoup ── ── OpenNLP ── CS(ms) OpenNLP(ms) CS sent/s
+Length mF1 acc mF1 acc
+------------------------------------------------------------------------
+@20 84.23% 81.44% 76.69% 74.07% 504 228 207,706
+@50 95.73% 95.12% 87.27% 86.37% 431 333 242,886
+@100 98.09% 97.93% 91.05% 90.79% 523 620 200,161
+@150 98.47% 98.36% 91.68% 91.55% 578 852 181,114
+@200 98.51% 98.40% 91.77% 91.65% 583 969 179,561
+@500 98.51% 98.41% 91.78% 91.67% 593 956 176,533
+full 98.51% 98.41% 91.78% 91.67% 604 959 173,318
+
+Strict accuracy — CharSoup ∩ Lingua (71 languages, 70,784 sentences)
+ ── CharSoup ── ── Lingua ── CS(ms) Lingua(ms) CS sent/s
+Length mF1 acc mF1 acc
+------------------------------------------------------------------------
+@20 85.28% 81.44% 77.78% 76.80% 303 2,960 233,611
+@50 96.37% 95.65% 92.24% 91.51% 296 5,992 239,135
+@100 98.51% 98.37% 96.58% 96.20% 359 9,756 197,170
+@150 98.80% 98.70% 97.27% 96.96% 395 11,847 179,200
+@200 98.82% 98.73% 97.37% 97.07% 437 12,615 161,977
+@500 98.83% 98.75% 97.38% 97.09% 409 12,840 173,066
+full 98.83% 98.75% 97.38% 97.09% 402 12,847 176,080
+
+Strict accuracy — CharSoup ∩ Optimaize (63 languages, 61,811 sentences)
+ ── CharSoup ── ── Optimaize ── CS(ms) Optimaize(ms) CS sent/s
+Length mF1 acc mF1 acc
+------------------------------------------------------------------------
+@20 86.52% 82.78% 86.30% 85.54% 215 76 287,493
+@50 96.92% 96.15% 95.40% 95.14% 250 367 247,244
+@100 98.84% 98.66% 97.23% 97.17% 320 360 193,159
+@150 99.12% 98.98% 97.33% 97.34% 342 374 180,734
+@200 99.13% 99.01% 97.34% 97.35% 346 374 178,645
+@500 99.14% 99.02% 97.34% 97.35% 354 377 174,607
+full 99.14% 99.02% 97.34% 97.35% 353 385 175,102
+
+CharSoup timing (wall-clock, full pipeline including script gate + group collapse):
+Length Wall(ms) Sent/sec
+--------------------------------
+@20 932 139,061
+@50 1,000 129,605
+@100 1,015 127,690
+@150 1,087 119,232
+@200 1,115 116,238
+@500 1,118 115,926
+full 1,121 115,616
+
+Per-language CharSoup F1 by length:
+Language @20 @50 @100 @150 @200 @500 full
+----------------------------------------------------------------------
+ace 75.76% 90.52% 95.50% 96.15% 96.31% 96.31% 96.31%
+afr 79.05% 96.87% 99.40% 99.55% 99.55% 99.55% 99.55%
+aka 86.13% 96.00% 98.73% 99.19% 99.24% 99.24% 99.24%
+amh 96.55% 99.75% 99.95% 99.95% 99.95% 99.95% 99.95%
+ara 96.97% 99.95% 99.95% 99.95% 99.95% 99.95% 99.95%
+asm 94.88% 99.65% 100.00% 100.00% 100.00% 100.00% 100.00%
+azb 61.48% 78.64% 88.32% 90.51% 90.93% 90.93% 90.93%
+aze 86.02% 98.27% 99.70% 99.80% 99.80% 99.80% 99.80%
+bak 86.65% 98.33% 99.70% 99.85% 99.80% 99.80% 99.80%
+ban 66.78% 90.21% 95.67% 96.37% 96.43% 96.48% 96.48%
+bel 79.61% 89.31% 93.72% 95.27% 95.77% 96.04% 96.04%
+ben 95.04% 99.65% 100.00% 100.00% 100.00% 100.00% 100.00%
+bjn 63.37% 87.76% 95.56% 96.64% 96.69% 96.69% 96.69%
+bod 99.85% 99.85% 100.00% 100.00% 100.00% 100.00% 100.00%
+bul 79.49% 97.29% 99.65% 99.65% 99.70% 99.70% 99.70%
+cat 76.97% 97.07% 99.85% 99.90% 99.90% 99.90% 99.90%
+ceb 69.18% 85.41% 89.13% 90.07% 90.13% 89.68% 89.68%
+ces 80.35% 97.56% 99.70% 99.80% 99.80% 99.80% 99.80%
+ckb 98.79% 99.95% 100.00% 100.00% 100.00% 100.00% 100.00%
+cym 92.49% 99.45% 100.00% 100.00% 100.00% 100.00% 100.00%
+dan 64.55% 88.74% 95.20% 97.03% 97.23% 97.28% 97.28%
+deu 76.67% 96.48% 99.50% 99.65% 99.65% 99.65% 99.65%
+ell 99.19% 99.90% 100.00% 100.00% 100.00% 100.00% 100.00%
+eng 71.32% 89.32% 96.83% 98.76% 98.96% 98.96% 98.96%
+epo 79.13% 97.22% 99.80% 99.75% 99.75% 99.75% 99.75%
+est 84.39% 98.85% 99.80% 99.70% 99.70% 99.70% 99.70%
+eus 85.02% 98.94% 99.95% 100.00% 100.00% 100.00% 100.00%
+ewe 89.63% 98.21% 99.24% 99.55% 99.55% 99.55% 99.55%
+fao 83.36% 97.32% 99.60% 99.70% 99.70% 99.70% 99.70%
+fas 82.05% 90.25% 93.38% 94.05% 94.22% 94.27% 94.27%
+fin 85.52% 99.40% 99.90% 100.00% 100.00% 100.00% 100.00%
+fra 80.60% 97.94% 99.75% 99.90% 99.90% 99.90% 99.90%
+gla 91.03% 99.30% 99.95% 100.00% 100.00% 100.00% 100.00%
+gle 91.04% 99.20% 99.95% 100.00% 100.00% 100.00% 100.00%
+glg 66.96% 92.77% 98.54% 99.25% 99.30% 99.25% 99.25%
+grn 87.45% 98.32% 99.75% 99.75% 99.80% 99.75% 99.75%
+guj 99.90% 100.00% 100.00% 100.00% 100.00% 100.00% 100.00%
+hau 87.08% 98.02% 99.90% 99.95% 99.95% 99.95% 99.95%
+heb 99.09% 99.85% 100.00% 100.00% 100.00% 100.00% 100.00%
+hin 67.83% 84.81% 94.29% 96.31% 96.45% 96.50% 96.50%
+hrv 79.00% 96.91% 99.45% 99.60% 99.60% 99.60% 99.60%
+hun 89.96% 99.14% 99.95% 100.00% 100.00% 100.00% 100.00%
+hye 88.85% 97.74% 99.50% 99.80% 99.80% 99.80% 99.80%
+ibo 92.52% 99.20% 99.90% 99.95% 99.95% 99.95% 99.95%
+ilo 83.73% 98.35% 99.65% 99.90% 99.90% 99.90% 99.90%
+ind 48.96% 64.99% 74.69% 78.30% 78.34% 78.42% 78.42%
+isl 87.26% 97.65% 99.65% 99.70% 99.70% 99.70% 99.70%
+ita 72.86% 96.39% 99.20% 99.55% 99.60% 99.60% 99.60%
+jav 65.42% 90.74% 97.48% 98.17% 98.32% 98.36% 98.36%
+jpn 99.75% 99.85% 100.00% 100.00% 100.00% 100.00% 100.00%
+kab 92.64% 99.70% 99.90% 99.95% 99.95% 99.95% 99.95%
+kan 99.70% 99.95% 100.00% 100.00% 100.00% 100.00% 100.00%
+kat 96.47% 99.60% 100.00% 100.00% 100.00% 100.00% 100.00%
+kaz 88.65% 98.99% 99.85% 99.90% 99.90% 99.90% 99.90%
+khm 98.68% 99.85% 99.90% 99.95% 99.95% 99.95% 99.95%
+kin 87.16% 98.94% 99.90% 99.95% 99.95% 99.95% 99.95%
+kir 84.53% 98.54% 99.75% 99.80% 99.80% 99.80% 99.80%
+kor 99.70% 99.95% 100.00% 100.00% 100.00% 100.00% 100.00%
+kur 86.71% 98.13% 99.70% 99.90% 99.90% 99.90% 99.90%
+lao 96.47% 99.19% 99.85% 99.95% 99.95% 99.95% 99.95%
+lav 89.57% 99.45% 100.00% 100.00% 100.00% 100.00% 100.00%
+lim 72.83% 94.37% 98.23% 98.48% 98.48% 98.48% 98.48%
+lit 84.98% 99.14% 99.95% 100.00% 100.00% 100.00% 100.00%
+ltz 72.99% 95.15% 99.30% 99.75% 99.80% 99.80% 99.80%
+lug 88.63% 98.33% 99.80% 99.70% 99.70% 99.70% 99.70%
+lus 78.91% 96.19% 99.19% 99.70% 99.70% 99.70% 99.70%
+mal 99.70% 100.00% 100.00% 100.00% 100.00% 100.00% 100.00%
+mar 68.58% 89.27% 96.75% 97.71% 97.76% 97.76% 97.76%
+min 71.18% 92.77% 97.66% 98.17% 98.17% 98.17% 98.17%
+mkd 81.88% 96.57% 98.96% 99.35% 99.40% 99.40% 99.40%
+mlg 93.11% 99.09% 99.90% 99.90% 99.90% 99.90% 99.90%
+mlt 89.52% 99.40% 99.95% 99.95% 99.95% 99.95% 99.95%
+mon 93.76% 99.65% 100.00% 100.00% 100.00% 100.00% 100.00%
+msa 53.19% 70.58% 79.67% 82.07% 82.07% 82.28% 82.28%
+mya 98.63% 99.60% 99.90% 100.00% 100.00% 100.00% 100.00%
+nep 69.72% 87.89% 96.84% 98.23% 98.38% 98.43% 98.43%
+nld 70.17% 91.92% 98.33% 98.69% 98.74% 98.80% 98.80%
+nno 62.16% 86.99% 95.10% 95.78% 95.89% 95.89% 95.89%
+nob 55.16% 80.25% 91.22% 93.49% 93.67% 93.73% 93.73%
+nso 59.08% 78.00% 83.14% 86.45% 86.96% 87.47% 87.47%
+nya 75.76% 93.55% 97.48% 98.26% 98.07% 98.17% 98.17%
+ori 99.65% 100.00% 100.00% 100.00% 100.00% 100.00% 100.00%
+pan 99.75% 99.75% 99.90% 99.95% 99.95% 99.95% 99.95%
+pap 75.85% 96.37% 99.34% 99.50% 99.55% 99.55% 99.55%
+pol 77.95% 88.59% 91.76% 93.31% 93.66% 93.53% 93.53%
+por 71.57% 94.71% 99.00% 99.60% 99.60% 99.60% 99.60%
+pus 90.86% 98.14% 99.65% 99.80% 99.80% 99.80% 99.80%
+ron 85.11% 98.89% 99.80% 99.90% 99.85% 99.85% 99.85%
+rus 81.44% 98.12% 99.75% 99.80% 99.80% 99.80% 99.80%
+san 66.37% 85.60% 94.81% 96.17% 96.33% 96.33% 96.33%
+sat 100.00% 100.00% 100.00% 100.00% 100.00% 100.00% 100.00%
+sin 99.70% 99.90% 99.95% 99.95% 99.95% 99.95% 99.95%
+slk 78.03% 97.69% 99.70% 99.75% 99.75% 99.75% 99.75%
+slv 77.88% 96.86% 99.55% 99.65% 99.65% 99.65% 99.65%
+smo 90.06% 99.25% 99.75% 99.90% 99.95% 99.95% 99.95%
+sna 81.50% 98.84% 99.25% 99.50% 99.55% 99.55% 99.55%
+snd 96.94% 100.00% 100.00% 100.00% 100.00% 100.00% 100.00%
+som 91.49% 99.30% 99.90% 99.90% 99.90% 99.90% 99.90%
+spa 67.16% 92.46% 98.56% 99.55% 99.55% 99.55% 99.55%
+sqi 90.69% 99.50% 99.95% 100.00% 100.00% 100.00% 100.00%
+srp 81.62% 96.99% 99.04% 99.45% 99.45% 99.45% 99.45%
+sun 62.71% 86.69% 94.68% 95.94% 96.09% 96.09% 96.09%
+swe 68.70% 93.19% 98.64% 98.69% 98.74% 98.74% 98.74%
+swh 83.89% 98.25% 99.60% 99.65% 99.65% 99.65% 99.65%
+szl 71.08% 85.39% 90.02% 92.16% 92.68% 92.51% 92.51%
+tam 99.75% 99.85% 99.95% 100.00% 100.00% 100.00% 100.00%
+tat 81.83% 97.91% 99.55% 99.80% 99.80% 99.80% 99.80%
+tel 98.16% 99.19% 99.55% 99.70% 99.75% 99.75% 99.75%
+tgk 92.72% 99.75% 100.00% 100.00% 100.00% 100.00% 100.00%
+tgl 76.57% 95.52% 99.10% 99.40% 99.45% 99.45% 99.45%
+tha 98.78% 99.80% 100.00% 100.00% 100.00% 100.00% 100.00%
+tir 97.01% 99.90% 99.95% 99.95% 99.95% 99.95% 99.95%
+tsn 72.74% 84.73% 87.50% 89.45% 89.77% 90.09% 90.09%
+tso 87.72% 98.12% 99.55% 99.65% 99.65% 99.65% 99.65%
+tuk 86.99% 98.84% 100.00% 100.00% 100.00% 100.00% 100.00%
+tum 76.64% 94.25% 97.70% 98.32% 98.17% 98.27% 98.27%
+tur 74.03% 95.70% 99.55% 99.60% 99.60% 99.60% 99.60%
+uig 98.63% 99.95% 100.00% 100.00% 100.00% 100.00% 100.00%
+ukr 88.63% 99.45% 99.90% 99.90% 99.90% 99.90% 99.90%
+urd 87.93% 97.53% 99.70% 99.95% 99.95% 99.95% 99.95%
+uzb 78.39% 97.63% 99.65% 99.85% 99.85% 99.85% 99.85%
+vie 95.37% 99.80% 100.00% 100.00% 100.00% 100.00% 100.00%
+war 55.01% 70.51% 77.89% 81.10% 81.45% 81.10% 81.10%
+xho 68.76% 83.11% 89.89% 90.87% 91.00% 91.00% 91.00%
+ydd 99.25% 99.95% 100.00% 100.00% 100.00% 100.00% 100.00%
+yor 88.40% 98.75% 99.70% 99.85% 99.85% 99.85% 99.85%
+yue 2.34% 0.99% 0.99% 0.99% 0.99% 0.99% 0.99%
+zho 79.04% 79.84% 79.92% 79.92% 79.92% 79.92% 79.92%
+zul 63.46% 78.70% 87.89% 89.29% 89.52% 89.52% 89.52%
+
+Per-language macro F1 (full):
+Language CharSoup OpenNLP Lingua Optimaize
+----------------------------------------------------------
+ace 96.31% N/A N/A N/A
+afr 99.55% 96.34% 96.40% 98.61%
+aka 99.24% N/A N/A N/A
+amh 99.95% 99.95% N/A N/A
+ara 99.95% 100.00% 100.00% 100.00%
+asm 100.00% 99.90% N/A N/A
+azb 90.93% N/A N/A N/A
+aze 99.80% 99.25% 98.99% N/A
+bak 99.80% 97.85% N/A N/A
+ban 96.48% 43.66% N/A N/A
+bel 96.04% 100.00% 100.00% 100.00%
+ben 100.00% 99.85% 100.00% 100.00%
+bjn 96.69% N/A N/A N/A
+bod 100.00% N/A N/A N/A
+bul 99.70% 98.33% 98.11% 99.14%
+cat 99.90% 98.03% 98.43% 86.74%
+ceb 89.68% 32.41% N/A N/A
+ces 99.80% 99.50% 98.79% 99.90%
+ckb 100.00% 0.00% N/A N/A
+cym 100.00% 99.95% 98.66% 99.85%
+dan 97.28% 95.45% 95.01% 98.06%
+deu 99.65% 99.30% 99.65% 99.40%
+ell 100.00% 99.95% 100.00% 100.00%
+eng 98.96% 97.22% 97.85% 98.13%
+epo 99.75% 98.75% 98.34% N/A
+est 99.70% 78.32% 99.50% 99.80%
+eus 100.00% 98.90% 99.15% 99.85%
+ewe 99.55% N/A N/A N/A
+fao 99.70% 97.72% N/A N/A
+fas 94.27% 0.59% 99.30% 99.95%
+fin 100.00% 99.39% 99.60% 99.65%
+fra 99.90% 99.25% 99.40% 99.55%
+gla 100.00% 99.55% N/A N/A
+gle 100.00% 99.50% 99.65% 99.95%
+glg 99.25% 95.11% N/A 97.22%
+grn 99.75% N/A N/A N/A
+guj 100.00% 100.00% 100.00% 100.00%
+hau 99.95% 97.59% N/A N/A
+heb 100.00% 99.85% 100.00% 99.95%
+hin 96.50% 89.24% 88.27% 99.90%
+hrv 99.60% 66.67% 68.24% 98.65%
+hun 100.00% 99.75% 99.80% 100.00%
+hye 99.80% 100.00% 100.00% N/A
+ibo 99.95% 99.55% N/A N/A
+ilo 99.90% N/A N/A N/A
+ind 78.42% 36.55% 78.31% 69.10%
+isl 99.70% 97.91% 99.70% 100.00%
+ita 99.60% 97.93% 98.30% 99.25%
+jav 98.36% 73.06% N/A N/A
+jpn 100.00% 99.65% 100.00% 68.12%
+kab 99.95% N/A N/A N/A
+kan 100.00% 100.00% N/A 100.00%
+kat 100.00% 100.00% 100.00% N/A
+kaz 99.90% 99.40% 97.61% N/A
+khm 99.95% 99.95% N/A 100.00%
+kin 99.95% 99.04% N/A N/A
+kir 99.80% 98.78% N/A N/A
+kor 100.00% 99.55% 100.00% 99.80%
+kur 99.90% 96.79% N/A N/A
+lao 99.95% 99.95% N/A N/A
+lav 100.00% 67.86% 99.30% 100.00%
+lim 98.48% 86.96% N/A N/A
+lit 100.00% 99.24% 99.50% 99.90%
+ltz 99.80% 98.99% N/A N/A
+lug 99.70% 97.64% 98.84% N/A
+lus 99.70% N/A N/A N/A
+mal 100.00% 100.00% N/A 100.00%
+mar 97.76% 97.97% 89.67% 100.00%
+min 98.17% 80.27% N/A N/A
+mkd 99.40% 97.59% 97.23% 96.98%
+mlg 99.90% 98.13% N/A N/A
+mlt 99.95% 99.34% N/A 99.90%
+mon 100.00% 99.90% 99.15% N/A
+msa 82.28% 67.94% 80.78% 40.12%
+mya 100.00% 100.00% N/A N/A
+nep 98.43% 97.56% N/A 99.90%
+nld 98.80% 90.66% 96.43% 98.53%
+nno 95.89% 88.95% 89.86% N/A
+nob 93.73% 87.81% 87.90% N/A
+nso 87.47% 95.91% N/A N/A
+nya 98.17% N/A N/A N/A
+ori 100.00% 100.00% N/A N/A
+pan 99.95% 99.95% 100.00% 100.00%
+pap 99.55% N/A N/A N/A
+pol 93.53% 99.70% 99.65% 99.95%
+por 99.60% 98.03% 98.40% 98.19%
+pus 99.80% 95.25% N/A N/A
+ron 99.85% 98.95% 97.34% 100.00%
+rus 99.80% 98.22% 98.51% 99.65%
+san 96.33% 84.87% N/A N/A
+sat 100.00% N/A N/A N/A
+sin 99.95% 100.00% N/A N/A
+slk 99.75% 99.14% 98.55% 99.70%
+slv 99.65% 97.72% 98.03% 98.60%
+smo 99.95% N/A N/A N/A
+sna 99.55% N/A 99.00% N/A
+snd 100.00% 99.95% N/A N/A
+som 99.90% 99.60% 99.80% 99.95%
+spa 99.55% 84.02% 98.05% 92.82%
+sqi 100.00% 99.70% 99.70% 100.00%
+srp 99.45% 99.14% 97.61% 97.28%
+sun 96.09% N/A N/A N/A
+swe 98.74% 98.42% 98.45% 99.50%
+swh 99.65% N/A N/A N/A
+szl 92.51% N/A N/A N/A
+tam 100.00% 100.00% 100.00% 100.00%
+tat 99.80% 97.72% N/A N/A
+tel 99.75% 99.55% 99.95% 100.00%
+tgk 100.00% 100.00% N/A N/A
+tgl 99.45% 54.09% 96.87% 99.65%
+tha 100.00% 99.55% 97.90% 100.00%
+tir 99.95% N/A N/A N/A
+tsn 90.09% 95.18% 92.46% N/A
+tso 99.65% N/A 98.90% N/A
+tuk 100.00% 99.75% N/A N/A
+tum 98.27% N/A N/A N/A
+tur 99.60% 98.53% 98.85% 99.95%
+uig 100.00% 91.88% N/A N/A
+ukr 99.90% 99.60% 97.86% 99.85%
+urd 99.95% 96.75% 99.30% 100.00%
+uzb 99.85% 98.21% N/A N/A
+vie 100.00% 99.90% 99.05% 100.00%
+war 81.10% 11.58% N/A N/A
+xho 91.00% 84.42% 90.94% N/A
+ydd 100.00% N/A N/A N/A
+yor 99.85% 98.58% 97.38% N/A
+yue 0.99% N/A N/A N/A
+zho 79.92% N/A 100.00% 87.76%
+zul 89.52% 81.80% 91.63% N/A
+
+CharSoup top confusions (languages with F1 < 95%, @20):
+TrueLabel F1 Top misclassifications (predicted → count)
+------------------------------------------------------------------------
+yue 2.3% zho→967, eng→4, ilo→2, spa→1, tay→1, tur→1, bar→1
+ind 49.0% msa→267, jav→27, bjn→25, sun→20, ban→19, min→17, tet→11
+msa 53.2% ind→239, jav→24, ban→14, sun→14, bjn→13, min→9, pam→7
+war 55.0% bcl→183, ceb→122, hil→102, som→14, bre→10, ilo→10, diq→9
+nob 55.2% dan→129, nno→125, swe→14, vls→10, diq→9, fry→9, spa→6
+nso 59.1% tsn→312, diq→20, smo→19, kur→9, bre→8, kha→8, cym→8
+azb 61.5% fas→217, mzn→115, pnb→85, pus→62, urd→41, ara→8, snd→6
+nno 62.2% nob→154, dan→37, swe→19, diq→15, bre→7, eus→7, lav→6
+sun 62.7% jav→50, msa→46, ban→29, ind→26, bjn→17, min→13, diq→9
+bjn 63.4% msa→64, min→60, sun→54, ind→41, jav→32, szy→17, ban→16
+zul 63.5% xho→368, kin→10, nya→10, hrv→8, nob→4, ibo→4, lug→4
+dan 64.6% nob→136, nno→65, swe→21, diq→10, deu→7, afr→7, ltz→7
+jav 65.4% sun→43, msa→42, ind→28, ban→27, diq→16, bjn→11, min→11
+san 66.4% hin→183, mar→106, nep→92, gom→6, ltz→3, bre→3, tur→1
+ban 66.8% jav→68, ind→58, msa→54, sun→20, bjn→15, est→10, pam→10
+glg 67.0% por→89, arg→60, spa→32, cat→26, lfn→23, ina→20, mwl→14
+spa 67.2% cat→55, lfn→49, glg→37, mwl→23, arg→23, ina→15, roh→14
+hin 67.8% nep→89, mar→66, san→41, gom→6, spa→1
+mar 68.6% hin→187, san→85, nep→72, gom→9
+swe 68.7% nno→70, nob→64, dan→39, diq→14, fao→12, isl→8, cat→8
+xho 68.8% zul→96, kin→13, nya→9, tso→7, smo→5, eng→5, hrv→4
+ceb 69.2% tgl→139, hil→88, bcl→33, ilo→6, szy→5, war→4, lus→3
+nep 69.7% hin→180, san→79, mar→65, gom→2, por→1, trv→1
+nld 70.2% vls→66, afr→64, lim→47, nds→37, gsw→20, deu→17, ltz→17
+szl 71.1% pol→276, hsb→17, ces→11, slk→10, hrv→8, diq→5, slv→5
+min 71.2% bjn→46, ind→28, jav→26, sun→24, msa→20, ban→13, tgl→13
+eng 71.3% diq→14, tsn→14, ile→13, frr→11, ina→11, fra→10, lat→9
+por 71.6% glg→81, ina→24, cat→23, arg→21, spa→19, mwl→16, lfn→9
+tsn 72.7% nso→50, smo→16, diq→9, bre→5, yor→5, ltz→5, kha→4
+lim 72.8% vls→35, afr→33, nld→28, fry→18, ron→17, nds→14, frr→12
+ita 72.9% cos→57, ina→38, roh→33, lfn→24, cat→19, ido→13, mwl→11
+ltz 73.0% gsw→41, deu→25, nds→24, nob→13, lim→10, fry→10, swe→9
+tur 74.0% diq→113, aze→22, tuk→15, slv→7, bar→5, bre→5, uzb→5
+ace 75.8% sun→116, ind→26, min→18, msa→18, ban→12, avk→11, jav→9
+nya 75.8% tum→59, swh→16, diq→16, zul→7, lug→4, gom→3, lus→3
+pap 75.8% ido→32, jav→16, diq→15, bre→15, lfn→15, tet→13, spa→11
+tgl 76.6% ceb→67, bcl→38, hil→30, lus→6, ban→6, pam→6, jav→5
+tum 76.6% nya→143, swh→31, sna→12, kin→10, xho→8, lug→8, diq→6
+deu 76.7% gsw→50, afr→46, bar→21, ltz→18, dan→13, nds→10, pfl→9
+cat 77.0% lfn→20, arg→15, spa→10, fra→9, wln→9, roh→9, diq→8
+slv 77.9% hrv→66, ces→15, slk→12, hsb→8, yor→7, diq→5, epo→4
+pol 78.0% szl→16, hsb→13, slv→11, ces→8, slk→6, yor→5, diq→4
+slk 78.0% ces→76, slv→12, hrv→8, lav→6, diq→5, hun→4, gom→4
+uzb 78.4% diq→42, aze→15, kaa→13, tuk→12, hau→10, som→7, mlt→7
+lus 78.9% cnh→51, eng→26, ltz→9, diq→8, cat→8, cor→7, lat→7
+hrv 79.0% slv→104, slk→17, ces→8, hsb→7, diq→5, cos→4, est→3
+zho 79.0% yue→17, szy→7, eng→5, spa→3, frr→3, tay→3, ilo→3
+afr 79.1% nld→35, vls→23, lim→17, nds→17, gsw→14, deu→10, frr→8
+epo 79.1% ido→52, lfn→16, diq→11, por→10, bre→9, slv→8, spa→7
+bul 79.5% mkd→87, rus→26, srp→21, mhr→7, tgk→7, ukr→7, bel→5
+bel 79.6% be-x-old→276, ukr→11, kir→3, tgk→3, rus→2, srp→1, tat→1
+ces 80.4% slk→67, hrv→10, slv→9, hsb→8, diq→5, yor→5, epo→5
+fra 80.6% wln→47, cat→38, bre→15, ina→14, ltz→9, lfn→8, ron→6
+rus 81.4% bul→64, srp→28, ukr→26, mkd→21, bel→11, rue→10, be-x-old→9
+sna 81.5% nya→29, tum→18, kin→17, xho→15, swh→13, diq→9, jav→7
+srp 81.6% mkd→108, bul→44, ukr→15, rus→14, tgk→8, che→5, bel→3
+tat 81.8% bak→45, kir→36, rus→19, bul→12, srp→11, sah→10, che→10
+mkd 81.9% bul→54, srp→46, rus→8, ukr→5, tat→3, mon→2, ava→2
+fas 82.1% mzn→67, pnb→19, pus→18, urd→8, azb→5, spa→2, tur→1
+fao 83.4% isl→71, nno→29, diq→5, est→4, bre→4, lat→4, mlt→4
+ilo 83.7% szy→15, sun→13, hil→10, diq→8, tgl→8, hau→7, bcl→7
+swh 83.9% tum→12, diq→9, kin→8, sna→8, nya→8, hau→6, jav→5
+est 84.4% vro→13, vep→11, fin→8, gsw→7, diq→6, frr→6, ban→3
+kir 84.5% kaz→22, tyv→19, rus→17, mon→10, tat→10, tgk→9, alt→8
+lit 85.0% lav→37, ido→16, sgs→11, epo→8, hrv→8, vep→7, slv→6
+eus 85.0% diq→11, hau→7, tet→7, epo→7, slv→7, min→7, avk→7
+ron 85.1% cat→16, lfn→10, lat→9, bre→8, ina→8, por→6, arg→5
+fin 85.5% est→24, olo→16, vro→9, vep→5, frr→5, smn→5, ltz→5
+aze 86.0% tur→60, diq→37, kaa→11, kur→7, ido→4, fin→3, bre→3
+aka 86.1% diq→8, eng→8, ltz→8, lat→7, cor→5, nds→5, bre→4
+bak 86.6% tat→40, kir→17, rus→14, tyv→12, kaz→11, che→10, tgk→9
+kur 86.7% diq→64, ido→5, msa→5, ita→4, frr→4, mlg→3, slk→3
+tuk 87.0% tur→20, diq→18, jav→6, avk→5, bre→4, fao→4, yor→4
+hau 87.1% diq→6, trv→5, som→4, ltz→4, swh→3, bre→3, kha→3
+kin 87.2% swh→12, sna→9, xho→9, diq→7, yor→6, nya→5, lug→5
+isl 87.3% fao→52, nno→11, bar→5, nob→3, bre→3, lat→3, hun→2
+grn 87.4% spa→13, glg→12, por→11, diq→7, tet→7, epo→7, cat→6
+tso 87.7% nya→15, diq→12, swh→11, cos→5, fra→5, sna→5, ltz→5
+urd 87.9% pnb→118, fas→17, skr→13, mzn→6, snd→4, azb→3, pus→3
+yor 88.4% diq→5, swh→3, jav→3, ilo→3, slk→3, ron→3, cos→2
+ukr 88.6% bul→29, srp→19, rus→15, mkd→12, tgk→12, bel→11, be-x-old→5
+lug 88.6% kin→17, xho→16, swh→9, diq→9, nya→9, jav→5, szy→5
+kaz 88.7% kir→27, tgk→15, bul→13, tat→12, bak→9, tyv→9, rus→9
+hye 88.9% hyw→195, spa→2, tur→1, bre→1, eng→1
+mlt 89.5% jav→7, diq→6, ltz→5, cos→4, sun→4, avk→4, cat→4
+lav 89.6% lit→5, slv→5, nob→5, diq→4, mlt→4, cos→3, slk→3
+ewe 89.6% diq→10, eng→8, aka→7, gsw→5, yor→5, ces→5, ibo→5
+hun 90.0% slk→8, ltz→7, vep→5, epo→5, eng→5, diq→4, tur→4
+smo 90.1% arg→6, ina→6, por→3, glg→3, diq→2, tsn→2, ron→2
+sqi 90.7% epo→6, hrv→5, cos→4, est→4, diq→4, mlt→4, slv→4
+pus 90.9% pnb→32, fas→11, azb→10, mzn→5, urd→4, ara→1, cor→1
+gla 91.0% gle→39, lus→6, bre→3, bar→2, arg→2, eng→2, lav→2
+gle 91.0% gla→46, lus→3, nno→3, yor→2, fry→2, trv→2, mwl→1
+som 91.5% orm→10, ltz→5, est→4, uzb→4, frr→4, avk→3, ceb→2
+cym 92.5% lat→6, gle→6, gsw→4, cor→3, vie→3, smo→3, spa→3
+ibo 92.5% swh→6, yor→4, diq→3, hsb→3, tur→2, vie→2, fao→2
+kab 92.6% diq→20, ind→4, hun→3, est→3, bre→3, frr→3, cos→2
+tgk 92.7% rus→10, che→6, srp→6, lez→5, bel→4, bul→4, mkd→3
+mlg 93.1% hrv→4, bre→3, smo→3, tet→3, lus→2, diq→2, tso→2
+mon 93.8% bxr→22, tgk→8, kir→7, rus→6, che→6, mkd→4, be-x-old→4
+asm 94.9% ben→61, sun→1
+
+CharSoup top confusions (languages with F1 < 95%, full):
+TrueLabel F1 Top misclassifications (predicted → count)
+------------------------------------------------------------------------
+yue 1.0% zho→987, eng→3, nno→1
+ind 78.4% msa→212
+zho 79.9% yue→5, szy→1, spa→1, ita→1, tay→1
+war 81.1% ceb→214, hil→76, bcl→25, kin→1, uzb→1
+msa 82.3% ind→123, bjn→1
+nso 87.5% tsn→218, som→1, epo→1, avk→1, sun→1
+zul 89.5% xho→179, cat→1, sna→1
+ceb 89.7% tgl→6, hil→4, bcl→1
+tsn 90.1% avk→1
+azb 90.9% fas→119, mzn→32, pnb→10, pus→2, ara→1, urd→1
+xho 91.0% zul→10, sna→1
+szl 92.5% pol→138, eng→1
+pol 93.5% (no misses recorded)
+nob 93.7% dan→20, nno→20, swe→1
+fas 94.3% mzn→1, eng→1
+
+Report written to: /Users/tallison/datasets/wikipedia-model-v14/flores-v14-eval.log
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESS
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time: 05:36 min
+[INFO] Finished at: 2026-03-19T17:50:53-04:00
+[INFO] ------------------------------------------------------------------------
diff --git a/docs/modules/ROOT/pages/advanced/generative-language-model.adoc b/docs/modules/ROOT/pages/advanced/generative-language-model.adoc
new file mode 100644
index 0000000000..7c2b5fa0ce
--- /dev/null
+++ b/docs/modules/ROOT/pages/advanced/generative-language-model.adoc
@@ -0,0 +1,240 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+= Generative Language Model
+
+The `GenerativeLanguageModel` is a character n-gram model that answers a
+different question from the
+xref:advanced/language-detection.adoc[discriminative language detector]:
+
+[cols="1,1"]
+|===
+| Discriminative model | Generative model
+
+| _Which_ language is this?
+| _How language-like_ is this text for language L?
+|===
+
+The discriminative model chooses the best language among candidates.
+The generative model scores how well text matches a single language's
+character statistics. Mojibake, encoding errors, and garbage text produce
+very low scores even when the discriminative model confidently picks a
+language.
+
+== Use Cases
+
+=== Charset Detection Arbitration
+
+When the `CharSoupEncodingDetector` must choose between candidate charsets
+and the discriminative model is inconclusive, the generative model breaks
+the tie. Each candidate charset's decoded text is scored; the charset
+producing the most "language-like" text wins.
+
+=== tika-eval Quality Column
+
+The `TikaEvalMetadataFilter` adds a `tika-eval:languageness` metadata field
+alongside the existing `tika-eval:oov` (out-of-vocabulary) ratio. The
+languageness value is a length-adjusted z-score: values near zero indicate
+normal text; values below -2 suggest possible encoding problems or garbled
+content.
+
+=== Training Data Filtering
+
+The `CorpusFilterReport` tool uses the generative model to scan training
+corpora and flag sentences that don't match their language label — bot-generated
+stubs, mixed-language content, or templated text.
+
+== How It Works
+
+=== Scoring
+
+For a given `(text, language)` pair, the model computes the average
+log-probability of the text's character n-grams under that language:
+
+----
+score = mean( log P(ngram | language) ) for all n-grams in text
+----
+
+Higher scores (closer to zero) mean the text is more consistent with the
+language's character statistics.
+
+=== Feature Types
+
+[cols="1,2,2"]
+|===
+| Script | Feature types | Bucket counts
+
+| CJK (Han, Hiragana, Katakana)
+| Character unigrams, character bigrams
+| 8,192 / 16,384
+
+| Non-CJK
+| Character unigrams (streaming); positionally-salted bigrams and trigrams
+ (BOW/MID/EOW/FULL_WORD); bidirectional word bigrams (short-anchor)
+| 4,096 / 8,192 / 16,384 / 8,192
+
+| All
+| Script distribution (L1-normalized, 34 fine-grained script categories)
+| 34
+|===
+
+==== Positional Salting
+
+Non-CJK bigrams and trigrams use a salt byte (BOW, MID, EOW, or FULL_WORD)
+as the first byte of the FNV hash rather than sentinel characters. This
+encodes word-boundary information without polluting codepoint space — n-grams
+always contain N real characters.
+
+==== Bidirectional Word Bigrams
+
+Two word-bigram types capture function-word context:
+
+* **Forward**: fired when the previous word is short (≤ 3 chars) — captures
+ "the X", "de X", "в X".
+* **Backward**: fired when the current word is short — captures "X the",
+ "X de", "X в".
+
+==== Script Distribution
+
+Per-language log-probabilities over 34 fine-grained script categories
+(using `GlmScriptCategory`). Contributions are L1-normalized over the text:
+one weighted contribution is emitted regardless of text length, preventing
+script signal from swamping n-gram signal on long Indic or Cyrillic text.
+
+Log-probabilities are quantized to unsigned INT8 over the range [-18, 0]
+and stored in dense byte arrays. Add-k smoothing (k=0.01) prevents
+zero-probability n-grams.
+
+=== Z-Scores
+
+Raw scores vary across languages (CJK languages have higher raw scores due
+to fewer, more information-dense characters). To enable a universal
+threshold, each language stores calibration statistics (μ, σ) computed from
+the training corpus:
+
+----
+z = (score - μ) / σ
+----
+
+A z-score of 0 means "average for this language." A z-score of -3 means
+"3 standard deviations worse than average."
+
+=== Length Adjustment
+
+Score variance scales as approximately 1/√(text length): shorter text has
+noisier scores. The `zScoreLengthAdjusted` method inflates σ for short
+text to prevent spurious low z-scores on snippets:
+
+----
+σ_adjusted = σ × max(1, √(120 / text_length))
+----
+
+where 120 is the approximate character length of a typical training sentence.
+For text at or above 120 characters, the adjustment is a no-op.
+
+== Empirical Noise Sensitivity (FLORES-200)
+
+The table below shows mean z-scores under various noise types at different
+text lengths, averaged over 204 languages on the FLORES-200 dev set
+(v4 model, `GlmNoiseSensitivityReport`):
+
+[cols="1,1,1,1,1,1,1"]
+|===
+| Length | clean | reversed | wrong-lang | mojibake-latin1 | sep-rev | sep-spc+
+
+| 20 | 0.03 | -1.29 | -9.28 | -4.71 | 1.33 | 0.78
+| 50 | -0.04 | -2.29 | -14.84 | -6.37 | 2.26 | 1.36
+| 100 | -0.10 | -3.36 | -21.07 | -6.67 | 3.26 | 1.98
+| 200 | -0.12 | -3.74 | -23.12 | -6.43 | 3.61 | 2.03
+|===
+
+Columns: `sep-rev` = clean − reversed (directionality sensitivity);
+`sep-spc+` = clean − space-inserted (space sensitivity).
+Clean z-scores near zero confirm calibration is correct.
+
+== Model Format (GLM1 v4)
+
+[source]
+----
+4 bytes magic: 0x474C4D31 ("GLM1")
+4 bytes version: 4
+4 bytes numLangs
+4 bytes cjkUnigramBuckets (8,192)
+4 bytes cjkBigramBuckets (16,384)
+4 bytes noncjkUnigramBuckets (4,096)
+4 bytes noncjkBigramBuckets (8,192)
+4 bytes noncjkTrigramBuckets (16,384)
+4 bytes scriptCategories (34)
+4 bytes wordBigramBuckets (8,192)
+
+For each language:
+ 2 bytes langCode length (uint16)
+ N bytes langCode (UTF-8)
+ 1 byte isCjk (0 or 1)
+ 4 bytes scoreMean (float32, μ)
+ 4 bytes scoreStdDev (float32, σ)
+ B bytes unigramTable
+ B bytes bigramTable
+ B bytes trigramTable (non-CJK only)
+ B bytes wordBigramTable (non-CJK only)
+ B bytes scriptTable
+----
+
+The model is stored at
+`org/apache/tika/langdetect/charsoup/langdetect-generative-v4-20260320.bin`
+on the classpath, alongside the discriminative models.
+
+== Training
+
+The model is trained by `TrainGenerativeLanguageModel` (in test scope).
+A discriminative model binary is required to determine the set of languages
+to train:
+
+[source,bash]
+----
+./mvnw -pl tika-langdetect/tika-langdetect-charsoup exec:java \
+ -Dexec.classpathScope=test -Dcheckstyle.skip=true \
+ -Dexec.mainClass=org.apache.tika.langdetect.charsoup.tools.TrainGenerativeLanguageModel \
+ "-Dexec.args=--corpus /path/to/wikipedia-dumps \
+ --output langdetect-generative-v4-YYYYMMDD.bin \
+ --disc-model langdetect-YYYYMMDD.bin"
+----
+
+Training performs two passes:
+
+1. **Count pass** — accumulates n-gram, word-bigram, and script counts per
+ language, then converts to log-probabilities with add-k smoothing (k=0.01).
+2. **Calibration pass** — re-scores training sentences to compute per-language
+ μ and σ (Welford's online algorithm), stored for z-score computation at runtime.
+
+The corpus can be in Wikipedia dump format (`corpusDir/{code}/sentences.txt`)
+or flat format (`corpusDir/{code}` with one sentence per line).
+Use `--max-per-lang N` (default 500,000) to cap sentences per language.
+
+== Evaluation Tools
+
+Several tools are provided for evaluating model quality (all in test scope
+under `org.apache.tika.langdetect.charsoup.tools`):
+
+* `GlmNoiseSensitivityReport` — measures z-scores under 12 noise types
+ (random substitution, shuffle, reversal, wrong-language, space insert/remove,
+ mojibake re-encoding) at four text lengths. Outputs a TSV for version
+ comparison.
+* `GlmAdjudicateDiagnostic` — per-language breakdown of z-score margin
+ between correct and incorrect language hypotheses.
+* `ZScoreDistributionReport` — z-score distribution at various text lengths
+ and thresholds.
diff --git a/docs/modules/ROOT/pages/advanced/integration-testing/tika-eval-regression.adoc b/docs/modules/ROOT/pages/advanced/integration-testing/tika-eval-regression.adoc
index 61a8981633..deeed7bee3 100644
--- a/docs/modules/ROOT/pages/advanced/integration-testing/tika-eval-regression.adoc
+++ b/docs/modules/ROOT/pages/advanced/integration-testing/tika-eval-regression.adoc
@@ -191,7 +191,8 @@ java -jar tika-eval/tika-eval-app/target/tika-eval-app-{tika-version}.jar \
The `Compare` subcommand keyword is optional — the CLI infers it from
the `-a` / `-b` flags. The `-r` flag both runs the Report stage and
-zips the resulting reports directory for easy archiving.
+creates a `.tgz` archive of the resulting reports directory
+(`<reportsDir>.tgz`) for easy archiving.
Options:
@@ -203,9 +204,13 @@ Options:
tika-eval will create `\{label}.mv.db` and a `\{label}-reports/` dir
alongside. Persist the db if you want to re-run Report later.
* `-r` / `--report` — automatically run the Report step after Compare,
- and zip the reports directory.
+ and tgz the reports directory to `<reportsDir>.tgz`.
* `-rd` / `--reportsDir` — explicit reports directory (overrides the
default derived from `-d`).
+* `-z` / `--gzip` — gzip the H2 db file to `<db>.mv.db.gz` after Compare
+ so it can be transferred. Requires `-d` (no-op with a warning for a
+ temp db or a non-file jdbc connection (e.g. `jdbc:h2:mem:`, tcp)). Combine with `-r` to package
+ both the reports and the db.
* `-n` / `--numWorkers` — comparison worker count.
* `-c` / `--config` — optional tika-eval JSON config.
@@ -296,7 +301,7 @@ java -jar tika-eval-app-{tika-version}.jar \
-b ~/data/extracts/cc-html-sample-B
----
+
-Produces `cc-html-29k-A-vs-B-reports/` plus a `.tar.gz` of the same
+Produces `cc-html-29k-A-vs-B-reports/` plus a `.tgz` of the same
alongside `cc-html-29k-A-vs-B.mv.db`.
For a 29 K-file HTML sample on a typical workstation (8 forked workers,
diff --git a/docs/modules/ROOT/pages/advanced/language-detection-build.adoc b/docs/modules/ROOT/pages/advanced/language-detection-build.adoc
index 1b999784bc..1fdd8b3a8a 100644
--- a/docs/modules/ROOT/pages/advanced/language-detection-build.adoc
+++ b/docs/modules/ROOT/pages/advanced/language-detection-build.adoc
@@ -363,7 +363,7 @@ new file, and remove the old binary.
Results on the https://github.com/facebookresearch/flores[FLORES-200] dev set
(204 test languages, 997 sentences each). All scores are macro-averaged F1.
-Raw eval output: link:{attachmentsdir}/advanced/flores-eval-20260320.txt[flores-eval-20260320.txt].
+Raw eval output: xref:advanced/flores-eval-20260320.txt[flores-eval-20260320.txt].
==== Coverage-adjusted accuracy (each detector on its own supported languages)
diff --git a/docs/modules/ROOT/pages/advanced/language-detection.adoc b/docs/modules/ROOT/pages/advanced/language-detection.adoc
index 120c2e320f..2ed1cd2d9a 100644
--- a/docs/modules/ROOT/pages/advanced/language-detection.adoc
+++ b/docs/modules/ROOT/pages/advanced/language-detection.adoc
@@ -153,29 +153,75 @@ back to the general model transparently.
=== Overriding Model Selection
-The automatic gates (200-char length, 200-feature density) and the strategy
-choice (always-short / always-general / automatic) are currently fixed in
-`CharSoupLanguageDetector`. Programmatic knobs are limited to
-`setMaxLength(int)` for the rolling buffer and `setPriors(Map)` for language
-priors.
-
-`CharSoupLanguageDetector` is registered as `@TikaComponent(name =
-"charsoup-language-detector")` and implements `SelfConfiguring`, so once a
-config record is added, declarative tuning will be available via the standard
-`parse-context` JSON section:
-
-[source,json]
+The selection strategy can be overridden at construction time or per-document
+via `ParseContext`:
+
+[source,java]
----
-{
- "parse-context": {
- "charsoup-language-detector": {
- /* future tuning fields will go here */
- }
- }
-}
+// Always use the short-text model (e.g. for a title-only pipeline)
+CharSoupDetectorConfig cfg = CharSoupDetectorConfig.fromMap(
+ Map.of("strategy", "SHORT_TEXT"));
+CharSoupLanguageDetector detector = new CharSoupLanguageDetector(cfg);
+
+// Always use the general model (e.g. for full-document body text)
+CharSoupDetectorConfig cfg = CharSoupDetectorConfig.fromMap(
+ Map.of("strategy", "STANDARD"));
+
+// Per-document override via ParseContext
+ParseContext context = new ParseContext();
+context.set(CharSoupDetectorConfig.class, CharSoupDetectorConfig.fromMap(
+ Map.of("strategy", "SHORT_TEXT")));
+detector.reset(context);
----
-See xref:migration-to-4x/serialization-4x.adoc#discovering-friendly-names[Discovering the friendly name for a component] for how `SelfConfiguring` components are resolved at runtime.
+The three strategies are:
+
+[cols="1,3"]
+|===
+| Strategy | Behaviour
+
+| `AUTOMATIC` (default)
+| Use length and feature-density gates to choose between models per chunk.
+
+| `SHORT_TEXT`
+| Always use the short-text model (no-op if the binary is absent).
+
+| `STANDARD`
+| Always use the general model regardless of input length.
+|===
+
+The thresholds can also be tuned via `CharSoupDetectorConfig`:
+
+[source,java]
+----
+CharSoupDetectorConfig cfg = CharSoupDetectorConfig.fromMap(Map.of(
+ "strategy", "AUTOMATIC",
+ "lengthThreshold", 300, // chars; default 200
+ "featureThreshold", 300 // n-gram emissions; default 200
+));
+----
+
+Or via Tika's JSON configuration mechanism if you are using `SelfConfiguring`
+component loading.
+
+== Generative Language Model
+
+In addition to the discriminative models above, Tika ships a
+**generative character n-gram model** (`langdetect-generative-v4-20260320.bin`) that
+answers a complementary question: _how language-like is this text?_
+
+The generative model is used for:
+
+* **Charset detection tiebreaking** — when the discriminative model cannot
+ distinguish candidate charsets, the generative model picks the one that
+ produces the most language-like decoded text.
+* **Text quality scoring** — the `tika-eval:languageness` metadata field
+ provides a z-score indicating how normal or garbled the extracted text is.
+* **Training data filtering** — flagging bot-generated or mixed-language
+ sentences in training corpora.
+
+For full details, see
+xref:advanced/generative-language-model.adoc[Generative Language Model].
== Training the Models
@@ -241,7 +287,7 @@ numeric check, keeping the language detection hot path fast.
The language detector draws on several well-established techniques.
-[bibliography%unordered]
+[bibliography]
- [[[cavnar1994]]] W. B. Cavnar and J. M. Trenkle,
"N-Gram-Based Text Categorization,"
in _Proceedings of the Third Annual Symposium on Document Analysis and
@@ -298,7 +344,8 @@ The language detector draws on several well-established techniques.
Current models (v7+) use Wikipedia dumps as the primary corpus. +
https://aclanthology.org/L12-1154/
-- [[[jacob2018]]] B. Jacob, S. Kligys, B. Chen, M. Zhu, M. Tang, A. Howard, H. Adam, and D. Kalenichenko,
+- [[[jacob2018]]] B. Jacob, S. Kligys, B. Chen, M. Zhu, M. Tang, A. Howard,
+ H. Adam, and D. Kalenichenko,
"Quantization and Training of Neural Networks for Efficient
Integer-Arithmetic-Only Inference,"
in _Proceedings of the IEEE Conference on Computer Vision and Pattern
diff --git a/docs/modules/ROOT/pages/configuration/encoding-detectors.adoc b/docs/modules/ROOT/pages/configuration/encoding-detectors.adoc
index 9ec15dc5a6..6a3c407cf5 100644
--- a/docs/modules/ROOT/pages/configuration/encoding-detectors.adoc
+++ b/docs/modules/ROOT/pages/configuration/encoding-detectors.adoc
@@ -18,44 +18,61 @@
= Configuring Encoding Detectors
Tika uses a chain of _encoding detectors_ to determine the character encoding
-of plain text and HTML content. `DefaultEncodingDetector` loads detectors via
-the Java service-provider interface (SPI) and runs them in registration order;
-the first non-null result wins.
+of plain text and HTML content. `DefaultEncodingDetector` discovers detectors
+via the Java service-provider interface (SPI, `META-INF/services`).
-The default chain is `html-encoding-detector`, `universal-encoding-detector`,
-and `icu4j-encoding-detector`.
+The chain runs in one of two modes:
+
+* *collect-all* — when a `MetaEncodingDetector` is present (the 4.x default
+ includes one), every base detector runs and contributes candidate encodings,
+ then the meta detector picks the best one by decode quality. Registration
+ order does not matter.
+* *first-match-wins* — otherwise, detectors run in registration order and the
+ first non-null result is used.
== Default Detection Chain
-With the stock dependencies on the classpath (the modules
-`tika-encoding-detector-html`, `tika-encoding-detector-universal`, and
-`tika-encoding-detector-icu4j`):
+The stock 4.x distribution registers five detectors:
[cols="1,2,3"]
|===
-|Step |Detector |Returns non-null when…
+|Detector |Module |Role
+
+|`bom-detector`
+|`tika-core`
+|Emits a candidate from a leading byte-order mark.
+
+|`metadata-charset-detector`
+|`tika-core`
+|Emits a candidate from declarative hints (`Content-Type` charset,
+`Content-Encoding`) in the `Metadata` object.
-|1
|`html-encoding-detector`
-|An HTML `<meta charset="…">` or `<meta http-equiv="Content-Type">` tag is
-found. Fast lenient regex matcher with a curated subset of WHATWG label
-aliases.
+|`tika-encoding-detector-html`
+|Emits a candidate from an HTML `<meta charset>` / `http-equiv` tag (lenient
+regex over a curated subset of WHATWG label aliases).
-|2
-|`universal-encoding-detector`
-|A state-machine structural prober (juniversalchardet fork) recognises the
-byte pattern as a known encoding (UTF-8, GB18030, Big5, EUC-JP, several
-ISO-8859 variants, etc.).
+|`mojibuster-encoding-detector`
+|`tika-encoding-detector-mojibuster`
+|Byte-bigram Naive Bayes classifier plus structural detectors for UTF-32 and
+UTF-16 and a UTF-8 grammar gate.
-|3
-|`icu4j-encoding-detector`
-|ICU4J's `CharsetDetector` returns a match. Catches additional single-byte
-encodings (Windows code pages, IBM/EBCDIC variants, etc.).
+|`junk-filter-encoding-detector`
+|`tika-ml-junkdetect`
+|`MetaEncodingDetector` that picks among the other detectors' candidates by
+script-aware decode quality. Always runs last.
|===
-The chain is permissive — first-match-wins. A declared charset
-(e.g. from a `<meta charset>` tag) wins over later structural or statistical
-detectors.
+Because `junk-filter-encoding-detector` is a `MetaEncodingDetector`, the chain
+runs collect-all: detector order is irrelevant, and a declaration (a BOM or a
+`<meta charset>` tag) does *not* automatically win. The junk filter will
+override a declaration — or even a BOM — when the byte evidence strongly
+contradicts it.
+
+NOTE: This is a behaviour change from 3.x, whose default chain was
+`html` / `universal` / `icu4j` with first-match-wins (a declaration always
+won). `universal-encoding-detector` and `icu4j-encoding-detector` are no longer
+in the default distribution; see <<restore-3x,Restore the 3.x chain>>.
== Available Detectors
@@ -66,49 +83,45 @@ referenced by their SPI name in JSON configuration.
|===
|Name |Module |Description
-|`html-encoding-detector`
-|`tika-encoding-detector-html`
-|Fast lenient regex matcher for `<meta charset>` / `http-equiv` tags, with a
-curated subset of WHATWG label aliases. Auto-registered (in default chain).
-
-|`universal-encoding-detector`
-|`tika-encoding-detector-universal`
-|State-machine structural prober (juniversalchardet fork). Auto-registered
-(in default chain).
+|`bom-detector`
+|`tika-core`
+|Reads a leading byte-order mark. In the default chain.
-|`icu4j-encoding-detector`
-|`tika-encoding-detector-icu4j`
-|Wraps ICU4J's `CharsetDetector`. Auto-registered (in default chain).
+|`metadata-charset-detector`
+|`tika-core`
+|Reads declarative hints (`Content-Type` charset, `Content-Encoding`) from the
+`Metadata` object. In the default chain.
-|`standard-html-encoding-detector`
+|`html-encoding-detector`
|`tika-encoding-detector-html`
-|Spec-strict WHATWG prescan algorithm. Not in the default chain — opt in
-explicitly if you need strict WHATWG tokenisation (e.g. ignoring charset
-declarations inside HTML comments or other contexts the lenient regex may
-match).
+|Fast lenient regex matcher for `<meta charset>` / `http-equiv` tags. In the
+default chain.
|`mojibuster-encoding-detector`
|`tika-encoding-detector-mojibuster`
-|Byte-bigram Naive Bayes classifier plus structural detectors for UTF-32
-and UTF-16 and a UTF-8 grammar gate. Not in the default chain — opt in
-explicitly.
+|Byte-bigram Naive Bayes classifier with structural UTF-32/UTF-16 detectors and
+a UTF-8 grammar gate. In the default chain.
|`junk-filter-encoding-detector`
|`tika-ml-junkdetect`
-|Text-quality arbitrator (`MetaEncodingDetector`) that picks among other
-detectors' candidates by decode quality. Not in the default chain — opt in
-explicitly.
+|Text-quality arbitrator (`MetaEncodingDetector`). In the default chain; runs
+last.
-|`bom-detector`
-|`tika-core`
-|Reads the first 4 bytes for BOM signatures. Helper component, used
-internally by `AutoDetectReader`. Not normally added to the SPI chain.
+|`standard-html-encoding-detector`
+|`tika-encoding-detector-html`
+|Spec-strict WHATWG prescan algorithm. Not in the default chain — opt in if you
+need strict WHATWG tokenisation (e.g. ignoring charset declarations inside HTML
+comments).
-|`metadata-charset-detector`
-|`tika-core`
-|Reads declarative hints (`Content-Type` charset, `Content-Encoding`) from
-the `Metadata` object. Helper component, used by parsers that consult
-`Content-Type` directly. Not normally added to the SPI chain.
+|`universal-encoding-detector`
+|`tika-encoding-detector-universal`
+|State-machine structural prober (juniversalchardet fork). Not bundled and not
+auto-discovered; add the jar and configure it explicitly to use it.
+
+|`icu4j-encoding-detector`
+|`tika-encoding-detector-icu4j`
+|Wraps ICU4J's `CharsetDetector`. Not bundled and not auto-discovered; add the
+jar and configure it explicitly to use it.
|===
== Configuration Examples
@@ -124,83 +137,102 @@ auto-registered detectors:
"encoding-detectors": [
{
"default-encoding-detector": {
- "exclude": ["icu4j-encoding-detector"]
+ "exclude": ["html-encoding-detector"]
}
}
]
}
----
+NOTE: Do not combine `default-encoding-detector` with other explicit detector
+entries in the same list. When combined, the loader wraps everything in an
+outer composite that has no `MetaEncodingDetector` at its top level, so
+collect-all arbitration is silently lost and the explicit detectors are never
+reached. Use an explicit chain (see below) when you need to configure
+individual detectors.
+
=== Specify the chain explicitly
-To replace the SPI-discovered chain with an explicit ordered list:
+To replace the SPI-discovered chain with an explicit ordered list. Include
+`junk-filter-encoding-detector` (last) to keep collect-all arbitration; omit it
+for first-match-wins:
[source,json]
----
{
"encoding-detectors": [
{"html-encoding-detector": {}},
- {"universal-encoding-detector": {}}
+ {"mojibuster-encoding-detector": {}},
+ {"junk-filter-encoding-detector": {}}
]
}
----
=== Configure the HTML detector's read limit
-`html-encoding-detector` reads up to 65 536 bytes by default when scanning
-for the `<meta charset>` tag. Raise it if your documents embed large
-`<script>` blocks before the meta tag (TIKA-2485):
+`html-encoding-detector` reads up to 65 536 bytes by default when scanning for
+the `<meta charset>` tag. Raise it if your documents embed large `<script>`
+blocks before the meta tag (TIKA-2485). (`mojibuster-encoding-detector` reads a
+larger content probe, so in the default chain this limit matters mainly for very
+large preambles.)
+
+To configure `markLimit`, specify the full chain explicitly. An explicit list
+that includes `junk-filter-encoding-detector` keeps collect-all arbitration; the
+configured `html-encoding-detector` participates as a base detector alongside
+Mojibuster, and the junk filter arbitrates as usual:
[source,json]
----
{
"encoding-detectors": [
- {
- "html-encoding-detector": {
- "markLimit": 131072
- }
- },
- {"universal-encoding-detector": {}},
- {"icu4j-encoding-detector": {}}
+ {"html-encoding-detector": {"markLimit": 131072}},
+ {"mojibuster-encoding-detector": {}},
+ {"junk-filter-encoding-detector": {}}
]
}
----
=== Use the spec-strict WHATWG HTML detector
-If your input HTML has charset declarations inside comments (or other
-contexts where the lenient regex would false-match), opt in to the
-spec-strict prescan:
+If your input HTML has charset declarations inside comments (or other contexts
+where the lenient regex would false-match), opt in to the spec-strict prescan:
[source,json]
----
{
"encoding-detectors": [
{"standard-html-encoding-detector": {}},
- {"universal-encoding-detector": {}},
- {"icu4j-encoding-detector": {}}
+ {"mojibuster-encoding-detector": {}},
+ {"junk-filter-encoding-detector": {}}
]
}
----
-=== Add the Mojibuster + JunkFilter chain (opt-in)
+[#restore-3x]
+=== Restore the 3.x detection chain (universal + icu4j)
-The byte-bigram NB classifier (`mojibuster-encoding-detector`) and the
-text-quality arbitrator (`junk-filter-encoding-detector`) are available as
-opt-in components. They require the `tika-encoding-detector-mojibuster`
-and `tika-ml-junkdetect` modules on the classpath:
+The 4.x default no longer bundles or auto-registers
+`universal-encoding-detector` and `icu4j-encoding-detector`. To get the legacy
+3.x behaviour (`html` / `universal` / `icu4j`, first-match-wins) you must do
+*both*:
+
+. *Add the jars to the classpath.* They are no longer in the `tika-app` /
+`tika-server-standard` packages, so supply `tika-encoding-detector-universal`
+and `tika-encoding-detector-icu4j` yourself (for example via `-Dtika.extras.dir`
+— see xref:configuration/index.adoc[the configuration overview]).
+. *Configure the chain explicitly.* An explicit chain with no
+`MetaEncodingDetector` runs first-match-wins:
[source,json]
----
{
"encoding-detectors": [
{"html-encoding-detector": {}},
- {"mojibuster-encoding-detector": {}},
- {"junk-filter-encoding-detector": {}}
+ {"universal-encoding-detector": {}},
+ {"icu4j-encoding-detector": {}}
]
}
----
-`junk-filter-encoding-detector` is a `MetaEncodingDetector` — it collects
-candidates from the other detectors and picks the cleanest decoding via a
-script-aware text-quality model. It must run last.
+Dropping the jars on the classpath alone is *not* enough: unlike the other
+detectors, these two are config-only and are not auto-discovered via SPI.
diff --git a/docs/modules/ROOT/pages/configuration/index.adoc b/docs/modules/ROOT/pages/configuration/index.adoc
index 37a176e0a3..0605793967 100644
--- a/docs/modules/ROOT/pages/configuration/index.adoc
+++ b/docs/modules/ROOT/pages/configuration/index.adoc
@@ -28,6 +28,34 @@ content handlers, server behavior, and the Tika Pipes pipeline.
NOTE: Tika 3.x and earlier used XML configuration (`tika-config.xml`). See the
xref:migration-to-4x/index.adoc[Migration Guide] for details on converting to JSON.
+== Adding extra jars (`tika.extras.dir`)
+
+To add extra components — additional `EncodingDetector` or `Parser`
+implementations, or their dependencies — without repackaging the application,
+drop their jars in a directory and point the `tika.extras.dir` system property
+at it:
+
+[source,bash]
+----
+java -Dtika.extras.dir=/path/to/extras -jar tika-app.jar ...
+java -Dtika.extras.dir=/path/to/extras -jar tika-server-standard.jar ...
+----
+
+Every `*.jar` in that directory is added to the classpath that Tika's
+service-loading scans, so SPI-registered components in those jars are picked up
+automatically. The jars are also forwarded onto forked Pipes/server worker
+processes, so they are available where parsing happens.
+
+This is *off by default* — nothing is loaded unless `tika.extras.dir` is set, and
+there is no implicit default directory (Tika does not scan the working directory automatically). Treat the directory as a trusted code
+location: anything in it runs with the full privileges of the Tika process, so it
+must not be writable by less-trusted principals (and, for a server, must not be
+reachable by request handling).
+
+NOTE: In the Docker images you can instead mount a directory to `/tika-extras`.
+PF4J-managed plugins are a separate mechanism — see
+xref:pipes/plugins/index.adoc[Pipes Plugins].
+
== Top-level JSON structure
A `tika-config.json` is a single JSON object whose keys are the top-level sections
diff --git a/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java b/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
index 5bea9f0da6..abbe4c280f 100644
--- a/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
+++ b/tika-app/src/main/java/org/apache/tika/cli/TikaCLI.java
@@ -69,6 +69,7 @@ import org.xml.sax.helpers.DefaultHandler;
import org.apache.tika.Tika;
import org.apache.tika.async.cli.TikaAsyncCLI;
import org.apache.tika.config.EmbeddedLimits;
+import org.apache.tika.config.TikaExtras;
import org.apache.tika.config.TimeoutLimits;
import org.apache.tika.config.loader.ComponentRegistry;
import org.apache.tika.config.loader.TikaLoader;
@@ -256,6 +257,7 @@ public class TikaCLI {
}
public static void main(String[] args) throws Exception {
+ TikaExtras.install();
TikaCLI cli = new TikaCLI();
if (cli.testForHelp(args)) {
diff --git a/tika-core/src/main/java/org/apache/tika/config/TikaExtras.java b/tika-core/src/main/java/org/apache/tika/config/TikaExtras.java
new file mode 100644
index 0000000000..1a702c9ef7
--- /dev/null
+++ b/tika-core/src/main/java/org/apache/tika/config/TikaExtras.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.config;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Opt-in mechanism for adding user-supplied "extras" jars (extra
+ * {@code EncodingDetector}s, {@code Parser}s, etc.) to Tika's SPI discovery
+ * without repackaging the application.
+ *
+ * <p><b>Off by default.</b> Nothing is loaded unless the
+ * {@value #EXTRAS_DIR_PROPERTY} system property points at a directory; then every
+ * {@code *.jar} in it is made visible to service-loading. There is no implicit or
+ * default directory — the feature is off unless the property is set. (A relative
+ * property value is resolved against the process working directory, like any path.)
+ *
+ * <p><b>Security:</b> this is a trusted code directory — anything in it runs with
+ * the full privileges of the Tika process. Treat write access to it exactly like
+ * write access to {@code lib/}; it must not be writable by less-trusted principals
+ * (for servers, not reachable by request handling). Being opt-in keeps "we are
+ * now loading extra code" an explicit, auditable choice.
+ */
+public final class TikaExtras {
+
+ /** System property naming the extras directory. Unset = feature off. */
+ public static final String EXTRAS_DIR_PROPERTY = "tika.extras.dir";
+
+ private static final Logger LOG = LoggerFactory.getLogger(TikaExtras.class);
+
+ private TikaExtras() {
+ }
+
+ /**
+ * If {@value #EXTRAS_DIR_PROPERTY} is set, installs a classloader over the
+ * {@code *.jar} files in that directory as the thread + Tika
+ * {@link ServiceLoader} context classloader, so they join SPI discovery.
+ * No-op (returns {@code null}) when the property is unset or the directory is
+ * missing/empty. Call exactly once at startup, before any Tika component is
+ * loaded: each call builds a new classloader, so repeated calls stack them and
+ * leave the earlier ones' open jar handles dangling.
+ *
+ * @return the installed classloader, or {@code null} if extras are off/empty
+ */
+ public static ClassLoader install() {
+ List<Path> jars = extraJars();
+ if (jars.isEmpty()) {
+ return null;
+ }
+ List<URL> urls = new ArrayList<>(jars.size());
+ List<Path> loaded = new ArrayList<>(jars.size());
+ for (Path jar : jars) {
+ try {
+ urls.add(jar.toUri().toURL());
+ loaded.add(jar);
+ } catch (Exception e) {
+ LOG.warn("Skipping extra jar {}: {}", jar, e.toString());
+ }
+ }
+ if (urls.isEmpty()) {
+ return null;
+ }
+ ClassLoader parent = Thread.currentThread().getContextClassLoader();
+ if (parent == null) {
+ parent = TikaExtras.class.getClassLoader();
+ }
+ URLClassLoader cl = new URLClassLoader(urls.toArray(new URL[0]), parent);
+ Thread.currentThread().setContextClassLoader(cl);
+ ServiceLoader.setContextClassLoader(cl);
+ LOG.info("{}: loaded {} extra jar(s): {}", EXTRAS_DIR_PROPERTY, loaded.size(), loaded);
+ return cl;
+ }
+
+ /**
+ * The {@code *.jar} files in the {@value #EXTRAS_DIR_PROPERTY} directory — for
+ * callers that extend a forked process's classpath rather than installing a
+ * classloader. Empty when the property is unset or the directory is
+ * missing/has no jars.
+ */
+ public static List<Path> extraJars() {
+ Path dir = extrasDir();
+ if (dir == null || !Files.isDirectory(dir)) {
+ return Collections.emptyList();
+ }
+ List<Path> jars = new ArrayList<>();
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "*.jar")) {
+ for (Path jar : stream) {
+ jars.add(jar);
+ }
+ } catch (Exception e) {
+ LOG.warn("Could not scan {}={}: {}", EXTRAS_DIR_PROPERTY, dir, e.toString());
+ }
+ // Sort by file name so jar load order (classloader URL order / forked-child
+ // classpath order, hence SPI precedence) is deterministic across platforms
+ // and filesystems rather than depending on directory iteration order.
+ jars.sort(Comparator.comparing(jar -> jar.getFileName().toString()));
+ return jars;
+ }
+
+ /**
+ * Appends the {@link #extraJars()} (as absolute paths, joined with the
+ * platform path separator) to the given classpath string — for extending a
+ * forked process's {@code -cp} with the extras jars. Returns {@code classpath}
+ * unchanged when the feature is off or the directory has no jars.
+ *
+ * @param classpath the base classpath to extend
+ * @return the classpath with any extras jars appended
+ */
+ public static String appendJarsToClasspath(String classpath) {
+ List<Path> jars = extraJars();
+ if (jars.isEmpty()) {
+ return classpath;
+ }
+ String separator = File.pathSeparator;
+ StringBuilder sb = new StringBuilder();
+ if (classpath != null && !classpath.isEmpty()) {
+ sb.append(classpath);
+ }
+ for (Path jar : jars) {
+ if (sb.length() > 0) {
+ sb.append(separator);
+ }
+ sb.append(jar.toAbsolutePath());
+ }
+ return sb.toString();
+ }
+
+ /** The configured extras directory, or {@code null} if the feature is off. */
+ public static Path extrasDir() {
+ String prop = System.getProperty(EXTRAS_DIR_PROPERTY);
+ if (prop == null || prop.isBlank()) {
+ return null;
+ }
+ try {
+ return Path.of(prop.trim());
+ } catch (java.nio.file.InvalidPathException e) {
+ LOG.warn("Ignoring invalid {}: {}", EXTRAS_DIR_PROPERTY, e.getMessage());
+ return null;
+ }
+ }
+}
diff --git a/tika-core/src/main/java/org/apache/tika/detect/DefaultEncodingDetector.java b/tika-core/src/main/java/org/apache/tika/detect/DefaultEncodingDetector.java
index 932f2f05cd..dead1deced 100644
--- a/tika-core/src/main/java/org/apache/tika/detect/DefaultEncodingDetector.java
+++ b/tika-core/src/main/java/org/apache/tika/detect/DefaultEncodingDetector.java
@@ -17,74 +17,41 @@
package org.apache.tika.detect;
import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import javax.imageio.spi.ServiceRegistry;
import org.apache.tika.config.ServiceLoader;
/**
- * A composite encoding detector based on all the {@link EncodingDetector}
+ * A composite encoding detector over all {@link EncodingDetector}
* implementations available through the
* {@link ServiceRegistry service provider mechanism}.
*
- * <p>The default chain (Tika 3.x style) runs three detectors in order, with
- * the first non-empty result winning:
- * <ol>
- * <li>{@code org.apache.tika.parser.html.HtmlEncodingDetector}</li>
- * <li>{@code org.apache.tika.parser.txt.UniversalEncodingDetector}</li>
- * <li>{@code org.apache.tika.parser.txt.Icu4jEncodingDetector}</li>
- * </ol>
- * Any other {@link EncodingDetector} discovered via SPI (e.g.,
- * user-supplied detectors) runs after the three blessed detectors,
- * preserving back-compat for callers who add their own.</p>
+ * <p>The 4.x default chain (via {@code META-INF/services}): BOM and
+ * metadata-charset detectors (tika-core), the HTML {@code <meta>} detector,
+ * MojibusterEncodingDetector, and JunkFilterEncodingDetector — a
+ * {@link MetaEncodingDetector} that arbitrates the candidates by decode quality
+ * and always runs last, so detector order is irrelevant.</p>
*
- * <p>If you need to control the order of the Detectors explicitly, construct
- * your own {@link CompositeEncodingDetector} and pass in the list in the
- * required order.</p>
+ * <p>UniversalEncodingDetector and Icu4jEncodingDetector are no longer
+ * distributed by default and are not auto-discovered; add the jar and enable
+ * them in a {@code tika-config} to use them.</p>
*
* @since Apache Tika 1.15
*/
public class DefaultEncodingDetector extends CompositeEncodingDetector {
- /** Pinned ordering for the 3.x-style default chain. Detectors not on this
- * map keep their natural SPI load order behind the three blessed ones. */
- private static final Map<String, Integer> PRIORITY = buildPriority();
-
- private static Map<String, Integer> buildPriority() {
- Map<String, Integer> p = new HashMap<>();
- p.put("org.apache.tika.parser.html.HtmlEncodingDetector", 0);
- p.put("org.apache.tika.parser.txt.UniversalEncodingDetector", 1);
- p.put("org.apache.tika.parser.txt.Icu4jEncodingDetector", 2);
- return p;
- }
-
public DefaultEncodingDetector() {
this(new ServiceLoader(DefaultEncodingDetector.class.getClassLoader()));
}
public DefaultEncodingDetector(ServiceLoader loader) {
- super(sorted(loader.loadServiceProviders(EncodingDetector.class)));
+ super(loader.loadServiceProviders(EncodingDetector.class));
}
public DefaultEncodingDetector(ServiceLoader loader,
Collection<Class<? extends EncodingDetector>>
excludeEncodingDetectors) {
- super(sorted(loader.loadServiceProviders(EncodingDetector.class)),
+ super(loader.loadServiceProviders(EncodingDetector.class),
excludeEncodingDetectors);
}
-
- private static List<EncodingDetector> sorted(List<EncodingDetector> detectors) {
- // Pin the 3.x default chain (html, universal, icu4j) to fixed
- // positions; other detectors fall to the end with stable secondary
- // ordering by class name.
- detectors.sort(Comparator
- .<EncodingDetector, Integer>comparing(
- d -> PRIORITY.getOrDefault(
- d.getClass().getName(), Integer.MAX_VALUE))
- .thenComparing(d -> d.getClass().getName()));
- return detectors;
- }
}
diff --git a/tika-core/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector b/tika-core/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
index 2970322e6e..b72636cc27 100644
--- a/tika-core/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
+++ b/tika-core/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
@@ -13,9 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Intentionally empty: tika-core itself does not register any default
-# EncodingDetector implementations. The default chain is provided by the
-# tika-encoding-detector-html, tika-encoding-detector-universal, and
-# tika-encoding-detector-icu4j modules and is sequenced by
-# DefaultEncodingDetector.
+# tika-core's part of the default 4.x chain; html, mojibuster, and the
+# junk-filter arbitrator register from their own modules.
+org.apache.tika.detect.BOMDetector
+org.apache.tika.detect.MetadataCharsetDetector
diff --git a/tika-core/src/test/java/org/apache/tika/config/TikaExtrasTest.java b/tika-core/src/test/java/org/apache/tika/config/TikaExtrasTest.java
new file mode 100644
index 0000000000..f57e5c4d64
--- /dev/null
+++ b/tika-core/src/test/java/org/apache/tika/config/TikaExtrasTest.java
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.config;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+public class TikaExtrasTest {
+
+ private static final String MARKER = "tika-extra-marker.txt";
+
+ @Test
+ public void offWhenPropertyUnset() throws Exception {
+ withProperty(null, () -> {
+ assertNull(TikaExtras.extrasDir(), "feature must be off with no property");
+ assertTrue(TikaExtras.extraJars().isEmpty());
+ assertNull(TikaExtras.install());
+ });
+ }
+
+ @Test
+ public void emptyWhenDirMissing(@TempDir Path tmp) throws Exception {
+ Path missing = tmp.resolve("does-not-exist");
+ withProperty(missing.toString(), () -> {
+ assertTrue(TikaExtras.extraJars().isEmpty());
+ assertNull(TikaExtras.install());
+ });
+ }
+
+ @Test
+ public void loadsJarsWhenPropertySet(@TempDir Path tmp) throws Exception {
+ Path jar = tmp.resolve("extra.jar");
+ try (JarOutputStream jos = new JarOutputStream(Files.newOutputStream(jar))) {
+ jos.putNextEntry(new JarEntry(MARKER));
+ jos.write("hi".getBytes(UTF_8));
+ jos.closeEntry();
+ }
+ ClassLoader prevCtx = Thread.currentThread().getContextClassLoader();
+ ClassLoader[] installed = new ClassLoader[1];
+ try {
+ withProperty(tmp.toString(), () -> {
+ assertEquals(1, TikaExtras.extraJars().size());
+ ClassLoader cl = TikaExtras.install();
+ installed[0] = cl;
+ assertNotNull(cl, "extras dir with a jar should install a classloader");
+ assertNotNull(cl.getResource(MARKER), "the extra jar must be on the classloader");
+ assertSame(cl, Thread.currentThread().getContextClassLoader());
+ });
+ } finally {
+ Thread.currentThread().setContextClassLoader(prevCtx);
+ // ServiceLoader.CONTEXT_CLASS_LOADER defaults to null and this is the
+ // only test that sets it; reset to null rather than to the thread's
+ // context loader so we don't leak global state into later tests.
+ ServiceLoader.setContextClassLoader(null);
+ // Close the URLClassLoader so it releases its handle on extra.jar before
+ // @TempDir cleanup runs; otherwise the delete fails on Windows, where an
+ // open file cannot be removed.
+ if (installed[0] instanceof URLClassLoader) {
+ ((URLClassLoader) installed[0]).close();
+ }
+ }
+ }
+
+ @Test
+ public void appendJarsToClasspathOffReturnsInput() throws Exception {
+ withProperty(null, () -> {
+ assertNull(TikaExtras.appendJarsToClasspath(null));
+ assertEquals("base", TikaExtras.appendJarsToClasspath("base"));
+ });
+ }
+
+ @Test
+ public void appendJarsToClasspathNoLeadingSeparator(@TempDir Path tmp) throws Exception {
+ Path jar = tmp.resolve("extra.jar");
+ try (JarOutputStream jos = new JarOutputStream(Files.newOutputStream(jar))) {
+ jos.putNextEntry(new JarEntry(MARKER));
+ jos.closeEntry();
+ }
+ String sep = System.getProperty("path.separator");
+ String abs = jar.toAbsolutePath().toString();
+ withProperty(tmp.toString(), () -> {
+ // null/empty base must not produce a leading separator
+ assertEquals(abs, TikaExtras.appendJarsToClasspath(null));
+ assertEquals(abs, TikaExtras.appendJarsToClasspath(""));
+ // non-empty base gets the separator between it and the jar
+ assertEquals("base" + sep + abs, TikaExtras.appendJarsToClasspath("base"));
+ });
+ }
+
+ private interface Body {
+ void run() throws Exception;
+ }
+
+ private static void withProperty(String value, Body body) throws Exception {
+ String prev = System.getProperty(TikaExtras.EXTRAS_DIR_PROPERTY);
+ try {
+ if (value == null) {
+ System.clearProperty(TikaExtras.EXTRAS_DIR_PROPERTY);
+ } else {
+ System.setProperty(TikaExtras.EXTRAS_DIR_PROPERTY, value);
+ }
+ body.run();
+ } finally {
+ if (prev == null) {
+ System.clearProperty(TikaExtras.EXTRAS_DIR_PROPERTY);
+ } else {
+ System.setProperty(TikaExtras.EXTRAS_DIR_PROPERTY, prev);
+ }
+ }
+ }
+}
diff --git a/tika-encoding-detectors/tika-encoding-detector-charsoup/src/main/java/org/apache/tika/langdetect/charsoup/CharSoupEncodingDetector.java b/tika-encoding-detectors/tika-encoding-detector-charsoup/src/main/java/org/apache/tika/langdetect/charsoup/CharSoupEncodingDetector.java
new file mode 100644
index 0000000000..f68e6720d2
--- /dev/null
+++ b/tika-encoding-detectors/tika-encoding-detector-charsoup/src/main/java/org/apache/tika/langdetect/charsoup/CharSoupEncodingDetector.java
@@ -0,0 +1,479 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.langdetect.charsoup;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CodingErrorAction;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.tika.config.TikaComponent;
+import org.apache.tika.detect.EncodingDetectorContext;
+import org.apache.tika.detect.EncodingResult;
+import org.apache.tika.detect.MetaEncodingDetector;
+import org.apache.tika.io.TikaInputStream;
+import org.apache.tika.language.detect.LanguageResult;
+import org.apache.tika.metadata.Metadata;
+import org.apache.tika.parser.ParseContext;
+
+/**
+ * A {@link MetaEncodingDetector} that uses the CharSoup language detector
+ * to arbitrate when base encoding detectors disagree.
+ *
+ * <p>When base detectors all agree, the unanimous charset is returned
+ * without any language detection. When they disagree, raw bytes are
+ * read from the stream, decoded with each candidate charset, and each
+ * decoded text is scored by {@link CharSoupLanguageDetector}. The
+ * charset that produces the highest-confidence language detection wins.</p>
+ *
+ * <p>To enable, add this detector to your encoding detector chain in
+ * tika-config:</p>
+ * <pre>{@code
+ * "encoding-detectors": [
+ * { "default-encoding-detector": {} },
+ * { "charsoup-encoding-detector": {} }
+ * ]
+ * }</pre>
+ *
+ * @since Apache Tika 3.2
+ */
+@TikaComponent(name = "charsoup-encoding-detector")
+public class CharSoupEncodingDetector implements MetaEncodingDetector {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Logger LOG = LoggerFactory.getLogger(CharSoupEncodingDetector.class);
+
+ private static final int DEFAULT_READ_LIMIT = 16384;
+
+ private static final String GLM_RESOURCE = GenerativeLanguageModel.DEFAULT_MODEL_RESOURCE;
+
+ /**
+ * Minimum z-score for the generative-model tiebreaker to consider a
+ * candidate "language-like enough" to win. Candidates below this are
+ * treated as mojibake.
+ */
+ private static final float MIN_GENERATIVE_ZSCORE = -4.0f;
+
+ private static final GenerativeLanguageModel GLM;
+
+ static {
+ try {
+ GLM = GenerativeLanguageModel.loadFromClasspath(GLM_RESOURCE);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to load generative language model: "
+ + GLM_RESOURCE, e);
+ }
+ }
+
+ /**
+ * Symmetric confusable peer groups: within each group, encoding variants
+ * (e.g. ISO-8859-6 vs windows-1256) produce different decoded text for the
+ * same byte sequence (unlike ISO-8859-1 vs windows-1252 which are functional
+ * supersets). When the language-quality winner and a DECLARATIVE result
+ * are in the same peer group, the language model cannot reliably
+ * distinguish them — it merely reflects which variant happens to produce
+ * Arabic (or Cyrillic, …) n-grams its training data favoured.
+ * In that case we prefer the explicit declaration.
+ */
+ private static final Map<String, Set<String>> PEER_GROUPS;
+
+ static {
+ Map<String, Set<String>> m = new HashMap<>();
+ for (String[] group : new String[][] {
+ {"ISO-8859-1", "ISO-8859-15", "windows-1252"},
+ {"ISO-8859-2", "windows-1250"},
+ {"ISO-8859-5", "windows-1251"},
+ {"KOI8-R", "KOI8-U"},
+ {"ISO-8859-6", "windows-1256"},
+ {"ISO-8859-7", "windows-1253"},
+ {"ISO-8859-8", "windows-1255"},
+ {"ISO-8859-9", "windows-1254"},
+ {"ISO-8859-13", "windows-1257"},
+ {"ISO-8859-4", "windows-1257"},
+ }) {
+ Set<String> s = new HashSet<>(Arrays.asList(group));
+ for (String name : group) {
+ m.put(name, s);
+ }
+ }
+ PEER_GROUPS = Collections.unmodifiableMap(m);
+ }
+
+ private static boolean arePeers(Charset a, Charset b) {
+ Set<String> peers = PEER_GROUPS.get(a.name());
+ return peers != null && peers.contains(b.name());
+ }
+
+ private static boolean hasPositiveLangSignal(String text) {
+ if (text == null || text.isEmpty()) {
+ return false;
+ }
+ CharSoupLanguageDetector detector = new CharSoupLanguageDetector();
+ char[] chars = text.toCharArray();
+ detector.addText(chars, 0, chars.length);
+ List<LanguageResult> results = detector.detectAll();
+ return !results.isEmpty() && results.get(0).getRawScore() > 0f;
+ }
+
+ private int readLimit = DEFAULT_READ_LIMIT;
+
+ @Override
+ public List<EncodingResult> detect(TikaInputStream tis, Metadata metadata,
+ ParseContext parseContext) throws IOException {
+ EncodingDetectorContext context =
+ parseContext.get(EncodingDetectorContext.class);
+ if (context == null || context.getResults().isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ Set<Charset> uniqueCharsets = context.getUniqueCharsets();
+
+ Charset winner;
+ if (uniqueCharsets.size() <= 1) {
+ context.setArbitrationInfo("unanimous");
+ winner = context.getResults().get(0).getCharset();
+ } else {
+ winner = arbitrate(tis, context, uniqueCharsets);
+ }
+
+ if (winner == null) {
+ return Collections.emptyList();
+ }
+ float confidence = context.getTopConfidenceFor(winner);
+ return List.of(new EncodingResult(winner, confidence));
+ }
+
+ private Charset arbitrate(TikaInputStream tis,
+ EncodingDetectorContext context,
+ Set<Charset> uniqueCharsets) throws IOException {
+ EncodingDetectorContext.Result firstResult = context.getResults().get(0);
+
+ if (tis == null) {
+ context.setArbitrationInfo("no-stream");
+ return firstResult.getCharset();
+ }
+
+ byte[] bytes = readBytes(tis);
+ if (bytes == null || bytes.length == 0) {
+ context.setArbitrationInfo("empty-stream");
+ return firstResult.getCharset();
+ }
+ bytes = stripBomBytes(bytes);
+
+ Map<Charset, String> candidates = new LinkedHashMap<>();
+ for (Charset candidate : uniqueCharsets) {
+ candidates.put(candidate, stripTags(decode(bytes, candidate)));
+ }
+
+ CharSoupLanguageDetector langDetector = new CharSoupLanguageDetector();
+ Charset bestCharset = langDetector.compareLanguageSignal(candidates);
+ if (bestCharset == null) {
+ // Discriminative model inconclusive. Try generative model as tiebreaker.
+ Charset generativeWinner = generativeTiebreak(candidates);
+ if (generativeWinner != null) {
+ context.setArbitrationInfo("scored-inconclusive-generative-tiebreak");
+ return generativeWinner;
+ }
+
+ // Generative model also inconclusive. When a DECLARATIVE result
+ // (HTML meta charset, BOM, HTTP Content-Type) exists and decodes
+ // the bytes at least as cleanly as the statistical fallback,
+ // trust the declaration. This covers:
+ // • Pure-ASCII probe (both decodings identical) — prefer declared.
+ // • Probe with high bytes valid in BOTH charsets (e.g. Cyrillic
+ // in a page starting with ASCII JavaScript).
+ Charset fallback = firstResult.getCharset();
+ String fallbackDecoded = candidates.get(fallback);
+ float fallbackJunk = fallbackDecoded != null
+ ? CharSoupLanguageDetector.junkRatio(fallbackDecoded) : 1f;
+
+ Charset cleanerDeclared = null;
+ for (EncodingDetectorContext.Result r : context.getResults()) {
+ if (r.getResultType() == EncodingResult.ResultType.DECLARATIVE) {
+ String declaredDecoded = candidates.get(r.getCharset());
+ float declaredJunk = declaredDecoded != null
+ ? CharSoupLanguageDetector.junkRatio(declaredDecoded) : 1f;
+ if (declaredJunk <= fallbackJunk) {
+ cleanerDeclared = r.getCharset();
+ break;
+ }
+ }
+ }
+
+ if (cleanerDeclared != null) {
+ context.setArbitrationInfo("scored-inconclusive-use-cleaner-declared");
+ return cleanerDeclared;
+ }
+ bestCharset = fallback;
+ }
+
+ // If a DECLARATIVE result (e.g. HTML meta charset) decodes the bytes to the same
+ // string as the language-quality winner, prefer the declaration. This validates the
+ // declared encoding against the actual bytes: if they are functionally equivalent,
+ // trust the author's stated encoding. If they produce different text (a real conflict
+ // — e.g. a lying BOM or a wrong meta tag), the bytes win and the language scorer's
+ // choice stands.
+ //
+ // Additionally, when the winner and a DECLARATIVE charset are in the same confusable
+ // peer group (e.g. ISO-8859-6 vs windows-1256) and the declared charset decodes
+ // cleanly (low junk ratio), the language model cannot reliably distinguish them —
+ // they both produce valid same-script text. Prefer the explicit declaration.
+ String winnerDecoded = candidates.get(bestCharset);
+ float winnerJunk = winnerDecoded != null ? CharSoupLanguageDetector.junkRatio(winnerDecoded) : 1f;
+ if (winnerDecoded != null) {
+ for (EncodingDetectorContext.Result r : context.getResults()) {
+ if (r.getResultType() == EncodingResult.ResultType.DECLARATIVE
+ && !r.getCharset().equals(bestCharset)) {
+ Charset declared = r.getCharset();
+ String declaredDecoded = candidates.get(declared);
+ if (declaredDecoded == null) {
+ continue;
+ }
+ if (declaredDecoded.equals(winnerDecoded)) {
+ context.setArbitrationInfo("scored-prefer-declared");
+ return declared;
+ }
+ float declaredJunk = CharSoupLanguageDetector.junkRatio(declaredDecoded);
+ // Same-script peer group: language model cannot distinguish variants
+ // (e.g. ISO-8859-6 vs windows-1256 both produce valid Arabic text).
+ // Prefer the declaration when it decodes at least as cleanly as the winner.
+ if (arePeers(bestCharset, declared) && declaredJunk <= winnerJunk) {
+ context.setArbitrationInfo("scored-prefer-declared-peer");
+ return declared;
+ }
+ // DECLARATIVE result decodes cleanly and has a positive language signal:
+ // trust the declaration over the language-model winner. The language scorer
+ // can be fooled on short probes (e.g. 4 CJK code points from a wrong-endian
+ // UTF-16 decode score higher than "test" in English), but a DECLARATIVE
+ // charset that itself produces meaningful text is almost certainly correct.
+ // A lying BOM or wrong meta-tag would produce high junk (replacement chars),
+ // so the declaredJunk guard prevents false positives.
+ boolean hasDeclaredLangSignal = hasPositiveLangSignal(declaredDecoded);
+ if (declaredJunk <= winnerJunk && hasDeclaredLangSignal) {
+ context.setArbitrationInfo("scored-prefer-declared-positive-lang");
+ return declared;
+ }
+ }
+ }
+ }
+
+ context.setArbitrationInfo("scored");
+ return bestCharset;
+ }
+
+ /**
+ * Generative-model tiebreaker: for each candidate charset's decoded text,
+ * detect the most likely language then compute its z-score. The charset
+ * producing the highest z-score (closest to "real language") wins, provided
+ * it exceeds {@link #MIN_GENERATIVE_ZSCORE}.
+ *
+ * @return the winning charset, or {@code null} if no candidate passes the
+ * threshold or all candidates decode to identical text
+ */
+ private static <K> K generativeTiebreak(Map<K, String> candidates) {
+ if (candidates.isEmpty()) {
+ return null;
+ }
+
+ // If all candidates decode to identical text, the generative model
+ // cannot distinguish them — return null so the DECLARATIVE-preference
+ // logic downstream can handle it (e.g. pure-ASCII where windows-1252
+ // and UTF-8 produce the same bytes).
+ if (allDecodingsIdentical(candidates)) {
+ LOG.debug("generativeTiebreak: all decodings identical, deferring");
+ return null;
+ }
+
+ float bestZ = Float.NEGATIVE_INFINITY;
+ K bestKey = null;
+
+ for (Map.Entry<K, String> entry : candidates.entrySet()) {
+ String text = entry.getValue();
+ if (text == null || text.isEmpty()) {
+ continue;
+ }
+ if (CharSoupLanguageDetector.junkRatio(text) > 0.10f) {
+ continue;
+ }
+ Map.Entry<String, Float> match = GLM.bestMatch(text);
+ if (match == null) {
+ continue;
+ }
+ float z = GLM.zScoreLengthAdjusted(text, match.getKey());
+ LOG.debug("generativeTiebreak: {} -> lang={} z={}",
+ entry.getKey(), match.getKey(), z);
+ if (!Float.isNaN(z) && z > bestZ) {
+ bestZ = z;
+ bestKey = entry.getKey();
+ }
+ }
+
+ if (bestZ < MIN_GENERATIVE_ZSCORE) {
+ LOG.debug("generativeTiebreak: inconclusive (bestZ={} < {})",
+ bestZ, MIN_GENERATIVE_ZSCORE);
+ return null;
+ }
+ return bestKey;
+ }
+
+ private static <K> boolean allDecodingsIdentical(Map<K, String> candidates) {
+ String first = null;
+ for (String text : candidates.values()) {
+ if (first == null) {
+ first = text;
+ } else if (!first.equals(text)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * Strip any leading byte-order mark from {@code bytes}, returning the
+ * suffix after the BOM, or the original array if no BOM is found.
+ * UTF-32 signatures are checked before UTF-16 because the UTF-32 LE BOM
+ * ({@code FF FE 00 00}) starts with the UTF-16 LE BOM ({@code FF FE}).
+ */
+ private static byte[] stripBomBytes(byte[] bytes) {
+ return bomCharsetName(bytes) != null ? Arrays.copyOfRange(bytes, bomLength(bytes), bytes.length) : bytes;
+ }
+
+ /**
+ * Return the Java charset name for a leading BOM, or {@code null} if none.
+ */
+ static String bomCharsetName(byte[] bytes) {
+ if (bytes.length >= 4
+ && (bytes[0] & 0xFF) == 0x00 && (bytes[1] & 0xFF) == 0x00
+ && (bytes[2] & 0xFF) == 0xFE && (bytes[3] & 0xFF) == 0xFF) {
+ return "UTF-32BE";
+ }
+ if (bytes.length >= 4
+ && (bytes[0] & 0xFF) == 0xFF && (bytes[1] & 0xFF) == 0xFE
+ && (bytes[2] & 0xFF) == 0x00 && (bytes[3] & 0xFF) == 0x00) {
+ return "UTF-32LE";
+ }
+ if (bytes.length >= 3
+ && (bytes[0] & 0xFF) == 0xEF && (bytes[1] & 0xFF) == 0xBB
+ && (bytes[2] & 0xFF) == 0xBF) {
+ return "UTF-8";
+ }
+ if (bytes.length >= 2
+ && (bytes[0] & 0xFF) == 0xFE && (bytes[1] & 0xFF) == 0xFF) {
+ return "UTF-16BE";
+ }
+ if (bytes.length >= 2
+ && (bytes[0] & 0xFF) == 0xFF && (bytes[1] & 0xFF) == 0xFE) {
+ return "UTF-16LE";
+ }
+ return null;
+ }
+
+ private static int bomLength(byte[] bytes) {
+ if (bytes.length >= 4
+ && ((bytes[0] & 0xFF) == 0x00 || (bytes[0] & 0xFF) == 0xFF)
+ && (bytes[2] & 0xFF) == 0x00) {
+ return 4; // UTF-32
+ }
+ if (bytes.length >= 3 && (bytes[0] & 0xFF) == 0xEF) {
+ return 3; // UTF-8
+ }
+ return 2; // UTF-16
+ }
+
+ private byte[] readBytes(TikaInputStream tis) throws IOException {
+ try {
+ tis.mark(readLimit);
+ byte[] buf = new byte[readLimit];
+ int totalRead = 0;
+ int bytesRead;
+ while (totalRead < readLimit &&
+ (bytesRead = tis.read(buf, totalRead,
+ readLimit - totalRead)) != -1) {
+ totalRead += bytesRead;
+ }
+ if (totalRead == 0) {
+ return null;
+ }
+ if (totalRead < readLimit) {
+ byte[] trimmed = new byte[totalRead];
+ System.arraycopy(buf, 0, trimmed, 0, totalRead);
+ return trimmed;
+ }
+ return buf;
+ } finally {
+ tis.reset();
+ }
+ }
+
+ /**
+ * Decode bytes using the given charset, replacing malformed/unmappable
+ * characters rather than throwing.
+ */
+ static String decode(byte[] bytes, Charset charset) {
+ CharsetDecoder decoder = charset.newDecoder()
+ .onMalformedInput(CodingErrorAction.REPLACE)
+ .onUnmappableCharacter(CodingErrorAction.REPLACE);
+ CharBuffer cb = CharBuffer.allocate(bytes.length * 2);
+ decoder.decode(ByteBuffer.wrap(bytes), cb, true);
+ decoder.flush(cb);
+ cb.flip();
+ return cb.toString();
+ }
+
+ /**
+ * Simple tag stripping: removes <...> sequences so that
+ * HTML/XML tag names and attributes don't pollute language scoring.
+ */
+ static String stripTags(String text) {
+ StringBuilder sb = new StringBuilder(text.length());
+ boolean inTag = false;
+ for (int i = 0; i < text.length(); i++) {
+ char c = text.charAt(i);
+ if (c == '<') {
+ inTag = true;
+ } else if (c == '>') {
+ inTag = false;
+ } else if (!inTag) {
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
+
+ public int getReadLimit() {
+ return readLimit;
+ }
+
+ public void setReadLimit(int readLimit) {
+ this.readLimit = readLimit;
+ }
+}
diff --git a/tika-encoding-detectors/tika-encoding-detector-icu4j/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector b/tika-encoding-detectors/tika-encoding-detector-icu4j/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
index 6283ea152d..d00f541c45 100644
--- a/tika-encoding-detectors/tika-encoding-detector-icu4j/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
+++ b/tika-encoding-detectors/tika-encoding-detector-icu4j/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
@@ -12,4 +12,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-org.apache.tika.parser.txt.Icu4jEncodingDetector
+
+# Not in the default 4.x chain; enable in tika-config to use.
diff --git a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/ByteNgramFeatureExtractor.java b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/ByteNgramFeatureExtractor.java
new file mode 100644
index 0000000000..b4839f7a68
--- /dev/null
+++ b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/ByteNgramFeatureExtractor.java
@@ -0,0 +1,334 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.ml.chardetect;
+
+import org.apache.tika.ml.FeatureExtractor;
+
+/**
+ * Feature extractor for raw bytes for charset detection, using FNV-1a hashing
+ * into a fixed-width bucket array.
+ *
+ * <h3>Feature set (fixed — UB-AS)</h3>
+ * <p>This production extractor uses the feature set selected by grid search over
+ * the MadLAD-derived {@code charset-detect3} corpus (34 charsets, 3 runs × 6
+ * configs × 3 bucket sizes, devtest accuracy averaged to reduce SGD noise):
+ * <strong>unigrams + bigrams + anchored bigrams + stride-2 bigrams</strong>
+ * (UB-AS), 16384 buckets.</p>
+ *
+ * <p>Key findings from the ablation/grid search:</p>
+ * <ul>
+ * <li>Trigrams (T) added no accuracy over UB-AS and were dropped.</li>
+ * <li>Stride-2 bigrams (S) are the single most important new feature —
+ * they lifted overall accuracy from ~73% (old UBT- model without UTF-16/32
+ * training) to ~95% by giving the model direct code-unit visibility into
+ * UTF-16/32 structure.</li>
+ * <li>Anchored bigrams (A) add ~0.04% at 16384 buckets — tiny but consistent.</li>
+ * <li>Accuracy plateau between 8192 and 32768 buckets is within SGD noise;
+ * 16384 chosen as the best size/accuracy trade-off.</li>
+ * </ul>
+ *
+ * <p>The feature flags are intentionally not configurable here — the shipped model
+ * was trained with exactly this configuration, and using any other combination
+ * at inference time would produce silently wrong predictions.
+ * For training new models with different feature combinations, use
+ * {@code ConfigurableByteNgramFeatureExtractor} in the training-tools module.</p>
+ *
+ * <h3>Features emitted</h3>
+ * <ul>
+ * <li><strong>Unigrams</strong>: every byte {@code b} where
+ * {@code (b & 0xFF) >= 0x80}. These directly encode the high-byte
+ * frequency distribution that distinguishes single-byte encodings
+ * (KOI8-R vs Windows-1251 vs ISO-8859-2, etc.).</li>
+ * <li><strong>Bigrams</strong>: consecutive pairs {@code (b[i], b[i+1])}
+ * where {@code (b[i] & 0xFF) >= 0x80}. Anchoring on a high first byte
+ * captures multi-byte character structure (Big5, Shift-JIS, GBK,
+ * EUC-* lead/trail pairs) while automatically excluding ASCII-ASCII
+ * pairs produced by HTML tag markup.</li>
+ * <li><strong>Anchored bigrams</strong>: pairs {@code (b[i+1], b[i+2])} emitted
+ * when {@code (b[i] & 0xFF) >= 0x80} and {@code (b[i+1] & 0xFF) < 0x80}
+ * (i.e. a high lead byte is followed by a low trail byte). Captures
+ * cross-character boundary structure in Shift-JIS and Big5 where trail
+ * bytes fall below 0x80 (0x40–0x7E). A distinct salt ({@code FNV_ANCHOR_SALT})
+ * prevents hash collisions with stride-1 bigrams.</li>
+ * <li><strong>Stride-2 bigrams</strong>: pairs {@code (b[i], b[i+1])} sampled
+ * at even positions {@code i = 0, 2, 4, ...}, covering all bytes (not just
+ * high bytes). These pairs directly reflect code-unit structure: UTF-16LE
+ * BMP text produces many {@code (XX, 0x00)} pairs; UTF-16BE produces
+ * {@code (0x00, XX)}. A distinct FNV salt ({@code FNV_STRIDE2_SALT})
+ * prevents hash collisions with stride-1 features. The BOM must be
+ * stripped upstream before bytes reach this extractor so that offset 0
+ * always aligns with a real code unit, matching the BOM-free training
+ * data.</li>
+ * </ul>
+ *
+ * <h3>Why the high-byte filter matters for stride-1 features</h3>
+ * <p>Training data is clean text (no HTML tags). Inference data is often raw
+ * HTML (many ASCII tag bytes). Without the filter, the model would see a
+ * different byte distribution at inference time than at training time. By
+ * ignoring bytes below 0x80 entirely for stride-1 features, HTML tags are
+ * invisible to both the training and inference feature computation — no
+ * stripping needed. Stride-2 features intentionally include all bytes because
+ * the low bytes are the signal (e.g. the 0x00 high byte in UTF-16 BMP text).</p>
+ */
+public class ByteNgramFeatureExtractor implements FeatureExtractor<byte[]> {
+
+ private static final int FNV_PRIME = 0x01000193;
+ private static final int FNV_OFFSET = 0x811c9dc5;
+ /** Distinct salt for anchored bigrams (high→low boundary) — prevents collision with stride-1. */
+ private static final int FNV_ANCHOR_SALT = 0x27d4eb2f;
+ /** Distinct salt for stride-2 bigrams — prevents collision with stride-1 hashes. */
+ private static final int FNV_STRIDE2_SALT = 0x9e3779b9;
+
+ /** Quadrant index: both bytes < 0x80. */
+ public static final int Q_LL = 0;
+ /** Quadrant index: first byte < 0x80, second ≥ 0x80. */
+ public static final int Q_LH = 1;
+ /** Quadrant index: first byte ≥ 0x80, second < 0x80. */
+ public static final int Q_HL = 2;
+ /** Quadrant index: both bytes ≥ 0x80 (also receives unigrams). */
+ public static final int Q_HH = 3;
+ /** Number of quadrants. */
+ public static final int NUM_QUADRANTS = 4;
+
+ private final int numBuckets;
+
+ /**
+ * Create an extractor with the production feature set (UBT-: unigrams +
+ * bigrams + trigrams, no anchored bigrams) and the given bucket count.
+ * The bucket count must match the model the extractor will be paired with —
+ * in practice this is read from the model binary via
+ * {@link org.apache.tika.ml.LinearModel#getNumBuckets()}.
+ *
+ * @param numBuckets number of hash buckets (feature-vector dimension)
+ */
+ public ByteNgramFeatureExtractor(int numBuckets) {
+ if (numBuckets <= 0) {
+ throw new IllegalArgumentException("numBuckets must be positive: " + numBuckets);
+ }
+ this.numBuckets = numBuckets;
+ }
+
+ @Override
+ public int[] extract(byte[] input) {
+ int[] counts = new int[numBuckets];
+ if (input == null || input.length == 0) {
+ return counts;
+ }
+ extractInto(input, 0, input.length, counts);
+ return counts;
+ }
+
+ /**
+ * Extract from a sub-range of a byte array.
+ */
+ public int[] extract(byte[] input, int offset, int length) {
+ int[] counts = new int[numBuckets];
+ if (input == null || length == 0) {
+ return counts;
+ }
+ extractInto(input, offset, offset + length, counts);
+ return counts;
+ }
+
+ /**
+ * Sparse extraction into caller-owned, reusable buffers.
+ *
+ * <p>This is O(probe length), not O(numBuckets), making it safe for large
+ * bucket counts in tight training loops.
+ *
+ * <p>After the call, {@code dense[touched[0..n-1]]} hold the non-zero
+ * counts. The caller <em>must</em> clear those entries after use:
+ * <pre>{@code
+ * for (int i = 0; i < n; i++) dense[touched[i]] = 0;
+ * }</pre>
+ *
+ * @param input raw bytes to extract features from
+ * @param dense caller-allocated scratch buffer of length {@code numBuckets}
+ * (must be all-zeros on entry; caller clears it after use)
+ * @param touched caller-allocated buffer receiving indices of non-zero buckets
+ * @return number of active entries written into {@code touched}
+ */
+ public int extractSparseInto(byte[] input, int[] dense, int[] touched) {
+ if (input == null || input.length == 0) {
+ return 0;
+ }
+ int n = 0;
+
+ // Stride-1: high-byte-anchored unigrams and bigrams.
+ for (int i = 0; i < input.length; i++) {
+ int bi = input[i] & 0xFF;
+ if (bi < 0x80) {
+ continue;
+ }
+
+ // Unigram
+ int h = (FNV_OFFSET ^ bi) * FNV_PRIME;
+ int bkt = (h & 0x7fffffff) % numBuckets;
+ if (dense[bkt] == 0) {
+ touched[n++] = bkt;
+ }
+ dense[bkt]++;
+
+ if (i + 1 < input.length) {
+ int bi1 = input[i + 1] & 0xFF;
+
+ // Bigram
+ h = (FNV_OFFSET ^ bi) * FNV_PRIME;
+ h = (h ^ bi1) * FNV_PRIME;
+ bkt = (h & 0x7fffffff) % numBuckets;
+ if (dense[bkt] == 0) {
+ touched[n++] = bkt;
+ }
+ dense[bkt]++;
+ }
+ }
+
+ // Stride-2: code-unit pairs at positions 0, 2, 4, ...
+ // Covers all bytes (not just high bytes) so UTF-16 null bytes are visible.
+ for (int i = 0; i + 1 < input.length; i += 2) {
+ int b0 = input[i] & 0xFF;
+ int b1 = input[i + 1] & 0xFF;
+ int h = (FNV_STRIDE2_SALT ^ b0) * FNV_PRIME;
+ h = (h ^ b1) * FNV_PRIME;
+ int bkt = (h & 0x7fffffff) % numBuckets;
+ if (dense[bkt] == 0) {
+ touched[n++] = bkt;
+ }
+ dense[bkt]++;
+ }
+
+ return n;
+ }
+
+ /**
+ * Extract features into per-quadrant count arrays. Each bigram is classified
+ * by the high/low status of its two bytes. Unigrams (single high bytes) are
+ * assigned to {@link #Q_HH} since they measure encoding-specific high-byte
+ * frequency — the same signal type as HH bigrams.
+ *
+ * @param input raw bytes
+ * @return {@code int[NUM_QUADRANTS][numBuckets]} per-quadrant feature counts
+ */
+ public int[][] extractByQuadrant(byte[] input) {
+ int[][] qc = new int[NUM_QUADRANTS][numBuckets];
+ if (input != null && input.length > 0) {
+ extractByQuadrantInto(input, 0, input.length, qc);
+ }
+ return qc;
+ }
+
+ private void extractByQuadrantInto(byte[] b, int from, int to, int[][] qc) {
+ // Stride-1: high-byte-anchored unigrams and bigrams
+ for (int i = from; i < to; i++) {
+ int bi = b[i] & 0xFF;
+ if (bi < 0x80) {
+ continue;
+ }
+
+ // Unigram → HH (high-byte frequency = encoding-specific signal)
+ qc[Q_HH][bucket((FNV_OFFSET ^ bi) * FNV_PRIME)]++;
+
+ if (i + 1 < to) {
+ int bi1 = b[i + 1] & 0xFF;
+ int h = (FNV_OFFSET ^ bi) * FNV_PRIME;
+ h = (h ^ bi1) * FNV_PRIME;
+ int bkt = bucket(h);
+ // bi >= 0x80 always; classify by bi1
+ qc[bi1 >= 0x80 ? Q_HH : Q_HL][bkt]++;
+ }
+ }
+
+ // Stride-2: code-unit pairs at positions 0, 2, 4, ... (all bytes)
+ for (int i = from; i + 1 < to; i += 2) {
+ int b0 = b[i] & 0xFF;
+ int b1 = b[i + 1] & 0xFF;
+ int h = (FNV_STRIDE2_SALT ^ b0) * FNV_PRIME;
+ h = (h ^ b1) * FNV_PRIME;
+ int bkt = bucket(h);
+ int q;
+ if (b0 < 0x80) {
+ q = b1 < 0x80 ? Q_LL : Q_LH;
+ } else {
+ q = b1 < 0x80 ? Q_HL : Q_HH;
+ }
+ qc[q][bkt]++;
+ }
+ }
+
+ private void extractInto(byte[] b, int from, int to, int[] counts) {
+ // Stride-1: high-byte-anchored unigrams and bigrams.
+ for (int i = from; i < to; i++) {
+ int bi = b[i] & 0xFF;
+ if (bi < 0x80) {
+ continue;
+ }
+
+ // Unigram
+ counts[bucket((FNV_OFFSET ^ bi) * FNV_PRIME)]++;
+
+ if (i + 1 < to) {
+ int bi1 = b[i + 1] & 0xFF;
+
+ // Bigram
+ int h = (FNV_OFFSET ^ bi) * FNV_PRIME;
+ h = (h ^ bi1) * FNV_PRIME;
+ counts[bucket(h)]++;
+ }
+ }
+
+ // Stride-2 bigrams (same logic as extractSparseInto).
+ for (int i = from; i + 1 < to; i += 2) {
+ int b0 = b[i] & 0xFF;
+ int b1 = b[i + 1] & 0xFF;
+ int h = (FNV_STRIDE2_SALT ^ b0) * FNV_PRIME;
+ h = (h ^ b1) * FNV_PRIME;
+ counts[bucket(h)]++;
+ }
+ }
+
+ private int bucket(int hash) {
+ return (hash & 0x7fffffff) % numBuckets;
+ }
+
+ @Override
+ public int getNumBuckets() {
+ return numBuckets;
+ }
+
+ /**
+ * Returns the fraction of bytes in {@code input} that are below 0x80 and
+ * therefore contribute no features to this extractor.
+ */
+ public static double oovRate(byte[] input) {
+ if (input == null || input.length == 0) {
+ return 1.0;
+ }
+ int ascii = 0;
+ for (byte b : input) {
+ if ((b & 0xFF) < 0x80) {
+ ascii++;
+ }
+ }
+ return (double) ascii / input.length;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(java.util.Locale.ROOT,
+ "ByteNgramFeatureExtractor{buckets=%d, UB-AS}", numBuckets);
+ }
+}
diff --git a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/CjkDecodeValidator.java b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/CjkDecodeValidator.java
index cf4e4e6554..00f44dcee5 100644
--- a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/CjkDecodeValidator.java
+++ b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/CjkDecodeValidator.java
@@ -64,8 +64,18 @@ public final class CjkDecodeValidator {
* Failure rate of {@code bytes} under {@code cjkCharset}'s vendor superset,
* counting only legacy high bytes (embedded UTF-8 is skipped, not counted).
*
- * @return failures / legacy-high-bytes, or {@code -1.0} when there is too
- * little legacy evidence (legacy high bytes < {@link #MIN_HIGH_BYTES})
+ * <p>Special case: if every high byte is a valid UTF-8 sequence (i.e.,
+ * {@code nHigh == 0}) and there are at least {@link #MIN_HIGH_BYTES} UTF-8
+ * multi-byte sequences, the probe is pure UTF-8 — no legacy CJK content at
+ * all. In that case {@code 1.0} is returned to trigger the CJK veto.
+ * Real legacy CJK encodings (Shift_JIS, Big5, EUC-JP, GB18030 …) always
+ * have lead bytes in 0x81–0x9F or 0xF5–0xFF that are not valid UTF-8 starts,
+ * so {@code nHigh > 0} for any genuine CJK document.
+ *
+ * @return failures / legacy-high-bytes, {@code 1.0} when the probe is pure
+ * UTF-8 (nHigh==0, nUTF8seqs≥{@link #MIN_HIGH_BYTES}), or
+ * {@code -1.0} when there is too little evidence either way
+ * (legacy high bytes < {@link #MIN_HIGH_BYTES} and not pure UTF-8)
*/
public static double strippedFailureRate(byte[] bytes, Charset cjkCharset) {
Charset decodeAs = CharsetSupersets.decodeAs(cjkCharset);
@@ -77,6 +87,7 @@ public final class CjkDecodeValidator {
int n = bytes.length;
int fail = 0;
int nHigh = 0;
+ int nUtf8Seqs = 0;
while (i < n) {
int x = bytes[i] & 0xFF;
if (x < 0x80) {
@@ -85,6 +96,7 @@ public final class CjkDecodeValidator {
}
int ulen = utf8SequenceLength(bytes, i);
if (ulen > 0) {
+ nUtf8Seqs++;
i += ulen; // embedded UTF-8 — not legacy content, skip
continue;
}
@@ -102,6 +114,11 @@ public final class CjkDecodeValidator {
}
}
if (nHigh < MIN_HIGH_BYTES) {
+ // Pure UTF-8: no legacy high bytes at all but enough UTF-8 sequences
+ // to be confident. Return 1.0 so the CJK veto fires.
+ if (nHigh == 0 && nUtf8Seqs >= MIN_HIGH_BYTES) {
+ return 1.0;
+ }
return -1.0;
}
return (double) fail / nHigh;
diff --git a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/MojibusterEncodingDetector.java b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/MojibusterEncodingDetector.java
index e225366091..d06f14c597 100644
--- a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/MojibusterEncodingDetector.java
+++ b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/MojibusterEncodingDetector.java
@@ -17,755 +17,828 @@
package org.apache.tika.ml.chardetect;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.charset.Charset;
-import java.nio.file.Path;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.util.Map;
+import org.apache.tika.config.ConfigDeserializer;
+import org.apache.tika.config.JsonConfig;
import org.apache.tika.config.TikaComponent;
import org.apache.tika.detect.EncodingDetector;
-import org.apache.tika.detect.EncodingDetectorContext;
-import org.apache.tika.detect.EncodingProbeCache;
import org.apache.tika.detect.EncodingResult;
-import org.apache.tika.detect.HighByteLetterStats;
import org.apache.tika.io.TikaInputStream;
import org.apache.tika.metadata.Metadata;
-import org.apache.tika.metadata.TikaCoreProperties;
+import org.apache.tika.ml.LinearModel;
import org.apache.tika.parser.ParseContext;
/**
- * Naive-Bayes pipeline detector: structural checks for wide Unicode
- * + BOMs before falling through to the bigram NB classifier for
- * everything else.
+ * Tika {@link EncodingDetector} backed by a single statistical model with
+ * structural pre- and post-processing rules.
*
- * <p>Order of operations:</p>
+ * <h3>Detection pipeline</h3>
* <ol>
- * <li><strong>UTF-32 codepoint validity</strong> via
- * {@link WideUnicodeDetector}. 4-byte-aligned probes with
- * valid Unicode codepoints in exactly one endian order are
- * deterministically UTF-32.</li>
- * <li><strong>UTF-16 column-asymmetry specialist</strong>. Stride-2
- * column histograms reliably distinguish UTF-16-LE / BE from
- * other content — a question bigram NB fundamentally can't
- * answer (LE and BE produce the same bigram multiset).</li>
- * <li><strong>Naive-Bayes bigram classifier</strong>. Handles the
- * single-byte and multi-byte CJK classes where byte-bigrams
- * are the natural discriminative signal.</li>
+ * <li><strong>Structural gates</strong> ({@link StructuralEncodingRules}) —
+ * cheap deterministic checks before the model: ASCII, ISO-2022 family,
+ * UTF-8 grammar exclusion, and wide-Unicode (UTF-16/32) detection via
+ * {@link WideUnicodeDetector}.</li>
+ * <li><strong>Statistical model</strong> ({@link LinearModel}) — covers all
+ * charsets as direct labels, including EBCDIC variants (IBM420-ltr/rtl,
+ * IBM424-ltr/rtl, IBM500, IBM1047) alongside CJK, Latin, and other
+ * single-byte encodings.</li>
+ * <li><strong>Post-model rules</strong> — CJK grammar walkers, ISO→Windows
+ * C1-byte upgrade, GB18030 four-byte upgrade.</li>
* </ol>
*
- * <p><strong>BOM detection is NOT handled here.</strong> The canonical
- * location is {@code org.apache.tika.detect.BOMDetector} (tika-core),
- * SPI-registered, runs first in {@code DefaultEncodingDetector}'s
- * chain and emits a {@code DECLARATIVE} candidate. This pipeline
- * composes with that detector externally, not internally.</p>
- *
- * <p>Each prefix layer short-circuits when it produces a confident
- * candidate. Conservative: only return at a layer when that layer's
- * structural check is clean.</p>
+ * <p>This class is thread-safe: the model is loaded once at construction time
+ * and feature extraction is stateless.</p>
*/
-@TikaComponent(spi = false, name = "mojibuster-encoding-detector")
+@TikaComponent(name = "mojibuster-encoding-detector")
public class MojibusterEncodingDetector implements EncodingDetector {
- private static final Logger LOG =
- LoggerFactory.getLogger(MojibusterEncodingDetector.class);
+ /**
+ * Post-processing rules that can be individually enabled or disabled.
+ * All rules are enabled by default; disable subsets via {@link #withRules}
+ * to run ablation studies.
+ */
+ public enum Rule {
+ /**
+ * Fast structural gates applied before the general model call:
+ * ISO-2022 family, pure-ASCII → UTF-8, and UTF-8 grammar exclusion.
+ * EBCDIC discrimination is handled by the sub-model, not structural rules.
+ */
+ STRUCTURAL_GATES,
+ /**
+ * Upgrade ISO-8859-X results to the corresponding Windows-12XX charset
+ * when the probe contains C1 bytes (0x80–0x9F).
+ */
+ ISO_TO_WINDOWS,
+ /**
+ * Refine CJK candidates nominated by the model with grammar walkers
+ * (Shift_JIS, EUC-JP, EUC-KR, Big5, GB18030).
+ */
+ CJK_GRAMMAR,
+ /**
+ * Upgrade a GBK or GB2312 result to GB18030 when the probe contains at
+ * least one GB18030-specific 4-byte sequence ([0x81–0xFE][0x30–0x39][0x81–0xFE][0x30–0x39]).
+ * Such sequences are impossible in GBK/GB2312 (whose trail bytes are
+ * 0x40–0xFE), so their presence is definitive proof that a GB18030 codec
+ * is required to avoid replacement characters.
+ */
+ GB_FOUR_BYTE_UPGRADE,
+ /**
+ * Upgrade an ISO-8859-X result to its Windows-12XX equivalent when the
+ * probe contains at least one CRLF pair ({@code 0x0D 0x0A}) but no C1
+ * bytes ({@code 0x80–0x9F}).
+ *
+ * <p>Files originating on Windows use CRLF line endings. The presence
+ * of a {@code \r\n} pair in a probe that is otherwise 7-bit ASCII (or
+ * has only high bytes above {@code 0x9F}) is weak evidence of Windows
+ * origin and therefore of a Windows code page. {@link Rule#ISO_TO_WINDOWS}
+ * already handles the C1-byte case definitively; this rule covers the
+ * weaker case where C1 bytes have not been seen but CRLF line endings
+ * suggest Windows origin. A bare {@code 0x0D} (old Mac Classic CR-only
+ * line ending) does <em>not</em> trigger this rule. Mirrors the legacy
+ * {@code UniversalEncodingListener.report()} heuristic.</p>
+ */
+ CRLF_TO_WINDOWS
+ }
- /** Default NB bigram model on the classpath. */
- public static final String DEFAULT_MODEL_RESOURCE =
- "/org/apache/tika/ml/chardetect/nb-bigram.bin";
+ private static final long serialVersionUID = 1L;
- // Probe sized by tag-stripped content (16 KB target), capped at 512 KB raw.
- // Markup-heavy pages whose distinguishing bytes (esp. UTF-8 multi-byte
- // sequences) sit past a fixed 16 KB raw window would otherwise starve the
- // structural UTF-8 check and NB scoring. See AdaptiveProbe.
- private static final int PROBE_CONTENT_TARGET = AdaptiveProbe.DEFAULT_CONTENT_TARGET;
- private static final int PROBE_RAW_CAP = AdaptiveProbe.DEFAULT_RAW_CAP;
+ /** Default model resource path on the classpath. */
+ public static final String DEFAULT_MODEL_RESOURCE =
+ "/org/apache/tika/ml/chardetect/chardetect-v6-no-utf32.bin";
/**
- * Minimum number of successfully-parsed well-formed tags required
- * before we trust the stripped output. The stripper only counts
- * actual {@code <tag>} and {@code <!--comment-->} entries — stray
- * {@code <} bytes in plain text don't increment the counter.
- *
- * <p>Using tag count instead of a byte-ratio heuristic is
- * encoding-agnostic: it works for any charset the stripper can
- * reach (ASCII-compatible content). On a probe that happens to
- * be EBCDIC (where {@code 0x3C} means something other than
- * {@code <}), stray {@code 0x3C} bytes almost never form a
- * well-formed tag structure, so tagCount stays at 0 and we
- * keep the original bytes.</p>
+ * Maps model label strings (from training-data filenames) to the canonical
+ * Java {@link Charset} name when they differ. This bridges gaps between
+ * the encoding names used in training corpora and Java's charset registry.
+ * <ul>
+ * <li>{@code x-mac-cyrillic} → {@code x-MacCyrillic} (Java uses mixed case)</li>
+ * <li>{@code IBM424-ltr}, {@code IBM424-rtl} → {@code IBM424}
+ * (Java knows the code page but not the display-direction variant)</li>
+ * <li>{@code IBM420-ltr}, {@code IBM420-rtl} → {@code IBM420}
+ * (same rationale as IBM424)</li>
+ * <li>{@code windows-874} → {@code x-windows-874}
+ * (Java's canonical name for the Thai Windows code page)</li>
+ * </ul>
*/
- private static final int MIN_TAG_COUNT_TO_USE_STRIP = 1;
+ private static final Map<String, String> LABEL_TO_JAVA_NAME;
+
+ static {
+ Map<String, String> m = new HashMap<>();
+ m.put("x-mac-cyrillic", "x-MacCyrillic");
+ m.put("IBM424-ltr", "IBM424");
+ m.put("IBM424-rtl", "IBM424");
+ m.put("IBM420-ltr", "IBM420");
+ m.put("IBM420-rtl", "IBM420");
+ m.put("windows-874", "x-windows-874");
+ // Training filenames use hyphens (UTF-16-LE) but Java requires no hyphen (UTF-16LE)
+ m.put("UTF-16-LE", "UTF-16LE");
+ m.put("UTF-16-BE", "UTF-16BE");
+ m.put("UTF-32-LE", "UTF-32LE");
+ m.put("UTF-32-BE", "UTF-32BE");
+ LABEL_TO_JAVA_NAME = Collections.unmodifiableMap(m);
+ }
+
+ // ================================================================
+ // Quadrant-partitioned scoring: cohort classification and weights
+ // ================================================================
/**
- * Minimum HTML entity count to apply the stripper even when no
- * well-formed tags are present. A single stray {@code &}
- * mention in plain prose shouldn't trigger the strip path, but
- * entity-heavy content (HTML-quoted text in a plain-text file,
- * truncated reads where the leading tag was lost, etc.) should.
+ * Script-family cohort for quadrant weight assignment. Each charset label
+ * maps to exactly one cohort, which determines its quadrant weight profile.
*/
- private static final int MIN_ENTITY_COUNT_TO_USE_STRIP = 3;
+ enum Cohort {
+ CJK, LATIN, CYRILLIC, ARABIC, HEBREW, GREEK, THAI, EBCDIC, UTF, OTHER
+ }
+
+ private static final Map<String, Cohort> LABEL_COHORT;
+
+ static {
+ Map<String, Cohort> m = new HashMap<>();
+ for (String s : new String[]{"GB18030", "GBK", "GB2312", "Shift_JIS", "windows-31j",
+ "EUC-JP", "EUC-KR", "x-windows-949", "Big5", "Big5-HKSCS", "x-EUC-TW"}) {
+ m.put(s, Cohort.CJK);
+ }
+ for (String s : new String[]{"ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4",
+ "ISO-8859-9", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15",
+ "windows-1250", "windows-1252", "windows-1254", "windows-1257", "windows-1258",
+ "IBM850", "IBM437", "x-MacRoman"}) {
+ m.put(s, Cohort.LATIN);
+ }
+ for (String s : new String[]{"ISO-8859-5", "windows-1251", "KOI8-R", "KOI8-U",
+ "x-mac-cyrillic", "x-MacCyrillic"}) {
+ m.put(s, Cohort.CYRILLIC);
+ }
+ for (String s : new String[]{"ISO-8859-6", "windows-1256",
+ "IBM420-ltr", "IBM420-rtl"}) {
+ m.put(s, Cohort.ARABIC);
+ }
+ for (String s : new String[]{"ISO-8859-8", "windows-1255",
+ "IBM424-ltr", "IBM424-rtl"}) {
+ m.put(s, Cohort.HEBREW);
+ }
+ for (String s : new String[]{"ISO-8859-7", "windows-1253"}) {
+ m.put(s, Cohort.GREEK);
+ }
+ for (String s : new String[]{"windows-874", "x-windows-874"}) {
+ m.put(s, Cohort.THAI);
+ }
+ for (String s : new String[]{"IBM500", "IBM1047"}) {
+ m.put(s, Cohort.EBCDIC);
+ }
+ for (String s : new String[]{"UTF-8", "UTF-16-LE", "UTF-16-BE", "UTF-16LE", "UTF-16BE",
+ "UTF-32-LE", "UTF-32-BE", "UTF-32LE", "UTF-32BE", "US-ASCII"}) {
+ m.put(s, Cohort.UTF);
+ }
+ LABEL_COHORT = Collections.unmodifiableMap(m);
+ }
/**
- * Confidence attached to UTF-32 structural candidates — high but
- * sub-1.0 so the ResultType.STRUCTURAL flag carries meaning
- * without blocking downstream override on mislabeled content.
+ * Hand-tuned quadrant weights per cohort: {@code [LL, LH, HL, HH]}.
+ *
+ * <p>Rationale:</p>
+ * <ul>
+ * <li><b>CJK</b>: HH = double-byte character pairs, the primary signal.
+ * LL = ASCII space-frequency noise.</li>
+ * <li><b>LATIN</b>: LH/HL = which high bytes neighbor ASCII, the key SBCS
+ * discriminator. HH = rare accented-char adjacencies (noise).</li>
+ * <li><b>CYRILLIC/ARABIC/HEBREW/GREEK/THAI</b>: alphabet sits above 0x80,
+ * so HH carries the discriminating letter-pair signal.</li>
+ * <li><b>EBCDIC/UTF</b>: all quadrants contribute meaningfully.</li>
+ * </ul>
*/
- private static final float UTF32_STRUCTURAL_CONF = 0.95f;
+ private static final Map<Cohort, float[]> COHORT_QUADRANT_WEIGHTS;
+
+ static {
+ Map<Cohort, float[]> w = new HashMap<>();
+ // LL LH HL HH
+ w.put(Cohort.CJK, new float[]{0.3f, 0.5f, 0.5f, 2.0f});
+ w.put(Cohort.LATIN, new float[]{0.5f, 1.5f, 1.5f, 0.3f});
+ w.put(Cohort.CYRILLIC, new float[]{0.3f, 1.0f, 1.0f, 2.0f});
+ w.put(Cohort.ARABIC, new float[]{0.3f, 1.0f, 1.0f, 2.0f});
+ w.put(Cohort.HEBREW, new float[]{0.3f, 1.0f, 1.0f, 2.0f});
+ w.put(Cohort.GREEK, new float[]{0.3f, 1.0f, 1.0f, 2.0f});
+ w.put(Cohort.THAI, new float[]{0.3f, 1.0f, 1.0f, 2.0f});
+ w.put(Cohort.EBCDIC, new float[]{1.0f, 1.0f, 1.0f, 1.0f});
+ w.put(Cohort.UTF, new float[]{1.0f, 1.0f, 1.0f, 1.0f});
+ w.put(Cohort.OTHER, new float[]{1.0f, 1.0f, 1.0f, 1.0f});
+ COHORT_QUADRANT_WEIGHTS = Collections.unmodifiableMap(w);
+ }
/**
- * Confidence attached to the UTF-8 LIKELY candidate emitted when
- * {@link StructuralEncodingRules#checkUtf8} returns LIKELY_UTF8.
- * High but sub-1.0 because short CJK probes can pass UTF-8 grammar
- * by coincidence (FP ≤ 0.77% at 16B, ≤ 0.05% at 256B on our training
- * corpus). Downstream language-signal arbitration decides genuine
- * FPs — the gate's job is to nominate, not to overrule.
+ * Build the per-class quadrant weight matrix from model labels and cohort
+ * assignments. Each class gets the weight vector of its cohort.
+ *
+ * @param labels model label array
+ * @return {@code float[numClasses][4]} quadrant weights
*/
- private static final float UTF8_STRUCTURAL_CONF = 0.95f;
+ static float[][] buildQuadrantWeights(String[] labels) {
+ float[] uniform = {1.0f, 1.0f, 1.0f, 1.0f};
+ float[][] qw = new float[labels.length][ByteNgramFeatureExtractor.NUM_QUADRANTS];
+ for (int c = 0; c < labels.length; c++) {
+ Cohort cohort = LABEL_COHORT.getOrDefault(labels[c], Cohort.OTHER);
+ float[] src = COHORT_QUADRANT_WEIGHTS.getOrDefault(cohort, uniform);
+ System.arraycopy(src, 0, qw[c], 0, ByteNgramFeatureExtractor.NUM_QUADRANTS);
+ }
+ return qw;
+ }
- /** Confidence for an ISO-2022-JP/KR/CN structural candidate (7-bit, escape-based). */
- private static final float ISO2022_STRUCTURAL_CONF = 0.95f;
+ /** Default number of bytes read from the stream for detection. */
+ public static final int MAX_PROBE_BYTES = 4096;
- /** ISO-2022 decode-verify: a stray {@code ESC $} in plain ASCII must not win, so
- * require the decode to yield real CJK at near-zero replacement rate. */
- private static final int ISO2022_MIN_CJK = 4;
- private static final double ISO2022_MAX_FFFD_RATE = 0.05;
+ /**
+ * JSON-deserializable configuration for {@link MojibusterEncodingDetector}.
+ *
+ * <p>Example JSON:
+ * <pre>
+ * { "maxProbeBytes": 1024 }
+ * </pre>
+ */
+ public static class Config {
+ /** Maximum bytes to read per detection call. Must be > 0. */
+ public int maxProbeBytes = MAX_PROBE_BYTES;
+ }
- /** False-CJK veto: drop an NB legacy-CJK candidate whose UTF-8-stripped decode
- * fails above this rate. Post-strip, real CJK (pure or mixed) is ≤1.6% and
- * genuine false-CJK ≥5.3%, so ~2.5% separates them (see CjkDecodeValidator). */
- private static final double CJK_FAILURE_VETO_THRESHOLD = 0.025;
+ /**
+ * All charsets whose logit is within this many points of the maximum are
+ * included as candidates. Linear confidence within the window ensures that
+ * plausible alternatives surface for downstream arbitration (e.g. CharSoup)
+ * without the exponential compression that softmax would apply.
+ */
+ public static final float LOGIT_GAP = 5.0f;
- /** Confidence for the windows-1252 fallback emitted on empty/ASCII probes. */
- private static final float FALLBACK_CONFIDENCE = 0.1f;
+ private final LinearModel model;
+ private final ByteNgramFeatureExtractor extractor;
+ private final EnumSet<Rule> enabledRules;
+ private final int maxProbeBytes;
+ private final float[][] quadrantWeights;
/**
- * Maximum fraction of malformed-UTF-8 bytes we tolerate before
- * disqualifying NB's UTF-8 pick. Real-world UTF-8 files often contain
- * one or two corrupted bytes (copy-paste accidents, truncation,
- * transport flips) — rejecting them outright would force the detector
- * to drop a high-confidence UTF-8 classification on otherwise-valid
- * text and fall through to {@code AutoDetectReader.detect}, which
- * raises {@code TikaException} when the chain returns no candidates.
- * Per-byte error rate governing LONG probes (the absolute cap below is a
- * floor for short ones). 0.01% (~1 malformed sequence per 10 KB)
- * accommodates real UTF-8 with a few stray/corrupt bytes (e.g. a 150 KB
- * page with 4 errors = 0.003%) while still rejecting a win-1252 page
- * misread as UTF-8 (a 20 KB Western page surfaces ~14 invalid sequences =
- * 0.07%, 7× over).
+ * Load the model from its default classpath location with all rules enabled
+ * and default configuration.
*
- * <p>TACTICAL: remove or revisit when Mojibuster's UTF-8 grammar
- * check is replaced with a probabilistic decoder that returns a
- * confidence score directly.</p>
+ * @throws IOException if the model resource is missing or unreadable
*/
- private static final double UTF8_MALFORMED_TOLERANCE = 0.0001;
+ public MojibusterEncodingDetector() throws IOException {
+ this(new Config());
+ }
/**
- * Absolute floor on tolerated UTF-8 error events for SHORT probes, where a
- * rate is meaningless (a 20-byte string with 1 bad byte is 5%). The
- * effective cap is {@code max(this, probeLen * UTF8_MALFORMED_TOLERANCE)} —
- * so short probes allow 1, long probes are governed by the rate. (Earlier
- * this was a hard cap applied at all lengths, which wrongly rejected long,
- * genuinely-UTF-8 pages carrying a couple of stray bytes.)
+ * Load the model from its default classpath location using the supplied
+ * {@link Config}.
+ *
+ * @param config configuration (e.g. custom {@code maxProbeBytes})
+ * @throws IOException if the model resource is missing or unreadable
*/
- private static final int UTF8_MAX_TOLERATED_ERRORS = 1;
-
- /** Windows-1252: the WHATWG-canonical default for unlabeled Western content. */
- private static final String WIN1252 = "windows-1252";
+ public MojibusterEncodingDetector(Config config) throws IOException {
+ this(LinearModel.loadFromClasspath(DEFAULT_MODEL_RESOURCE),
+ EnumSet.allOf(Rule.class),
+ config.maxProbeBytes);
+ }
- private final NaiveBayesBigramEncodingDetector nb;
- private final Utf16SpecialistEncodingDetector utf16;
+ /**
+ * Load the model from its default classpath location using JSON configuration.
+ * Requires Jackson on the classpath.
+ *
+ * <p>Example JSON: {@code { "maxProbeBytes": 1024 }}
+ *
+ * @param jsonConfig JSON configuration
+ * @throws IOException if the model resource is missing or unreadable
+ */
+ public MojibusterEncodingDetector(JsonConfig jsonConfig) throws IOException {
+ this(ConfigDeserializer.buildConfig(jsonConfig, Config.class));
+ }
/**
- * Default SPI constructor: load the NB bigram model from the
- * classpath at {@link #DEFAULT_MODEL_RESOURCE}. The UTF-16
- * specialist loads its own model the same way.
+ * Load the model from a custom path on disk. Useful for evaluation runs
+ * with different model candidates.
+ *
+ * @param modelPath path to the model binary on disk
+ * @throws IOException if the model is missing or unreadable
*/
- public MojibusterEncodingDetector() throws IOException {
- this.nb = loadFromClasspath();
- this.utf16 = new Utf16SpecialistEncodingDetector();
+ public MojibusterEncodingDetector(java.nio.file.Path modelPath) throws IOException {
+ this(LinearModel.loadFromPath(modelPath),
+ EnumSet.allOf(Rule.class),
+ MAX_PROBE_BYTES);
}
- public MojibusterEncodingDetector(Path nbModelPath) throws IOException {
- this.nb = new NaiveBayesBigramEncodingDetector(nbModelPath);
- this.utf16 = new Utf16SpecialistEncodingDetector();
+ private MojibusterEncodingDetector(LinearModel model, EnumSet<Rule> rules, int maxProbeBytes) {
+ this.model = model;
+ this.extractor = new ByteNgramFeatureExtractor(model.getNumBuckets());
+ this.enabledRules = rules.isEmpty() ? EnumSet.noneOf(Rule.class) : EnumSet.copyOf(rules);
+ this.maxProbeBytes = maxProbeBytes;
+ this.quadrantWeights = buildQuadrantWeights(model.getLabels());
}
- private static NaiveBayesBigramEncodingDetector loadFromClasspath() throws IOException {
- InputStream in = MojibusterEncodingDetector.class
- .getResourceAsStream(DEFAULT_MODEL_RESOURCE);
- if (in == null) {
- throw new IOException(
- "NB bigram model not found on classpath at " + DEFAULT_MODEL_RESOURCE);
- }
- try (InputStream stream = in) {
- return new NaiveBayesBigramEncodingDetector(stream);
+ /**
+ * Return a new detector that shares both models but reads at most
+ * {@code probeBytes} bytes per stream. Values smaller than the default
+ * ({@value #MAX_PROBE_BYTES}) trade accuracy for speed; larger values may
+ * improve accuracy on documents where the encoding is not established in the
+ * first few kilobytes.
+ *
+ * @param probeBytes maximum bytes to read per detection call; must be > 0
+ */
+ public MojibusterEncodingDetector withMaxProbeBytes(int probeBytes) {
+ if (probeBytes <= 0) {
+ throw new IllegalArgumentException("probeBytes must be > 0, got: " + probeBytes);
}
+ return new MojibusterEncodingDetector(this.model, this.enabledRules, probeBytes);
+ }
+
+ /**
+ * Return a new detector that shares the model but runs only the specified
+ * rules. Use {@code EnumSet.noneOf(Rule.class)} for statistical-only mode.
+ * The model is not reloaded; this is cheap to call.
+ */
+ public MojibusterEncodingDetector withRules(EnumSet<Rule> rules) {
+ return new MojibusterEncodingDetector(this.model, rules, this.maxProbeBytes);
}
@Override
- public List<EncodingResult> detect(TikaInputStream tis, Metadata metadata,
+ public List<EncodingResult> detect(TikaInputStream input, Metadata metadata,
ParseContext parseContext) throws IOException {
- byte[] probe = readProbe(tis, parseContext);
- return detect(probe, metadata);
- }
+ if (input == null) {
+ return Collections.emptyList();
+ }
- /** Byte-array entry point without metadata — same as passing {@code null}. */
- public List<EncodingResult> detect(byte[] probe) {
- return detect(probe, null);
+ byte[] probe = readProbe(input, maxProbeBytes);
+ // Strip BOM bytes before feature extraction. BOMs are excluded from training
+ // data; stripping ensures consistent model inference. BOM detection is handled
+ // by BOMDetector (which runs earlier in the chain and returns DECLARATIVE), and
+ // CharSoup strips BOMs from raw bytes before language scoring so a BOM-detected
+ // charset is not disadvantaged against other candidates.
+ probe = stripBom(probe);
+ // An empty probe (e.g. empty file, or a file that was only a BOM) falls
+ // through to detectAll where isPureAscii returns true for a zero-length
+ // array, yielding windows-1252 as the default.
+ int topN = probe.length <= SHORT_PROBE_THRESHOLD ? TOP_N_SHORT : TOP_N_LONG;
+ return detectAll(probe, topN);
}
/**
- * Byte-array entry point with optional metadata. If metadata's
- * content-type suggests HTML/XML (or is absent), HTML is stripped
- * before the NB stage — but never before the wide-Unicode
- * structural checks, which need byte alignment intact.
+ * Applies structural encoding rules that produce {@link EncodingResult.ResultType#STRUCTURAL}
+ * results. Returns non-null only when a byte-level pattern unambiguously identifies the
+ * charset (ISO-2022 escape sequences, valid UTF-8 grammar, wide-Unicode null patterns).
+ *
+ * <p>Pure ASCII is deliberately excluded — ASCII is compatible with virtually all
+ * single-byte encodings and is not structurally definitive.</p>
*/
- public List<EncodingResult> detect(byte[] probe, Metadata metadata) {
- if (LOG.isTraceEnabled()) {
- int probeLen = probe == null ? 0 : probe.length;
- int highBytes = probe == null ? 0 : HighByteLetterStats.countHighBytes(probe);
- LOG.trace("mojibuster enter probe={}B highBytes={}", probeLen, highBytes);
- }
- // Empty / near-empty probes: return the WHATWG default so
- // downstream callers don't see an empty list (which propagates
- // up as "Failed to detect the character encoding of a
- // document" in TXTParser / RFC822Parser / etc). windows-1252
- // at low confidence lets any declarative hint override.
- if (probe == null || probe.length < 2) {
- LOG.trace("mojibuster -> windows-1252 fallback (probe<2B)");
- return windows1252Fallback();
- }
-
- // Pure-ASCII: no high bytes and no nulls. Bigram NB cannot
- // discriminate Latin code pages from their ASCII prefix — all
- // ASCII-compatible SBCS encodings produce the same bigram
- // multiset on pure-ASCII bytes. Return windows-1252 (HTML5 /
- // WHATWG default for unlabeled Western content) before
- // consulting NB so we don't hand back a bias-driven x-MacRoman
- // or IBM850 pick.
- if (isPureAscii(probe)) {
- // ISO-2022-JP/KR/CN are 7-bit escape-based encodings: NB sees no high
- // bytes, so without this they fall to the windows-1252 default and
- // decode to gibberish (a 4.x-vs-3.x regression; icu4j catches them).
- // Gated to the pure-ASCII branch on purpose — high-byte binary that
- // happens to contain an ESC sequence never reaches here, it takes the
- // normal NB path. decode-verify guards the rare 7-bit stray-ESC case.
- Charset iso2022 = detectIso2022Verified(probe);
- if (iso2022 != null) {
- LOG.trace("mojibuster -> {} (iso-2022 structural)", iso2022.name());
- return List.of(new EncodingResult(iso2022, ISO2022_STRUCTURAL_CONF,
- iso2022.name(), EncodingResult.ResultType.STRUCTURAL));
- }
- LOG.trace("mojibuster -> windows-1252 fallback (pure ASCII)");
- return windows1252Fallback();
- }
-
- // Build a candidate pool from all layers. Every layer
- // contributes 0-N candidates with appropriate ResultType and
- // confidence. Structural signals get high but not absolute
- // confidence — content can be mislabeled or structurally
- // coincidental.
- //
- // BOM detection lives outside this pipeline — tika-core's
- // BOMDetector is SPI-registered and emits its own candidate.
-
- java.util.List<EncodingResult> pool = new java.util.ArrayList<>();
-
- // UTF-32 codepoint validity — structural candidate. Also
- // collects UTF-16 surrogate invalidity flags used below.
- WideUnicodeDetector.Result wide = WideUnicodeDetector.analyze(probe);
- LOG.trace("mojibuster wideUnicode charset={} invalidLE={} invalidBE={}",
- wide.charset, wide.invalidUtf16Le, wide.invalidUtf16Be);
- if (wide.charset != null) {
- pool.add(new EncodingResult(wide.charset, UTF32_STRUCTURAL_CONF,
- wide.charset.name(), EncodingResult.ResultType.STRUCTURAL));
- }
-
- // UTF-16 specialist (stride-2 column histogram features,
- // maxent). Gated externally by column-asymmetry evidence to
- // prevent over-fires on legacy CJK bytes whose stride-1 byte
- // patterns don't distinguish UTF-16 from legacy encodings.
- // When the gate fires and the specialist has a confident
- // winner, short-circuit: return a single UTF-16LE/BE
- // STRUCTURAL candidate. Stride-1 byte bigrams cannot
- // discriminate UTF-16 reliably (CJK in UTF-16 produces byte
- // pairs that alias common ASCII bigrams), so we keep UTF-16
- // out of NB training and delegate to the specialist.
- boolean utf16Gate = StructuralEncodingRules.has2ByteColumnAsymmetryEvidence(probe);
- LOG.trace("mojibuster utf16Gate={}", utf16Gate);
- if (utf16Gate) {
- List<EncodingResult> utf16Results = utf16.detect(probe);
- LOG.trace("mojibuster utf16Specialist returned {} candidates", utf16Results.size());
- for (EncodingResult r : utf16Results) {
- String name = r.getCharset().name();
- boolean invalid =
- ("UTF-16LE".equals(name) && wide.invalidUtf16Le)
- || ("UTF-16BE".equals(name) && wide.invalidUtf16Be);
- LOG.trace("mojibuster utf16Specialist candidate={} invalid={}", name, invalid);
- if (!invalid) {
- LOG.trace("mojibuster -> utf16 short-circuit {}", name);
- return List.of(new EncodingResult(r.getCharset(),
- UTF32_STRUCTURAL_CONF, r.getLabel(),
- EncodingResult.ResultType.STRUCTURAL));
- }
- }
- }
-
- // UTF-8 is a trained NB class. Two structural contributions
- // from the grammar check:
- // • NOT_UTF8 → post-NB disqualifier: if grammar proves the
- // probe cannot be valid UTF-8, drop UTF-8 from NB's output
- // regardless of confidence.
- // • LIKELY_UTF8 → emit a STRUCTURAL candidate alongside NB.
- // Safety net for short probes (e.g. 2-byte probes where
- // NB picks a coincidental Korean/CJK class because the
- // single bigram is more common in that class's vocab).
- // sortAndDedup then picks UTF-8 over NB's statistical call
- // because STRUCTURAL confidence outranks STATISTICAL.
- // • AMBIGUOUS (pure ASCII or only truncated lead): no
- // emission; NB + fallbacks handle it.
- StructuralEncodingRules.Utf8Result utf8 = StructuralEncodingRules.checkUtf8(probe);
- // TACTICAL: tolerate small corruption. If the grammar check returned
- // NOT_UTF8 but the malformed-byte fraction is tiny, treat as UTF-8 —
- // a single bad continuation byte in 2KB of CJK is nearly always
- // corruption, not "this isn't UTF-8". Remove when grammar check is
- // replaced with a probabilistic decoder.
- boolean utf8Tolerated = false;
- if (utf8 == StructuralEncodingRules.Utf8Result.NOT_UTF8) {
- int errors = StructuralEncodingRules.countUtf8Errors(probe);
- // Length-aware: absolute floor for short probes, rate for long ones.
- int maxTolerated = Math.max(UTF8_MAX_TOLERATED_ERRORS,
- (int) (probe.length * UTF8_MALFORMED_TOLERANCE));
- if (errors > 0 && errors <= maxTolerated) {
- utf8Tolerated = true;
- LOG.trace("mojibuster utf8 NOT_UTF8 tolerated: {} error events in {}B ({}%)",
- errors, probe.length,
- String.format(Locale.ROOT, "%.3f",
- 100.0 * errors / probe.length));
- } else if (errors > 0) {
- LOG.trace("mojibuster utf8 NOT_UTF8 NOT tolerated: {} error events in {}B ({}%)",
- errors, probe.length,
- String.format(Locale.ROOT, "%.3f",
- 100.0 * errors / probe.length));
+ private Charset applyStructuralRules(byte[] probe) {
+ Charset iso2022 = StructuralEncodingRules.detectIso2022(probe);
+ if (iso2022 != null) {
+ return iso2022;
+ }
+ if (probe.length >= 16) {
+ StructuralEncodingRules.Utf8Result utf8 = StructuralEncodingRules.checkUtf8(probe);
+ if (utf8 == StructuralEncodingRules.Utf8Result.DEFINITIVE_UTF8) {
+ return StandardCharsets.UTF_8;
}
}
- LOG.trace("mojibuster utf8Check={} tolerated={}", utf8, utf8Tolerated);
- // Emit a structural UTF-8 candidate when the grammar is clean (LIKELY)
- // OR essentially-UTF-8 (NOT_UTF8 with malformed bytes within tolerance —
- // a few corrupt bytes in otherwise-valid UTF-8). Both exclude legacy
- // CJK, which produces many grammar errors (measured: 0/321K labeled CJK
- // samples return LIKELY or fall within tolerance). The type-priority
- // sort in sortAndDedup then ranks this above NB's statistical pick.
- if (utf8 == StructuralEncodingRules.Utf8Result.LIKELY_UTF8 || utf8Tolerated) {
- pool.add(new EncodingResult(
- java.nio.charset.StandardCharsets.UTF_8,
- UTF8_STRUCTURAL_CONF, "UTF-8",
- EncodingResult.ResultType.STRUCTURAL));
- }
-
- // Conditionally strip HTML. Only if (a) content-type
- // suggests HTML/XML or is unknown, AND (b) the probe looks
- // ASCII-compatible (so we don't corrupt EBCDIC). If stripping
- // removes < 5% of bytes, treat as non-HTML and use original
- // bytes — protects against stray `<` bytes in plain text.
- byte[] nbInput = maybeStripHtml(probe, metadata);
-
- // Naive-Bayes top-K candidates — statistical.
- List<EncodingResult> nbResults = nb.detect(nbInput);
- if (LOG.isTraceEnabled()) {
- StringBuilder sb = new StringBuilder();
- for (EncodingResult r : nbResults) {
- if (sb.length() > 0) sb.append(", ");
- sb.append(r.getCharset().name())
- .append("@").append(String.format(Locale.ROOT, "%.2f", r.getConfidence()));
- }
- LOG.trace("mojibuster nb({}B input) -> [{}]", nbInput.length, sb);
- }
- for (EncodingResult r : nbResults) {
- String name = r.getCharset().name();
- // NOT_UTF8 disqualifier — applied unless the malformed-byte
- // fraction is tiny (see UTF8_MALFORMED_TOLERANCE).
- if ("UTF-8".equals(name)
- && utf8 == StructuralEncodingRules.Utf8Result.NOT_UTF8
- && !utf8Tolerated) {
- continue;
- }
- // False-CJK veto: a legacy multi-byte CJK pick whose bytes don't
- // validate (high decode-failure on the UTF-8-stripped remainder) is
- // Latin/Cyrillic/garbage mis-read as CJK. Drop it — if it was NB's
- // only candidate the pool empties and the windows-1252 fallback wins.
- if (CjkDecodeValidator.appliesTo(name)) {
- double failRate = CjkDecodeValidator.strippedFailureRate(nbInput, r.getCharset());
- if (failRate >= CJK_FAILURE_VETO_THRESHOLD) {
- LOG.trace("mojibuster veto {} (cjk decode-failure {}%)", name,
- String.format(Locale.ROOT, "%.2f", failRate * 100));
- continue;
- }
- }
- pool.add(r);
- }
-
- List<EncodingResult> ranked = sortAndDedup(pool);
- // Low-evidence Latin-sibling → windows-1252 rewrite. Runs
- // after sort so only the final top candidate is considered
- // for the rewrite, preserving lower-ranked siblings.
- List<EncodingResult> finalResults = applyLatinSiblingFallback(probe, ranked);
- // Never return an empty list. An empty result propagates up as
- // "Failed to detect the character encoding of a document" in
- // AutoDetectReader.detect, which kills parsing entirely. When
- // every layer has rejected its candidates (NOT_UTF8 disqualifier
- // dropped NB's only pick, NB returned no candidates at all,
- // wide-Unicode and UTF-16 specialists abstained), fall back to
- // the WHATWG default. Downstream JunkFilter / declarative
- // candidates can still override at low confidence.
- if (finalResults.isEmpty()) {
- LOG.trace("mojibuster pool empty -> windows-1252 fallback");
- return windows1252Fallback();
- }
- if (LOG.isTraceEnabled()) {
- StringBuilder sb = new StringBuilder();
- for (EncodingResult r : finalResults) {
- if (sb.length() > 0) sb.append(", ");
- sb.append(r.getCharset().name())
- .append("[").append(r.getResultType()).append("]")
- .append("@").append(String.format(Locale.ROOT, "%.2f", r.getConfidence()));
- }
- LOG.trace("mojibuster exit ({} results) [{}]", finalResults.size(), sb);
- }
- return finalResults;
+ // Wide-Unicode detection is handled in detectAll, which uses
+ // WideUnicodeDetector.analyze() to also capture invalidity flags.
+ return null;
}
/**
- * windows-1252 @ low confidence — used on empty / ASCII-only
- * probes so callers never see an empty result list.
+ * Returns true if the probe is pure 7-bit ASCII (no bytes ≥ 0x80, no null bytes).
+ * ASCII is compatible with virtually every single-byte encoding, so this is a
+ * heuristic — we report US-ASCII to honestly reflect what the probe showed.
+ * CharSoup will upgrade to a declared encoding (e.g. ISO-8859-15) when the document
+ * contains an explicit declaration consistent with the ASCII bytes.
*/
- private static List<EncodingResult> windows1252Fallback() {
- Charset cs = Charset.forName(WIN1252);
- return List.of(new EncodingResult(cs, FALLBACK_CONFIDENCE, WIN1252,
- EncodingResult.ResultType.STATISTICAL));
+ private static boolean isPureAscii(byte[] probe) {
+ return StructuralEncodingRules.checkAscii(probe) && !hasNullBytes(probe);
}
- /**
- * Detect ISO-2022-JP/KR/CN by escape sequence, then verify the decode is
- * real CJK (not a stray {@code ESC $} in ASCII text). Returns the charset
- * or {@code null}. Caller guarantees {@code probe} is pure 7-bit ASCII.
- */
- private static Charset detectIso2022Verified(byte[] probe) {
- Charset cs = StructuralEncodingRules.detectIso2022(probe);
- if (cs == null) {
- return null;
+ private static byte[] stripBom(byte[] probe) {
+ if (probe.length >= 4
+ && (probe[0] & 0xFF) == 0x00 && (probe[1] & 0xFF) == 0x00
+ && (probe[2] & 0xFF) == 0xFE && (probe[3] & 0xFF) == 0xFF) {
+ return Arrays.copyOfRange(probe, 4, probe.length); // UTF-32 BE
}
- String decoded;
- try {
- decoded = new String(probe, cs); // REPLACE on malformed/unmappable
- } catch (Exception e) {
- return null;
+ if (probe.length >= 4
+ && (probe[0] & 0xFF) == 0xFF && (probe[1] & 0xFF) == 0xFE
+ && (probe[2] & 0xFF) == 0x00 && (probe[3] & 0xFF) == 0x00) {
+ return Arrays.copyOfRange(probe, 4, probe.length); // UTF-32 LE
}
- int cjk = 0;
- int fffd = 0;
- for (int i = 0; i < decoded.length(); ) {
- int cp = decoded.codePointAt(i);
- i += Character.charCount(cp);
- if (cp == 0xFFFD) {
- fffd++;
- } else if (isCjkChar(cp)) {
- cjk++;
- }
+ if (probe.length >= 3
+ && (probe[0] & 0xFF) == 0xEF && (probe[1] & 0xFF) == 0xBB
+ && (probe[2] & 0xFF) == 0xBF) {
+ return Arrays.copyOfRange(probe, 3, probe.length); // UTF-8
}
- if (cjk >= ISO2022_MIN_CJK
- && fffd <= decoded.length() * ISO2022_MAX_FFFD_RATE) {
- return cs;
+ if (probe.length >= 2
+ && (probe[0] & 0xFF) == 0xFE && (probe[1] & 0xFF) == 0xFF) {
+ return Arrays.copyOfRange(probe, 2, probe.length); // UTF-16 BE
}
- return null;
- }
-
- /** Han / kana / hangul / CJK punctuation — the scripts ISO-2022-JP/KR/CN carry. */
- private static boolean isCjkChar(int cp) {
- return (cp >= 0x3040 && cp <= 0x30FF) // hiragana + katakana
- || (cp >= 0x4E00 && cp <= 0x9FFF) // CJK unified
- || (cp >= 0x3400 && cp <= 0x4DBF) // CJK ext A
- || (cp >= 0xAC00 && cp <= 0xD7A3) // hangul syllables
- || (cp >= 0xFF66 && cp <= 0xFF9F) // halfwidth katakana
- || (cp >= 0x3000 && cp <= 0x303F); // CJK symbols/punctuation
+ if (probe.length >= 2
+ && (probe[0] & 0xFF) == 0xFF && (probe[1] & 0xFF) == 0xFE) {
+ return Arrays.copyOfRange(probe, 2, probe.length); // UTF-16 LE
+ }
+ return probe;
}
- /**
- * Pure 7-bit ASCII test: no bytes ≥ 0x80 and no null bytes.
- * Null-byte exclusion prevents misclassifying UTF-16/32 content
- * whose bytes happen to be all < 0x80 (all-Cyrillic UTF-16-LE
- * would satisfy the high-byte test alone).
- */
- private static boolean isPureAscii(byte[] probe) {
+ private static boolean hasNullBytes(byte[] probe) {
for (byte b : probe) {
- int c = b & 0xFF;
- if (c == 0 || c >= 0x80) {
- return false;
+ if (b == 0) {
+ return true;
}
}
- return true;
+ return false;
}
/**
- * Resolve UTF-16 to LE or BE once NB has called it "UTF-16".
+ * Return the top-N charset predictions as {@link EncodingResult}s in
+ * descending confidence order.
*
- * <p>Two deterministic tests:
+ * <p>The pipeline is:
* <ol>
- * <li>Null-density: count null bytes in even-offset positions
- * vs odd-offset positions. For ASCII-in-UTF-16-LE the
- * high byte is 0x00 at odd positions; for BE it's at even
- * positions. If one column is clearly null-dominant, that
- * column indicates the endianness.</li>
- * <li>Codepoint validity fallback: for ambiguous probes (pure
- * CJK UTF-16, no nulls in either column) count how many
- * 16-bit codepoints under LE vs BE interpretation land in
- * assigned Unicode BMP ranges (non-PUA, non-unassigned).
- * Whichever interpretation yields more valid codepoints
- * wins.</li>
+ * <li>Structural gates (ISO-2022, ASCII) — definitive, no model needed.</li>
+ * <li>Statistical model — covers all charsets including EBCDIC variants
+ * (IBM420-ltr/rtl, IBM424-ltr/rtl, IBM500, IBM1047) as direct labels.</li>
* </ol>
+ * </p>
*
- * <p>Also honors the {@code invalidUtf16Le}/{@code invalidUtf16Be}
- * flags from {@link WideUnicodeDetector} — if either endianness
- * is structurally invalid (surrogate-pair violation), the other
- * wins by default.
- *
- * @return the resolved charset, or {@code null} if the probe is
- * structurally invalid under both interpretations
+ * @param probe raw bytes to analyse
+ * @param topN maximum number of results
+ * @return results sorted by confidence descending, at most {@code topN} entries
*/
- private static java.nio.charset.Charset disambiguateUtf16(byte[] probe,
- boolean invalidLe,
- boolean invalidBe) {
- if (invalidLe && invalidBe) {
- return null;
+ public List<EncodingResult> detectAll(byte[] probe, int topN) {
+ boolean gates = enabledRules.contains(Rule.STRUCTURAL_GATES);
+
+ // Wide-Unicode analysis: positive detection and/or invalidity flags.
+ // Must run BEFORE isPureAscii: scripts like Cyrillic in UTF-16-LE have
+ // all bytes < 0x80 with no nulls, so isPureAscii would misclassify them.
+ WideUnicodeDetector.Result wideResult = gates
+ ? WideUnicodeDetector.analyze(probe)
+ : WideUnicodeDetector.Result.EMPTY;
+ if (wideResult.charset != null) {
+ return singleResult(wideResult.charset.name(), 1.0f,
+ EncodingResult.ResultType.STRUCTURAL, topN);
+ }
+
+ if (gates) {
+ // Structural rules: byte-grammar proof (ISO-2022, sparse UTF-8).
+ Charset structural = applyStructuralRules(probe);
+ if (structural != null) {
+ return singleResult(structural.name(), 1.0f,
+ EncodingResult.ResultType.STRUCTURAL, topN);
+ }
+ // Pure ASCII: no high bytes seen in the probe. We default to windows-1252 —
+ // the WHATWG-canonical "Western Latin, I saw only ASCII bytes" encoding.
+ // HTML5 explicitly defines ISO-8859-1 as an alias for windows-1252, making
+ // windows-1252 the right default: it is the correct superset, it avoids the
+ // ambiguity between ISO-8859-1 and windows-1252 in the 0x80–0x9F range, and
+ // it keeps the no-hint path consistent with the HTML-spec path (where a stated
+ // "charset=iso-8859-1" is normalized to windows-1252 by StandardHtmlEncodingDetector).
+ // CharSoup will further upgrade to any compatible DECLARATIVE encoding
+ // (e.g. an HTML meta charset=UTF-8) when one is present and consistent.
+ if (isPureAscii(probe)) {
+ return singleResult("windows-1252", 0.5f,
+ EncodingResult.ResultType.STATISTICAL, topN);
+ }
}
- if (invalidLe) {
- return java.nio.charset.Charset.forName("UTF-16BE");
- }
- if (invalidBe) {
- return java.nio.charset.Charset.forName("UTF-16LE");
- }
- int nullEven = 0;
- int nullOdd = 0;
- for (int i = 0; i + 1 < probe.length; i += 2) {
- if (probe[i] == 0) nullEven++;
- if (probe[i + 1] == 0) nullOdd++;
- }
- // Clear null-density winner: one column is ≥ 3× more
- // null-dominant than the other.
- if (nullEven >= 3 * Math.max(1, nullOdd)) {
- return java.nio.charset.Charset.forName("UTF-16BE");
- }
- if (nullOdd >= 3 * Math.max(1, nullEven)) {
- return java.nio.charset.Charset.forName("UTF-16LE");
- }
- // Ambiguous on null-density (CJK content). Count valid BMP
- // codepoints under each interpretation. A "valid" codepoint
- // is any non-zero codepoint outside the surrogate range
- // (0xD800-0xDFFF) — for CJK content most bytes map into
- // assigned blocks, and random-byte-interpreted-as-UTF-16
- // produces many surrogate-range halves.
- int validLe = 0;
- int validBe = 0;
- for (int i = 0; i + 1 < probe.length; i += 2) {
- int lo = probe[i] & 0xFF;
- int hi = probe[i + 1] & 0xFF;
- int leCp = (hi << 8) | lo;
- int beCp = (lo << 8) | hi;
- if (leCp != 0 && (leCp < 0xD800 || leCp > 0xDFFF)) {
- validLe++;
+
+ boolean excludeUtf8 = gates
+ && StructuralEncodingRules.checkUtf8(probe) == StructuralEncodingRules.Utf8Result.NOT_UTF8;
+
+ List<EncodingResult> results = runModel(probe, excludeUtf8,
+ wideResult.invalidUtf16Be, wideResult.invalidUtf16Le, topN);
+
+ // If the model had no evidence (probe too short or all tokens filtered), fall back to
+ // windows-1252 at very low confidence rather than returning empty and letting
+ // AutoDetectReader throw. CharSoup will override this with any DECLARATIVE hint.
+ if (results.isEmpty()) {
+ return singleResult("windows-1252", 0.1f, EncodingResult.ResultType.STATISTICAL, topN);
+ }
+ return results;
+ }
+
+ private List<EncodingResult> runModel(byte[] probe, boolean excludeUtf8,
+ boolean excludeUtf16Be, boolean excludeUtf16Le,
+ int topN) {
+ int[][] quadrantFeatures = extractor.extractByQuadrant(probe);
+ float[] logits = model.predictLogitsQuadrant(quadrantFeatures, quadrantWeights);
+
+ for (int i = 0; i < logits.length; i++) {
+ String lbl = model.getLabel(i);
+ if (excludeUtf8 && "UTF-8".equalsIgnoreCase(lbl)) {
+ logits[i] = Float.NEGATIVE_INFINITY;
+ }
+ if (excludeUtf16Be && lbl.equalsIgnoreCase("UTF-16-BE")) {
+ logits[i] = Float.NEGATIVE_INFINITY;
}
- if (beCp != 0 && (beCp < 0xD800 || beCp > 0xDFFF)) {
- validBe++;
+ if (excludeUtf16Le && lbl.equalsIgnoreCase("UTF-16-LE")) {
+ logits[i] = Float.NEGATIVE_INFINITY;
}
}
- return validLe >= validBe
- ? java.nio.charset.Charset.forName("UTF-16LE")
- : java.nio.charset.Charset.forName("UTF-16BE");
+
+ List<EncodingResult> results = selectByLogitGap(model, logits, topN);
+
+ // CJK grammar filtering runs first so that grammar-killed charsets
+ // (e.g. x-EUC-TW on a Shift_JIS probe) don't consume MIN_CANDIDATES
+ // slots that should go to viable alternatives.
+ if (enabledRules.contains(Rule.CJK_GRAMMAR)) {
+ results = refineCjkResults(probe, results);
+ }
+
+ // On short probes, ensure enough candidates survive for CharSoup to
+ // arbitrate. Grammar-killed CJK charsets are skipped so they don't
+ // consume slots meant for viable alternatives.
+ if (probe.length < SHORT_PROBE_THRESHOLD && results.size() < MIN_CANDIDATES) {
+ boolean grammar = enabledRules.contains(Rule.CJK_GRAMMAR);
+ results = selectAtLeast(model, logits, MIN_CANDIDATES, probe, grammar);
+ }
+
+ if (enabledRules.contains(Rule.ISO_TO_WINDOWS) && StructuralEncodingRules.hasC1Bytes(probe)) {
+ results = upgradeIsoToWindows(results);
+ }
+ if (enabledRules.contains(Rule.CRLF_TO_WINDOWS) && StructuralEncodingRules.hasCrlfBytes(probe)) {
+ results = upgradeIsoToWindows(results);
+ }
+ if (enabledRules.contains(Rule.GB_FOUR_BYTE_UPGRADE)
+ && StructuralEncodingRules.hasGb18030FourByteSequence(probe)) {
+ results = upgradeGbToGb18030(results);
+ }
+ // Trim to topN after all rules have fired, not before.
+ return results.subList(0, Math.min(topN, results.size()));
}
/**
- * Relabel the top result to windows-1252 when top is a non-1252
- * member of {@link CharsetConfusables#SBCS_LATIN_FAMILY} and
- * windows-1252 decodes at least as many Unicode-Letter codepoints
- * at high-byte positions as the candidate does.
- *
- * <p>Rationale: NB has a residual bias toward MacRoman / IBM850 /
- * IBM852 / ISO-8859-X siblings on Western European text where the
- * underlying bytes are actually windows-1252. Under the wrong
- * sibling, the high bytes decode to symbols / punctuation /
- * unassigned codepoints — not letters. Under the correct
- * windows-1252, they decode to letters (ä, ö, ü, é, ñ, …). So a
- * letter-count compare directly distinguishes "this is actually
- * windows-1252 mis-labeled" from "this is genuinely MacRoman".
- * A real MacRoman document with bytes like 0x88 (à in MacRoman)
- * decodes to a letter under MacRoman but a symbol (ˆ) under
- * windows-1252 — letter compare correctly keeps MacRoman.</p>
- *
- * <p>Replaces the prior strict gates ({@code countHighBytes < 5}
- * AND {@code byteIdenticalOnProbe(top, win-1252)}) which left
- * ≥ 5-high-byte Western European pages unprotected.</p>
+ * Maximum confidence assigned to a STATISTICAL model result. Kept strictly
+ * below 1.0 so that statistical results are never mistaken for STRUCTURAL or
+ * DECLARATIVE evidence by downstream arbitrators (e.g. CharSoupEncodingDetector).
+ * The top result from the logit-gap window always maps to this value.
*/
- private static List<EncodingResult> applyLatinSiblingFallback(byte[] probe,
- List<EncodingResult> ranked) {
- if (ranked.isEmpty()) {
- return ranked;
- }
- EncodingResult top = ranked.get(0);
- String topName = top.getCharset().name();
- if (WIN1252.equals(topName)) {
- return ranked;
- }
- // Scoped to Western European Latin family only. Central
- // European (win-1250 / ISO-8859-2 / IBM852), Baltic (win-1257 /
- // ISO-8859-13), Turkish (win-1254), Maltese (ISO-8859-3),
- // Romanian (ISO-8859-16) etc. are NOT in scope — those
- // represent different language regions, and rewriting them to
- // windows-1252 corrupts genuine non-Western content (the
- // letter-count compare ties on most of their Latin letters
- // because Unicode classifies both decodings as Letters,
- // misleading the rule into a wrong flip).
- if (!CharsetConfusables.WESTERN_LATIN_FAMILY.contains(topName)) {
- return ranked;
- }
- Charset win1252 = Charset.forName(WIN1252);
- int winLetters = HighByteLetterStats.countCasedHighByteLetters(probe, win1252);
- int topLetters = HighByteLetterStats.countCasedHighByteLetters(probe, top.getCharset());
- // Tie goes to windows-1252 (WHATWG-canonical default).
- if (winLetters < topLetters) {
- return ranked;
- }
- List<EncodingResult> out = new java.util.ArrayList<>(ranked.size());
- out.add(new EncodingResult(win1252, top.getConfidence(), WIN1252,
- top.getResultType()));
- for (int i = 1; i < ranked.size(); i++) {
- out.add(ranked.get(i));
- }
- return out;
- }
+ private static final float MAX_STATISTICAL_CONFIDENCE = 0.99f;
/**
- * Sort pool by trust type (STRUCTURAL > DECLARATIVE > STATISTICAL),
- * then by confidence within a type, and deduplicate by charset name keeping
- * the first (highest-priority) instance. Type priority is load-bearing:
- * NB pins its statistical winner to confidence 1.0, so a structural
- * candidate (UTF-8 grammar proof, UTF-32 codepoint validity) emitted below
- * 1.0 would otherwise lose the sort to NB despite being the stronger signal.
+ * Minimum number of candidates always passed to downstream rules and CharSoup,
+ * regardless of the logit gap. When the top candidate has a very high logit
+ * and all others fall outside the gap window, CharSoup would see only one option
+ * and cannot arbitrate. Ensuring at least this many candidates lets grammar rules
+ * and language signal correct a dominant-but-wrong top candidate.
*/
- private static List<EncodingResult> sortAndDedup(List<EncodingResult> pool) {
- if (pool.isEmpty()) {
- return Collections.emptyList();
+ /**
+ * Probes shorter than this (in bytes) may produce a single dominant but wrong
+ * candidate (the logit gap window collapses to 1 result). Below this threshold,
+ * {@link #selectAtLeast} supplements the gap-window results up to {@link #MIN_CANDIDATES}
+ * so that grammar rules and CharSoup have real alternatives to evaluate.
+ */
+ private static final int SHORT_PROBE_THRESHOLD = 50;
+
+ /** Max results returned to CharSoup on short probes (<=SHORT_PROBE_THRESHOLD). */
+ private static final int TOP_N_SHORT = 3;
+
+ /** Max results returned to CharSoup on long probes. */
+ private static final int TOP_N_LONG = 1;
+
+ /** Minimum candidates guaranteed to downstream rules on short probes. */
+ private static final int MIN_CANDIDATES = 3;
+
+ /**
+ * Same as {@link #selectByLogitGap} but guarantees at least {@code minN} results
+ * by extending the window to include the next-best candidates by raw logit rank.
+ * CJK charsets that fail grammar validation are skipped so they don't consume
+ * slots meant for viable alternatives.
+ */
+ private static List<EncodingResult> selectAtLeast(LinearModel m, float[] logits,
+ int minN, byte[] probe,
+ boolean applyGrammar) {
+ List<int[]> all = new ArrayList<>();
+ for (int i = 0; i < logits.length; i++) {
+ if (labelToCharset(m.getLabel(i)) != null) {
+ all.add(new int[]{i});
+ }
}
- pool.sort((a, b) -> {
- int byType = Integer.compare(typeRank(a.getResultType()),
- typeRank(b.getResultType()));
- return byType != 0 ? byType
- : Float.compare(b.getConfidence(), a.getConfidence());
- });
- java.util.Set<String> seen = new java.util.LinkedHashSet<>();
- List<EncodingResult> out = new java.util.ArrayList<>(pool.size());
- for (EncodingResult r : pool) {
- if (seen.add(r.getCharset().name())) {
- out.add(r);
+ all.sort((a, b) -> Float.compare(logits[b[0]], logits[a[0]]));
+
+ float maxLogit = all.isEmpty() ? 0f : logits[all.get(0)[0]];
+ List<EncodingResult> results = new ArrayList<>(minN);
+ for (int rank = 0; rank < all.size() && results.size() < minN; rank++) {
+ int i = all.get(rank)[0];
+ String lbl = m.getLabel(i);
+ Charset cs = labelToCharset(lbl);
+ if (applyGrammar && CjkEncodingRules.isCjk(cs)
+ && CjkEncodingRules.match(probe, cs) == 0) {
+ continue;
}
+ float conf = maxLogit > 0
+ ? Math.max(0f, logits[i] / maxLogit) * MAX_STATISTICAL_CONFIDENCE
+ : 0f;
+ results.add(new EncodingResult(cs, conf, lbl, EncodingResult.ResultType.STATISTICAL));
}
- return out;
+ return results;
}
- /** Trust-type priority for sorting: lower wins. */
- private static int typeRank(EncodingResult.ResultType t) {
- switch (t) {
- case STRUCTURAL:
- return 0;
- case DECLARATIVE:
- return 1;
- default:
- return 2;
+ private static List<EncodingResult> selectByLogitGap(LinearModel m, float[] logits, int topN) {
+ float maxLogit = Float.NEGATIVE_INFINITY;
+ for (float l : logits) {
+ if (l > maxLogit) {
+ maxLogit = l;
+ }
+ }
+ float floor = maxLogit - LOGIT_GAP;
+ List<EncodingResult> results = new ArrayList<>();
+ for (int i = 0; i < logits.length; i++) {
+ if (logits[i] >= floor) {
+ // Scale to [0, MAX_STATISTICAL_CONFIDENCE] so no statistical result
+ // reaches 1.0, keeping the range unambiguously below STRUCTURAL/DECLARATIVE.
+ float conf = ((logits[i] - floor) / LOGIT_GAP) * MAX_STATISTICAL_CONFIDENCE;
+ String lbl = m.getLabel(i);
+ Charset cs = labelToCharset(lbl);
+ if (cs != null) {
+ results.add(new EncodingResult(cs, conf, lbl,
+ EncodingResult.ResultType.STATISTICAL));
+ }
+ }
}
+ results.sort((a, b) -> Float.compare(b.getConfidence(), a.getConfidence()));
+ return results.subList(0, Math.min(topN, results.size()));
}
/**
- * Returns stripped bytes if the probe contains well-formed HTML/XML
- * tags; otherwise returns the original probe unchanged.
+ * When the probe contains C1 bytes (0x80–0x9F), any ISO-8859-X result is
+ * invalid — those bytes are C1 control codes in every ISO-8859-X standard.
+ * This method replaces each such result with its Windows-12XX equivalent
+ * from {@link CharsetConfusables#ISO_TO_WINDOWS}, preserving confidence.
*
- * <p>Two guards:</p>
- * <ol>
- * <li>If content-type is set and doesn't suggest HTML/XML, skip
- * stripping entirely (trust the label).</li>
- * <li>If content-type is HTML/XML or absent, RUN the stripper —
- * but only use its output if it successfully parsed at least
- * one well-formed tag. Zero tags means the probe is either
- * plain text (no markup to strip) or a non-ASCII-compatible
- * encoding where stray {@code 0x3C} bytes don't form valid
- * tag structures.</li>
- * </ol>
+ * <p>This is a post-{@code collapseGroups} correction: the model has
+ * already identified the right script family (Western European, Cyrillic,
+ * Arabic, …); we are only fixing the ISO-vs-Windows attribution within
+ * that family.</p>
+ */
+ /**
+ * For each CJK encoding in {@code results}, runs the corresponding grammar
+ * walker and adjusts the result:
+ * <ul>
+ * <li>Grammar score 0 (bad byte sequences) → drop the result; the model
+ * was wrong about this encoding</li>
+ * <li>Grammar score > 10 (enough valid multi-byte chars) → replace
+ * model confidence with grammar confidence</li>
+ * <li>Grammar score 10 (valid but too few chars to be sure) → keep
+ * model confidence; grammar cannot add information</li>
+ * </ul>
+ * Results are re-sorted after adjustment since grammar scores may reorder
+ * candidates. Non-CJK results pass through unchanged.
*/
- private static byte[] maybeStripHtml(byte[] probe, Metadata metadata) {
- String contentType = null;
- if (metadata != null) {
- // Prefer user override, then parser override, then magic, then header.
- contentType = metadata.get(TikaCoreProperties.CONTENT_TYPE_USER_OVERRIDE);
- if (contentType == null) {
- contentType = metadata.get(TikaCoreProperties.CONTENT_TYPE_PARSER_OVERRIDE);
+ /**
+ * Refines CJK candidates using grammar walkers, and on short probes drops
+ * single-byte alternatives when a CJK charset validates cleanly.
+ *
+ * <p><b>Short-probe promotion rule</b> (probe < {@link #SHORT_PROBE_THRESHOLD}):
+ * if any CJK charset scores ≥ {@link CjkEncodingRules#CLEAN_SHORT_PROBE_CONFIDENCE}
+ * (bad == 0, at least one valid 2-byte pair), all non-CJK results are removed.
+ * Single-byte encodings have no structural constraints — they silently accept
+ * any byte sequence. A CJK parser that consumes all high bytes without errors
+ * is providing genuine structural evidence, and that evidence should win over
+ * the byte-ngram model's single-byte predictions on short probes.</p>
+ *
+ * <p><b>Long-probe rule</b>: grammar score replaces model confidence when the
+ * grammar has enough signal (score > 10 in the old convention, which is now
+ * always satisfied for bad==0 probes via the new confidence formula).</p>
+ */
+ private static List<EncodingResult> refineCjkResults(byte[] probe,
+ List<EncodingResult> results) {
+ boolean hasCjk = false;
+ for (EncodingResult er : results) {
+ if (CjkEncodingRules.isCjk(er.getCharset())) {
+ hasCjk = true;
+ break;
}
- if (contentType == null) {
- contentType = metadata.get(TikaCoreProperties.CONTENT_TYPE_MAGIC_DETECTED);
+ }
+ if (!hasCjk) {
+ return results;
+ }
+
+ // Grammar-filter CJK charsets: drop those that produce invalid byte sequences
+ // (score == 0 means the grammar walker found bad bytes — the model was wrong).
+ // Charsets that pass grammar keep their model confidence unchanged so that
+ // all candidates remain on the same sigmoid scale for CharSoup to compare.
+ // Non-CJK charsets pass through unchanged.
+ List<EncodingResult> refined = new ArrayList<>(results.size());
+ for (EncodingResult er : results) {
+ if (!CjkEncodingRules.isCjk(er.getCharset())) {
+ refined.add(er);
+ continue;
}
- if (contentType == null) {
- contentType = metadata.get(Metadata.CONTENT_TYPE);
+ int score = CjkEncodingRules.match(probe, er.getCharset());
+ if (score == 0) {
+ // grammar rejects this charset entirely — drop it
+ continue;
}
+ // Grammar passes: keep the model's sigmoid confidence so everything
+ // is on the same scale when CharSoup compares candidates.
+ refined.add(er);
}
- if (!shouldTryStrip(contentType)) {
- return probe;
- }
- // Strip into a fresh destination buffer so `probe` stays
- // untouched — essential for the tag-count-zero backoff.
- byte[] dst = new byte[probe.length];
- HtmlByteStripper.Result stripped =
- HtmlByteStripper.strip(probe, 0, probe.length, dst, 0);
- if (stripped.tagCount < MIN_TAG_COUNT_TO_USE_STRIP
- && stripped.entityCount < MIN_ENTITY_COUNT_TO_USE_STRIP) {
- // No well-formed tags AND not enough entities to be markup —
- // probe isn't markup (or the bytes don't parse as markup in
- // any ASCII-compatible reading). Use original.
- return probe;
- }
- byte[] trimmed = new byte[stripped.length];
- System.arraycopy(dst, 0, trimmed, 0, stripped.length);
- return trimmed;
+ return refined;
}
/**
- * Strip if content-type suggests HTML/XML markup, or is absent
- * (mime detection hasn't happened yet — tag-count guard provides
- * the encoding-agnostic safety net).
+ * When a GB18030-specific 4-byte sequence has been found in the probe,
+ * any GBK or GB2312 result is upgraded to GB18030. The confidence is
+ * preserved; only the charset label changes.
*/
- private static boolean shouldTryStrip(String contentType) {
- if (contentType == null) {
- return true;
+ private static List<EncodingResult> upgradeGbToGb18030(List<EncodingResult> results) {
+ Charset gb18030 = labelToCharset("GB18030");
+ if (gb18030 == null) {
+ return results;
+ }
+ List<EncodingResult> upgraded = new ArrayList<>(results.size());
+ for (EncodingResult er : results) {
+ String name = er.getCharset().name();
+ if ("GBK".equalsIgnoreCase(name) || "GB2312".equalsIgnoreCase(name)) {
+ // Preserve the original detected label; only the decode charset changes.
+ upgraded.add(new EncodingResult(gb18030, er.getConfidence(), er.getLabel()));
+ } else {
+ upgraded.add(er);
+ }
}
- String lower = contentType.toLowerCase(Locale.ROOT);
- return lower.contains("html") || lower.contains("xml");
+ return upgraded;
}
- private static byte[] readProbe(TikaInputStream tis, ParseContext parseContext)
- throws IOException {
- EncodingDetectorContext context =
- parseContext == null ? null : parseContext.get(EncodingDetectorContext.class);
- EncodingProbeCache cache = context == null ? null : context.getProbeCache();
- if (cache != null) {
- byte[] cached = cache.get(PROBE_CONTENT_TARGET, PROBE_RAW_CAP);
- if (cached != null) {
- return cached;
+ private static List<EncodingResult> upgradeIsoToWindows(List<EncodingResult> results) {
+ List<EncodingResult> upgraded = new ArrayList<>(results.size());
+ for (EncodingResult er : results) {
+ String windowsName = CharsetConfusables.ISO_TO_WINDOWS.get(er.getCharset().name());
+ if (windowsName != null) {
+ Charset windowsCs = labelToCharset(windowsName);
+ // Preserve the original detected label (e.g. "ISO-8859-1") so callers
+ // can see what was detected; getCharset() returns the superset to decode with.
+ upgraded.add(new EncodingResult(
+ windowsCs != null ? windowsCs : er.getCharset(),
+ er.getConfidence(),
+ er.getLabel()));
+ } else {
+ upgraded.add(er);
}
}
- byte[] probe = AdaptiveProbe.read(tis, PROBE_CONTENT_TARGET, PROBE_RAW_CAP);
- if (cache != null) {
- cache.put(probe, PROBE_CONTENT_TARGET, PROBE_RAW_CAP);
+ return upgraded;
+ }
+
+ private static List<EncodingResult> singleResult(String label, float confidence,
+ EncodingResult.ResultType type, int topN) {
+ if (topN <= 0) {
+ return Collections.emptyList();
}
- return probe;
+ Charset cs = labelToCharset(label);
+ if (cs == null) {
+ return Collections.emptyList();
+ }
+ return List.of(new EncodingResult(cs, confidence, label, type));
}
+
+ /**
+ * Resolve a model label string to a Java {@link Charset}, applying the
+ * {@link #LABEL_TO_JAVA_NAME} alias map first so that labels like
+ * {@code "x-mac-cyrillic"} or {@code "IBM424-ltr"} survive the lookup.
+ *
+ * @return the resolved charset, or {@code null} if no mapping exists
+ */
+ public static Charset labelToCharset(String label) {
+ String javaName = LABEL_TO_JAVA_NAME.getOrDefault(label, label);
+ try {
+ return Charset.forName(javaName);
+ } catch (IllegalArgumentException e) {
+ return null;
+ }
+ }
+
+ private static byte[] readProbe(TikaInputStream is, int maxBytes) throws IOException {
+ is.mark(maxBytes);
+ try {
+ byte[] buf = new byte[maxBytes];
+ int total = 0;
+ int n;
+ while (total < buf.length &&
+ (n = is.read(buf, total, buf.length - total)) != -1) {
+ total += n;
+ }
+ if (total == buf.length) {
+ return buf;
+ }
+ byte[] trimmed = new byte[total];
+ System.arraycopy(buf, 0, trimmed, 0, total);
+ return trimmed;
+ } finally {
+ is.reset();
+ }
+ }
+
+ public LinearModel getModel() {
+ return model;
+ }
+
+ public EnumSet<Rule> getEnabledRules() {
+ return EnumSet.copyOf(enabledRules.isEmpty() ? EnumSet.noneOf(Rule.class) : enabledRules);
+ }
+
}
diff --git a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/NaiveBayesBigramEncodingDetector.java b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/NaiveBayesBigramEncodingDetector.java
index da87d46b74..7db1c34796 100644
--- a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/NaiveBayesBigramEncodingDetector.java
+++ b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/java/org/apache/tika/ml/chardetect/NaiveBayesBigramEncodingDetector.java
@@ -239,6 +239,8 @@ public class NaiveBayesBigramEncodingDetector implements EncodingDetector {
*/
private final double[] perClassDequant;
private final int numClasses;
+ // BETA-1 WORKAROUND: GB18030 class index for markup-bigram suppression — see isOffendingAscii.
+ private final int gb18030ClassIdx;
public NaiveBayesBigramEncodingDetector(Path modelPath) throws IOException {
this(Files.newInputStream(modelPath));
@@ -364,6 +366,16 @@ public class NaiveBayesBigramEncodingDetector implements EncodingDetector {
for (int c = 0; c < numClasses; c++) {
perClassDequant[c] = (double) scale[c] * idfScale;
}
+
+ // Locate GB18030's class index for the markup-bigram suppression.
+ int gb18030Idx = -1;
+ for (int c = 0; c < numClasses; c++) {
+ if ("GB18030".equalsIgnoreCase(labels[c])) {
+ gb18030Idx = c;
+ break;
+ }
+ }
+ this.gb18030ClassIdx = gb18030Idx;
}
}
@@ -379,6 +391,13 @@ public class NaiveBayesBigramEncodingDetector implements EncodingDetector {
|| b == 0x0d || b == 0x20;
}
+ // BETA-1 WORKAROUND: bigrams containing these HTML/JS markup chars are
+ // over-represented in GB18030 training data and cause misclassification.
+ // Suppressed only for GB18030 in scoreClassesAndCount.
+ static boolean isOffendingAscii(int b) {
+ return b == '{' || b == '"' || b == '&' || b == '<' || b == '>';
+ }
+
public List<EncodingResult> detect(byte[] probe) {
ScoreResult sr = scoreClassesAndCount(probe);
if (sr == null) {
@@ -554,9 +573,17 @@ public class NaiveBayesBigramEncodingDetector implements EncodingDetector {
double countTimesIdf = tf * w;
int base = bigram * numClasses;
+ // BETA-1 WORKAROUND: skip this bigram for GB18030 if either byte is
+ // an HTML/JS markup char that inflates GB18030 scores on Latin pages.
+ int bg0 = (bigram >> 8) & 0xFF;
+ int bg1 = bigram & 0xFF;
+ boolean skipGb18030 = gb18030ClassIdx >= 0
+ && (isOffendingAscii(bg0) || isOffendingAscii(bg1));
+
if (!applyCap) {
// Fast path: no cap, just accumulate.
for (int c = 0; c < numClasses; c++) {
+ if (skipGb18030 && c == gb18030ClassIdx) continue;
score[c] += logP8[base + c] * countTimesIdf * perClassDequant[c];
}
continue;
@@ -602,6 +629,7 @@ public class NaiveBayesBigramEncodingDetector implements EncodingDetector {
double capValue = bestCrossCohort + CAP_PER_BIGRAM_NATS;
boolean clip = max > capValue;
for (int c = 0; c < numClasses; c++) {
+ if (skipGb18030 && c == gb18030ClassIdx) continue;
double v = contributions[c];
if (clip && v > capValue) {
v = capValue;
diff --git a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
index 22e3b25428..dabb7ab55b 100644
--- a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
+++ b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
@@ -13,6 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Intentionally empty: MojibusterEncodingDetector is no longer part of the
-# default Tika encoding-detection chain. Users who want it must register it
-# explicitly via tika-config.
+org.apache.tika.ml.chardetect.MojibusterEncodingDetector
diff --git a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/test/java/org/apache/tika/ml/chardetect/CjkDecodeValidatorTest.java b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/test/java/org/apache/tika/ml/chardetect/CjkDecodeValidatorTest.java
index 14e074212a..7629129ca9 100644
--- a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/test/java/org/apache/tika/ml/chardetect/CjkDecodeValidatorTest.java
+++ b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/test/java/org/apache/tika/ml/chardetect/CjkDecodeValidatorTest.java
@@ -69,6 +69,27 @@ public class CjkDecodeValidatorTest {
assertEquals(-1.0, CjkDecodeValidator.strippedFailureRate(b, Charset.forName("GB18030")));
}
+ /**
+ * Pure UTF-8 file (zero legacy CJK bytes, many UTF-8 multi-byte sequences):
+ * strippedFailureRate must return 1.0 so the CJK veto fires for all CJK charsets.
+ * This covers the regression where Shift_JIS / Big5-HKSCS / GB18030 were wrongly
+ * chosen over UTF-8 STRUCTURAL for pure-UTF-8 Latin/Cyrillic/etc. files.
+ */
+ @Test
+ public void pureUtf8ReturnsCjkVeto() throws Exception {
+ // Croatian text encoded as UTF-8 — all high bytes are valid UTF-8 sequences,
+ // none are legacy CJK lead bytes.
+ byte[] b = ("Ovo je čist UTF-8 tekst s hrvatskim slovima: "
+ + "čćžšđ ČĆŽŠĐ. Ponavljamo dovoljno puta da premašimo prag od "
+ + "trideset UTF-8 sekvenci: šššššššššš čččččččččč đđđđđđđđđđ.")
+ .getBytes("UTF-8");
+ for (String cs : new String[]{"Shift_JIS", "Big5-HKSCS", "GB18030", "EUC-JP"}) {
+ double rate = CjkDecodeValidator.strippedFailureRate(b, Charset.forName(cs));
+ assertEquals(1.0, rate, 0.0,
+ "pure UTF-8 must return 1.0 (veto) for " + cs + ", got " + rate);
+ }
+ }
+
@Test
public void appliesToLegacyCjkButNotIso2022OrLatin() {
assertTrue(CjkDecodeValidator.appliesTo("GB18030"));
diff --git a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/test/java/org/apache/tika/ml/chardetect/ZipFilenameDetectionTest.java b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/test/java/org/apache/tika/ml/chardetect/ZipFilenameDetectionTest.java
index 17a84dd9a8..73f7dfe5d6 100644
--- a/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/test/java/org/apache/tika/ml/chardetect/ZipFilenameDetectionTest.java
+++ b/tika-encoding-detectors/tika-encoding-detector-mojibuster/src/test/java/org/apache/tika/ml/chardetect/ZipFilenameDetectionTest.java
@@ -20,7 +20,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.apache.tika.detect.DefaultEncodingDetector;
@@ -59,7 +58,6 @@ public class ZipFilenameDetectionTest {
* sequentially on two entries differing only in byte 5 (0x31 vs 0x32), simulating
* what ZipParser does when iterating entries with the same ParseContext.
*/
- @Disabled("TIKA-4683: rolled-back chain (Html, Universal, Icu4j); Mojibuster no longer in default chain.")
@Test
public void fullPipelineDetectsBothSjisEntries() throws Exception {
DefaultEncodingDetector detector = new DefaultEncodingDetector();
@@ -80,7 +78,6 @@ public class ZipFilenameDetectionTest {
/**
* Full pipeline should detect GBK-encoded entry names as GB18030.
*/
- @Disabled("TIKA-4683: rolled-back chain (Html, Universal, Icu4j); Mojibuster no longer in default chain.")
@Test
public void fullPipelineDetectsGbkEntry() throws Exception {
DefaultEncodingDetector detector = new DefaultEncodingDetector();
diff --git a/tika-encoding-detectors/tika-encoding-detector-universal/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector b/tika-encoding-detectors/tika-encoding-detector-universal/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
index 2982e2584e..d00f541c45 100644
--- a/tika-encoding-detectors/tika-encoding-detector-universal/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
+++ b/tika-encoding-detectors/tika-encoding-detector-universal/src/main/resources/META-INF/services/org.apache.tika.detect.EncodingDetector
@@ -12,4 +12,5 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-org.apache.tika.parser.txt.UniversalEncodingDetector
+
+# Not in the default 4.x chain; enable in tika-config to use.
diff --git a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparerRunner.java b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparerRunner.java
index 3ffcc5a31d..9b48f06bf7 100644
--- a/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparerRunner.java
+++ b/tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/ExtractComparerRunner.java
@@ -92,6 +92,7 @@ public class ExtractComparerRunner {
.addOption(Option.builder("m").longOpt("maxExtractLength").hasArg().desc("maximum extract length").get())
.addOption(Option.builder("r").longOpt("report").desc("automatically run Report and tgz after Compare").get())
.addOption(Option.builder("rd").longOpt("reportsDir").hasArg().desc("directory for reports (default: 'reports')").get())
+ .addOption(Option.builder("z").longOpt("gzip").desc("gzip the H2 db file (<db>.mv.db.gz) after Compare for transfer; requires -d").get())
;
}
@@ -128,15 +129,23 @@ public class ExtractComparerRunner {
if (commandLine.hasOption('r')) {
String reportsDir = commandLine.getOptionValue("rd", "reports");
LOG.info("Running Report...");
- ResultsReporter.main(new String[]{"-d", dbPath, "-rd", reportsDir});
+ if (dbPath.startsWith("jdbc:")) {
+ ResultsReporter.main(new String[]{"-jdbc", dbPath, "-rd", reportsDir});
+ } else {
+ ResultsReporter.main(new String[]{"-d", dbPath, "-rd", reportsDir});
+ }
Path reportsDirPath = Paths.get(reportsDir);
if (Files.isDirectory(reportsDirPath)) {
- Path tgzPath = reportsDirPath.resolveSibling(reportsDir + ".tar.gz");
+ Path tgzPath = reportsDirPath.resolveSibling(reportsDirPath.getFileName() + ".tgz");
LOG.info("Creating {}", tgzPath);
createTarGz(reportsDirPath, tgzPath);
LOG.info("Reports archived to {}", tgzPath);
}
}
+
+ if (commandLine.hasOption('z')) {
+ gzipDb(dbPath, usesTempDb);
+ }
} finally {
if (usesTempDb && tempDbDir != null) {
deleteDirectory(tempDbDir);
@@ -263,6 +272,53 @@ public class ExtractComparerRunner {
}
}
+ /**
+ * Gzip the H2 db file (<dbPath>.mv.db -> <dbPath>.mv.db.gz) so it can be
+ * transferred. The db connection is already closed by {@link #execute} before
+ * this runs, so the file is unlocked. No-op (with a warning) when there is no
+ * on-disk file db to gzip: a temp db (no -d), or a non-file jdbc connection
+ * (e.g. mem/tcp). A {@code jdbc:h2:file:} URL is supported by extracting its
+ * file path.
+ */
+ private static void gzipDb(String dbPath, boolean usesTempDb) throws IOException {
+ if (usesTempDb) {
+ LOG.warn("-z (gzip) ignored: no -d db specified, so there is no db file to transfer");
+ return;
+ }
+ String filePath = dbPath;
+ if (dbPath.startsWith("jdbc:")) {
+ String prefix = "jdbc:h2:file:";
+ if (!dbPath.startsWith(prefix)) {
+ LOG.warn("-z (gzip) ignored: db is a non-file jdbc connection ({}), no local file to transfer",
+ dbPath);
+ return;
+ }
+ // Strip the jdbc:h2:file: prefix and any ;OPTION=... suffix to get the file base path.
+ filePath = dbPath.substring(prefix.length());
+ int semi = filePath.indexOf(';');
+ if (semi >= 0) {
+ filePath = filePath.substring(0, semi);
+ }
+ }
+ Path dbFile = Paths.get(filePath + ".mv.db");
+ if (!Files.isRegularFile(dbFile)) {
+ LOG.warn("-z (gzip) ignored: expected db file {} not found", dbFile);
+ return;
+ }
+ Path gzPath = dbFile.resolveSibling(dbFile.getFileName() + ".gz");
+ LOG.info("Creating {}", gzPath);
+ gzipFile(dbFile, gzPath);
+ LOG.info("Db archived to {}", gzPath);
+ }
+
+ private static void gzipFile(Path source, Path output) throws IOException {
+ try (InputStream is = Files.newInputStream(source);
+ OutputStream fos = Files.newOutputStream(output);
+ GzipCompressorOutputStream gzo = new GzipCompressorOutputStream(fos)) {
+ is.transferTo(gzo);
+ }
+ }
+
private static void createTarGz(Path sourceDir, Path output) throws IOException {
try (OutputStream fos = Files.newOutputStream(output);
GzipCompressorOutputStream gzo = new GzipCompressorOutputStream(fos);
diff --git a/tika-eval/tika-eval-app/src/main/resources/comparison-reports-pg.xml b/tika-eval/tika-eval-app/src/main/resources/comparison-reports-pg.xml
index 0773e51dd3..1343e002bf 100644
--- a/tika-eval/tika-eval-app/src/main/resources/comparison-reports-pg.xml
+++ b/tika-eval/tika-eval-app/src/main/resources/comparison-reports-pg.xml
@@ -838,6 +838,208 @@
</report>
+ <!-- CHARSET / ENCODING DETECTION
+ Reports over the encodings_a / encodings_b tables. One row per file that ran
+ charset detection: detected_encoding (final pick), encoding_detector (winning
+ detector), declared_metadata (charset declared via Content-Type-Hint). A row
+ exists only when an encoding was detected, so counts are over text-y files and
+ joins to encodings are effectively inner. A and B are paired by id. These
+ tables are not covered by any other report. -->
+
+ <report reportName="Charset Detection Coverage"
+ reportFilename="charset/charset_coverage.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select 'paired_files' as METRIC, count(1) as CNT
+ from profiles_a pa join profiles_b pb on pa.id=pb.id
+ union all
+ select 'detected_in_a', count(1) from encodings_a
+ union all
+ select 'detected_in_b', count(1) from encodings_b
+ union all
+ select 'detected_in_both', count(1)
+ from encodings_a ea join encodings_b eb on ea.id=eb.id
+ union all
+ select 'flipped_a_to_b', count(1)
+ from encodings_a ea join encodings_b eb on ea.id=eb.id
+ where ea.detected_encoding <> eb.detected_encoding
+ </sql>
+ </report>
+
+ <report reportName="Detected Encoding Distribution A"
+ reportFilename="charset/detected_encoding_distribution_A.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select detected_encoding as DETECTED_ENCODING, count(1) as COUNT
+ from encodings_a
+ group by detected_encoding
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Detected Encoding Distribution B"
+ reportFilename="charset/detected_encoding_distribution_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select detected_encoding as DETECTED_ENCODING, count(1) as COUNT
+ from encodings_b
+ group by detected_encoding
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Encoding Differences A -> B"
+ reportFilename="charset/encoding_diffs_A_to_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select concat(ea.detected_encoding, ' -> ', eb.detected_encoding) as ENCODING_A_TO_ENCODING_B,
+ count(1) as COUNT
+ from encodings_a ea
+ join encodings_b eb on ea.id=eb.id
+ where ea.detected_encoding <> eb.detected_encoding
+ group by ENCODING_A_TO_ENCODING_B
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Encoding Differences A -> B Details"
+ reportFilename="charset/encoding_diffs_A_to_B_details.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select c.file_path as FILE_PATH,
+ case
+ when pb.embedded_depth > 0
+ then pb.embedded_file_path
+ else pb.file_name
+ end as FILE_NAME_B,
+ ea.detected_encoding as ENCODING_A,
+ eb.detected_encoding as ENCODING_B,
+ ea.encoding_detector as DETECTOR_A,
+ eb.encoding_detector as DETECTOR_B,
+ eb.declared_metadata as DECLARED_B,
+ mb.mime_string as MIME_B,
+ ca.oov as OOV_A, cb.oov as OOV_B,
+ cb.oov - ca.oov as OOV_DELTA_B,
+ ca.languageness as LANGUAGENESS_A, cb.languageness as LANGUAGENESS_B,
+ cb.languageness - ca.languageness as LANGUAGENESS_DELTA_B,
+ ca.num_replacement as FFFD_A, cb.num_replacement as FFFD_B,
+ ca.num_non_ascii as NON_ASCII_A, cb.num_non_ascii as NON_ASCII_B,
+ round(100.0*cb.num_replacement/nullif(cb.num_non_ascii,0),2) as FFFD_PCT_B,
+ ca.num_common_tokens as COMMON_TOKENS_A, cb.num_common_tokens as COMMON_TOKENS_B,
+ coalesce(cb.num_common_tokens,0)-coalesce(ca.num_common_tokens,0) as COMMON_TOKENS_DELTA_B,
+ ca.lang_id_1 as LANG_A, cb.lang_id_1 as LANG_B
+ from encodings_a ea
+ join encodings_b eb on ea.id=eb.id
+ join profiles_b pb on pb.id=ea.id
+ join containers c on c.container_id=pb.container_id
+ left join contents_a ca on ca.id=ea.id
+ left join contents_b cb on cb.id=ea.id
+ left join mimes mb on mb.mime_id=pb.mime_id
+ where ea.detected_encoding <> eb.detected_encoding
+ order by coalesce(cb.num_common_tokens,0)-coalesce(ca.num_common_tokens,0) asc
+ limit 100000
+ </sql>
+ </report>
+
+ <report reportName="SBCS-Western to CJK Flips A -> B"
+ reportFilename="charset/sbcs_to_cjk_flips_A_to_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select concat(ea.detected_encoding, ' -> ', eb.detected_encoding) as ENCODING_A_TO_ENCODING_B,
+ count(1) as COUNT
+ from encodings_a ea
+ join encodings_b eb on ea.id=eb.id
+ where lower(ea.detected_encoding) in
+ ('windows-1252','iso-8859-1','iso-8859-15','iso-8859-2','iso-8859-3',
+ 'windows-1250','windows-1254','windows-1257','iso-8859-13','windows-1258',
+ 'x-macroman','ibm850','ibm852')
+ and lower(eb.detected_encoding) in
+ ('gb18030','gbk','gb2312','big5','big5-hkscs','shift_jis','euc-jp','euc-kr',
+ 'x-euc-tw','x-windows-874','x-windows-949','iso-2022-jp','iso-2022-kr','iso-2022-cn')
+ group by ENCODING_A_TO_ENCODING_B
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Encoding Detector Distribution A"
+ reportFilename="charset/encoding_detector_distribution_A.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select encoding_detector as ENCODING_DETECTOR, count(1) as COUNT
+ from encodings_a
+ group by encoding_detector
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Encoding Detector Distribution B"
+ reportFilename="charset/encoding_detector_distribution_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select encoding_detector as ENCODING_DETECTOR, count(1) as COUNT
+ from encodings_b
+ group by encoding_detector
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Detector Quality B (by detector and encoding)"
+ reportFilename="charset/detector_quality_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select eb.encoding_detector as ENCODING_DETECTOR,
+ eb.detected_encoding as DETECTED_ENCODING,
+ count(1) as COUNT,
+ round(avg(cb.oov),4) as AVG_OOV,
+ round(avg(cb.languageness),2) as AVG_LANGUAGENESS,
+ sum(cb.num_replacement) as TOTAL_FFFD,
+ sum(cb.num_non_ascii) as TOTAL_NON_ASCII,
+ round(100.0*sum(cb.num_replacement)/nullif(sum(cb.num_non_ascii),0),2) as FFFD_PCT
+ from encodings_b eb
+ join contents_b cb on cb.id=eb.id
+ group by eb.encoding_detector, eb.detected_encoding
+ order by AVG_OOV desc
+ </sql>
+ </report>
+
+ <report reportName="Declared vs Detected B"
+ reportFilename="charset/declared_vs_detected_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select eb.declared_metadata as DECLARED, eb.detected_encoding as DETECTED,
+ count(1) as COUNT
+ from encodings_b eb
+ where eb.declared_metadata is not null
+ group by eb.declared_metadata, eb.detected_encoding
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Declared vs Detected A"
+ reportFilename="charset/declared_vs_detected_A.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select ea.declared_metadata as DECLARED, ea.detected_encoding as DETECTED,
+ count(1) as COUNT
+ from encodings_a ea
+ where ea.declared_metadata is not null
+ group by ea.declared_metadata, ea.detected_encoding
+ order by COUNT desc
+ </sql>
+ </report>
+
+
<!-- Exceptions -->
<report reportName="AllExceptionsByMimeA"
reportFilename="exceptions/exceptions_by_mime_A.xlsx"
diff --git a/tika-eval/tika-eval-app/src/main/resources/comparison-reports.xml b/tika-eval/tika-eval-app/src/main/resources/comparison-reports.xml
index cf2aca82b4..69efc926e1 100644
--- a/tika-eval/tika-eval-app/src/main/resources/comparison-reports.xml
+++ b/tika-eval/tika-eval-app/src/main/resources/comparison-reports.xml
@@ -477,6 +477,208 @@
</report>
+ <!-- CHARSET / ENCODING DETECTION
+ Reports over the encodings_a / encodings_b tables. One row per file that ran
+ charset detection: detected_encoding (final pick), encoding_detector (winning
+ detector), declared_metadata (charset declared via Content-Type-Hint). A row
+ exists only when an encoding was detected, so counts are over text-y files and
+ joins to encodings are effectively inner. A and B are paired by id. These
+ tables are not covered by any other report. -->
+
+ <report reportName="Charset Detection Coverage"
+ reportFilename="charset/charset_coverage.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select 'paired_files' as METRIC, count(1) as CNT
+ from profiles_a pa join profiles_b pb on pa.id=pb.id
+ union all
+ select 'detected_in_a', count(1) from encodings_a
+ union all
+ select 'detected_in_b', count(1) from encodings_b
+ union all
+ select 'detected_in_both', count(1)
+ from encodings_a ea join encodings_b eb on ea.id=eb.id
+ union all
+ select 'flipped_a_to_b', count(1)
+ from encodings_a ea join encodings_b eb on ea.id=eb.id
+ where ea.detected_encoding <> eb.detected_encoding
+ </sql>
+ </report>
+
+ <report reportName="Detected Encoding Distribution A"
+ reportFilename="charset/detected_encoding_distribution_A.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select detected_encoding as DETECTED_ENCODING, count(1) as COUNT
+ from encodings_a
+ group by detected_encoding
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Detected Encoding Distribution B"
+ reportFilename="charset/detected_encoding_distribution_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select detected_encoding as DETECTED_ENCODING, count(1) as COUNT
+ from encodings_b
+ group by detected_encoding
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Encoding Differences A -> B"
+ reportFilename="charset/encoding_diffs_A_to_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select concat(ea.detected_encoding, ' -> ', eb.detected_encoding) as ENCODING_A_TO_ENCODING_B,
+ count(1) as COUNT
+ from encodings_a ea
+ join encodings_b eb on ea.id=eb.id
+ where ea.detected_encoding <> eb.detected_encoding
+ group by ENCODING_A_TO_ENCODING_B
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Encoding Differences A -> B Details"
+ reportFilename="charset/encoding_diffs_A_to_B_details.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select c.file_path as FILE_PATH,
+ case
+ when pb.embedded_depth > 0
+ then pb.embedded_file_path
+ else pb.file_name
+ end as FILE_NAME_B,
+ ea.detected_encoding as ENCODING_A,
+ eb.detected_encoding as ENCODING_B,
+ ea.encoding_detector as DETECTOR_A,
+ eb.encoding_detector as DETECTOR_B,
+ eb.declared_metadata as DECLARED_B,
+ mb.mime_string as MIME_B,
+ ca.oov as OOV_A, cb.oov as OOV_B,
+ cb.oov - ca.oov as OOV_DELTA_B,
+ ca.languageness as LANGUAGENESS_A, cb.languageness as LANGUAGENESS_B,
+ cb.languageness - ca.languageness as LANGUAGENESS_DELTA_B,
+ ca.num_replacement as FFFD_A, cb.num_replacement as FFFD_B,
+ ca.num_non_ascii as NON_ASCII_A, cb.num_non_ascii as NON_ASCII_B,
+ round(100.0*cb.num_replacement/nullif(cb.num_non_ascii,0),2) as FFFD_PCT_B,
+ ca.num_common_tokens as COMMON_TOKENS_A, cb.num_common_tokens as COMMON_TOKENS_B,
+ ifnull(cb.num_common_tokens,0)-ifnull(ca.num_common_tokens,0) as COMMON_TOKENS_DELTA_B,
+ ca.lang_id_1 as LANG_A, cb.lang_id_1 as LANG_B
+ from encodings_a ea
+ join encodings_b eb on ea.id=eb.id
+ join profiles_b pb on pb.id=ea.id
+ join containers c on c.container_id=pb.container_id
+ left join contents_a ca on ca.id=ea.id
+ left join contents_b cb on cb.id=ea.id
+ left join mimes mb on mb.mime_id=pb.mime_id
+ where ea.detected_encoding <> eb.detected_encoding
+ order by ifnull(cb.num_common_tokens,0)-ifnull(ca.num_common_tokens,0) asc
+ limit 100000
+ </sql>
+ </report>
+
+ <report reportName="SBCS-Western to CJK Flips A -> B"
+ reportFilename="charset/sbcs_to_cjk_flips_A_to_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select concat(ea.detected_encoding, ' -> ', eb.detected_encoding) as ENCODING_A_TO_ENCODING_B,
+ count(1) as COUNT
+ from encodings_a ea
+ join encodings_b eb on ea.id=eb.id
+ where lower(ea.detected_encoding) in
+ ('windows-1252','iso-8859-1','iso-8859-15','iso-8859-2','iso-8859-3',
+ 'windows-1250','windows-1254','windows-1257','iso-8859-13','windows-1258',
+ 'x-macroman','ibm850','ibm852')
+ and lower(eb.detected_encoding) in
+ ('gb18030','gbk','gb2312','big5','big5-hkscs','shift_jis','euc-jp','euc-kr',
+ 'x-euc-tw','x-windows-874','x-windows-949','iso-2022-jp','iso-2022-kr','iso-2022-cn')
+ group by ENCODING_A_TO_ENCODING_B
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Encoding Detector Distribution A"
+ reportFilename="charset/encoding_detector_distribution_A.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select encoding_detector as ENCODING_DETECTOR, count(1) as COUNT
+ from encodings_a
+ group by encoding_detector
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Encoding Detector Distribution B"
+ reportFilename="charset/encoding_detector_distribution_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select encoding_detector as ENCODING_DETECTOR, count(1) as COUNT
+ from encodings_b
+ group by encoding_detector
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Detector Quality B (by detector and encoding)"
+ reportFilename="charset/detector_quality_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select eb.encoding_detector as ENCODING_DETECTOR,
+ eb.detected_encoding as DETECTED_ENCODING,
+ count(1) as COUNT,
+ round(avg(cb.oov),4) as AVG_OOV,
+ round(avg(cb.languageness),2) as AVG_LANGUAGENESS,
+ sum(cb.num_replacement) as TOTAL_FFFD,
+ sum(cb.num_non_ascii) as TOTAL_NON_ASCII,
+ round(100.0*sum(cb.num_replacement)/nullif(sum(cb.num_non_ascii),0),2) as FFFD_PCT
+ from encodings_b eb
+ join contents_b cb on cb.id=eb.id
+ group by eb.encoding_detector, eb.detected_encoding
+ order by AVG_OOV desc
+ </sql>
+ </report>
+
+ <report reportName="Declared vs Detected B"
+ reportFilename="charset/declared_vs_detected_B.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select eb.declared_metadata as DECLARED, eb.detected_encoding as DETECTED,
+ count(1) as COUNT
+ from encodings_b eb
+ where eb.declared_metadata is not null
+ group by eb.declared_metadata, eb.detected_encoding
+ order by COUNT desc
+ </sql>
+ </report>
+
+ <report reportName="Declared vs Detected A"
+ reportFilename="charset/declared_vs_detected_A.xlsx"
+ format="xlsx"
+ includeSql="true">
+ <sql>
+ select ea.declared_metadata as DECLARED, ea.detected_encoding as DETECTED,
+ count(1) as COUNT
+ from encodings_a ea
+ where ea.declared_metadata is not null
+ group by ea.declared_metadata, ea.detected_encoding
+ order by COUNT desc
+ </sql>
+ </report>
+
+
<!-- Exceptions -->
<report reportName="AllExceptionsByMimeA"
reportFilename="exceptions/exceptions_by_mime_A.xlsx"
diff --git a/tika-eval/tika-eval-core/src/main/java/org/apache/tika/eval/core/metadata/TikaEvalMetadataFilter.java b/tika-eval/tika-eval-core/src/main/java/org/apache/tika/eval/core/metadata/TikaEvalMetadataFilter.java
index 7c015b79a4..1f9736ab03 100644
--- a/tika-eval/tika-eval-core/src/main/java/org/apache/tika/eval/core/metadata/TikaEvalMetadataFilter.java
+++ b/tika-eval/tika-eval-core/src/main/java/org/apache/tika/eval/core/metadata/TikaEvalMetadataFilter.java
@@ -16,13 +16,13 @@
*/
package org.apache.tika.eval.core.metadata;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
-import org.apache.tika.config.TikaComponent;
import org.apache.tika.eval.core.langid.LanguageIDWrapper;
import org.apache.tika.eval.core.textstats.BasicTokenCountStatsCalculator;
import org.apache.tika.eval.core.textstats.CommonTokens;
@@ -30,17 +30,17 @@ import org.apache.tika.eval.core.textstats.CompositeTextStatsCalculator;
import org.apache.tika.eval.core.textstats.TextStatsCalculator;
import org.apache.tika.eval.core.tokens.CommonTokenResult;
import org.apache.tika.eval.core.tokens.TokenCounts;
+import org.apache.tika.langdetect.charsoup.GenerativeLanguageModel;
import org.apache.tika.language.detect.LanguageResult;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.metadata.Property;
import org.apache.tika.metadata.TikaCoreProperties;
import org.apache.tika.metadata.filter.MetadataFilterBase;
-import org.apache.tika.ml.junkdetect.JunkDetector;
-import org.apache.tika.quality.TextQualityScore;
-@TikaComponent
public class TikaEvalMetadataFilter extends MetadataFilterBase {
+ private static final String GLM_RESOURCE = GenerativeLanguageModel.DEFAULT_MODEL_RESOURCE;
+
public static String TIKA_EVAL_NS = "tika-eval" + TikaCoreProperties.NAMESPACE_PREFIX_DELIMITER;
public static Property NUM_TOKENS = Property.externalInteger(TIKA_EVAL_NS + "numTokens");
@@ -67,7 +67,7 @@ public class TikaEvalMetadataFilter extends MetadataFilterBase {
public static Property LANGUAGENESS = Property.externalReal(TIKA_EVAL_NS + "languageness");
static CompositeTextStatsCalculator TEXT_STATS_CALCULATOR;
- private static final JunkDetector JUNK_DETECTOR;
+ private static GenerativeLanguageModel GLM;
static {
List<TextStatsCalculator> calcs = new ArrayList<>();
@@ -75,18 +75,21 @@ public class TikaEvalMetadataFilter extends MetadataFilterBase {
calcs.add(new CommonTokens());
TEXT_STATS_CALCULATOR = new CompositeTextStatsCalculator(calcs);
- JunkDetector jd = null;
try {
- jd = JunkDetector.loadFromClasspath();
- } catch (Throwable t) {
- // Model load failure → languageness no-op, not pipeline failure.
+ GLM = GenerativeLanguageModel.loadFromClasspath(GLM_RESOURCE);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to load generative language model: "
+ + GLM_RESOURCE, e);
}
- JUNK_DETECTOR = jd;
}
- /** Shared {@link JunkDetector}, or {@code null} if the model failed to load. */
- public static JunkDetector getJunkDetector() {
- return JUNK_DETECTOR;
+
+ /**
+ * Returns the shared generative language model, or {@code null} if
+ * the model binary is not on the classpath.
+ */
+ public static GenerativeLanguageModel getGenerativeModel() {
+ return GLM;
}
@Override
@@ -120,16 +123,16 @@ public class TikaEvalMetadataFilter extends MetadataFilterBase {
//languages
List<LanguageResult> probabilities =
(List<LanguageResult>) results.get(LanguageIDWrapper.class);
+ String detectedLang = null;
if (probabilities.size() > 0) {
- metadata.set(LANGUAGE, probabilities.get(0).getLanguage());
+ detectedLang = probabilities.get(0).getLanguage();
+ metadata.set(LANGUAGE, detectedLang);
metadata.set(LANGUAGE_CONFIDENCE, probabilities.get(0).getRawScore());
}
- // Junk-detector z-score: + clean, − mojibake / wrong-encoding.
- // Replaces the GLM-based languageness removed in TIKA-4720.
- if (JUNK_DETECTOR != null) {
- TextQualityScore q = JUNK_DETECTOR.score(content);
- metadata.set(LANGUAGENESS, q.isUnknown() ? -99.0f : q.getZScore());
+ if (detectedLang != null) {
+ float z = GLM.zScoreLengthAdjusted(content, detectedLang);
+ metadata.set(LANGUAGENESS, Float.isNaN(z) ? -99.0f : z);
} else {
metadata.set(LANGUAGENESS, -99.0f);
}
diff --git a/tika-eval/tika-eval-core/src/main/resources/common_tokens/ace b/tika-eval/tika-eval-core/src/main/resources/common_tokens/ace
new file mode 100644
index 0000000000..b632aae6ed
--- /dev/null
+++ b/tika-eval/tika-eval-core/src/main/resources/common_tokens/ace
@@ -0,0 +1,1835 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#DOC_COUNT 15807
+#SUM_DOC_FREQS 245924
+#SUM_TERM_FREQS 302408
+#UNIQUE_TERMS 23040
+#TOKEN DOCFREQ TERMFREQ
+nakeuh 13445 20379
+nyoe 7829 8294
+aceh 7617 10980
+lam 6410 7543
+saboh 5805 6114
+nyang 5621 8489
+kabupaten 4915 4974
+gampong 4669 8384
+nibak 4423 4815
+lumboi 3577 3577
+peumeurentah 3559 3564
+data 3523 3527
+bak 2939 4204
+keu 2774 3489
+keucamatan 2491 2552
+ngon 2467 4552
+propinsi 2457 2940
+spesies 2147 2156
+takson 2118 2118
+manyang 1979 2007
+gunong 1946 4437
+ateuh 1901 1906
+mete 1890 1893
+babah 1884 1896
+nyan 1713 3010
+drosophila 1576 3144
+indonesia 1353 1428
+ureueng 1272 1927
+jeupun 1063 1078
+geupeuteubiet 1032 1033
+bab 1028 2052
+manga 1027 2051
+volume 1026 1026
+aoyama 1024 1024
+conan 1024 1024
+detektif 1024 1024
+geuseumurat 1024 1024
+gosho 1024 1024
+shogakkukan 1024 1024
+provinsi 1013 1020
+rayek 970 1017
+thon 914 1349
+atawa 880 1046
+nanggroe 873 1088
+pidie 855 963
+timu 829 921
+nang 752 780
+jeuet 745 953
+that 682 899
+sidroe 662 740
+banda 638 877
+wilayah 621 831
+boh 582 745
+nan 575 723
+bireuen 567 581
+cit 563 634
+barat 559 639
+jaya 553 655
+cot 545 553
+pulo 533 1229
+teungoh 527 550
+teunggara 508 515
+hana 497 651
+raya 474 523
+neugara 463 635
+seulatan 459 499
+gle 457 474
+bahsa 455 879
+dari 435 520
+jih 434 610
+uroe 411 607
+baroh 404 448
+lagee 401 455
+droe 400 484
+blang 396 412
+masa 396 503
+nanggroejih 388 388
+phon 356 432
+watee 346 416
+keuh 337 375
+allah 332 477
+buleuen 327 471
+baro 318 330
+lheueh 312 343
+jeuneh 310 356
+kayem 309 325
+kuta 308 364
+sampoe 308 349
+amirika 306 335
+lom 288 322
+leubeh 287 330
+islam 283 413
+scaptodrosophila 280 560
+ban 279 319
+keurajeuen 275 492
+prang 270 451
+meriah 269 276
+seubagoe 269 301
+deungon 266 334
+asay 263 263
+krueng 263 327
+scaptomyza 262 524
+nabi 257 478
+darul 254 265
+tunong 253 285
+paleng 252 322
+bener 248 274
+irah 246 333
+burni 238 238
+alue 233 238
+geukheun 233 287
+jinoe 231 249
+mantong 231 250
+meunasah 222 234
+meu 221 266
+salah 221 229
+mukim 216 407
+mandum 214 248
+simpang 212 216
+buket 210 220
+dan 210 253
+padum 206 383
+tanoh 206 243
+kawan 205 224
+teumpat 204 250
+donya 203 239
+duek 203 252
+geu 203 250
+laten 202 204
+dua 201 216
+utara 201 226
+aneuk 198 264
+geupeunan 197 226
+kuala 196 248
+arab 195 246
+pih 194 210
+roh 192 203
+aktor 191 193
+antara 190 209
+eungkot 190 398
+gobnyan 189 273
+teuka 188 213
+lahe 187 195
+asia 186 216
+blah 186 286
+rot 186 272
+dayah 185 311
+syarikat 182 186
+rusia 180 227
+neuduek 177 195
+kuwasa 176 209
+jeut 175 199
+nagan 175 177
+raja 174 248
+batee 172 194
+muhammad 170 196
+bansa 168 271
+dalam 167 185
+kota 165 173
+lawe 163 196
+meunan 161 175
+teuntra 161 267
+kawasan 158 161
+pante 157 180
+simeulue 155 218
+duwa 154 172
+kayee 154 197
+yang 153 191
+lhee 151 158
+dum 149 167
+lhok 149 168
+beulanda 148 296
+paya 148 156
+agama 146 195
+timur 145 150
+udep 142 164
+inggreh 141 176
+laen 140 161
+buet 138 176
+jawa 138 178
+tiga 138 138
+surat 134 466
+bumoe 131 167
+yoh 130 133
+china 128 172
+makmur 126 129
+dudoe 125 129
+luwah 125 154
+bandar 124 130
+padang 124 127
+jeupang 122 141
+peusangan 122 129
+ulee 122 140
+alam 121 146
+meunyoe 121 132
+peureulak 120 125
+jitamong 119 137
+baru 118 120
+singke 118 119
+teuma 117 121
+india 116 129
+jumeulah 116 139
+malaysia 116 156
+ubeut 115 128
+awai 114 129
+darussalam 114 121
+saban 114 131
+ujong 114 123
+laot 113 168
+meulayu 113 143
+geupeugot 112 131
+abad 111 146
+geungui 111 144
+geupeudong 111 130
+mesjid 110 111
+eleumee 109 146
+ierupa 109 117
+pusat 109 121
+disinan 107 118
+panyang 107 120
+geudrop 106 106
+peuet 106 129
+qur 106 121
+republik 106 138
+vietnam 106 117
+afrika 105 125
+seureuta 105 113
+sultan 105 137
+han 104 116
+sukee 103 251
+ayat 102 203
+cut 102 122
+laju 102 109
+utama 102 107
+haji 101 117
+meuhat 101 104
+jameun 100 120
+peukan 100 102
+dilee 99 101
+kitab 97 147
+meuceue 97 125
+awak 96 123
+filipina 96 97
+kawom 96 134
+narit 96 130
+ateueh 95 113
+bukit 95 101
+bhaih 94 102
+rumoh 94 128
+tiep 94 141
+basa 93 135
+geupeubloe 93 93
+seuneubok 93 93
+ulama 93 120
+mata 92 111
+meuhase 92 97
+muda 92 103
+manusia 91 119
+nyakni 91 92
+sabab 91 98
+dairah 90 110
+idi 90 91
+indra 90 95
+tareh 90 100
+tanjong 89 92
+trok 89 98
+bur 88 88
+inong 88 101
+meuseujid 88 192
+gopnyan 86 146
+peunteng 86 95
+portugeh 86 152
+subulussalam 86 93
+sumatra 86 102
+bhah 85 97
+bintang 85 91
+jak 85 97
+peukara 85 104
+teungku 85 125
+gajah 83 99
+lhoksukon 83 94
+mate 83 99
+meunyo 83 93
+bin 82 151
+geuturi 82 86
+kon 82 84
+pasi 82 88
+seubab 82 91
+troh 82 87
+geujak 81 113
+saweueb 81 83
+tuha 81 90
+bah 80 84
+agam 79 93
+cara 79 92
+hase 78 103
+hindia 78 107
+limong 78 86
+muangthai 78 78
+abu 77 107
+bineh 77 92
+jeumeulah 77 77
+keujadian 77 97
+meunatang 77 113
+siblah 77 91
+geucok 76 81
+keunira 76 83
+rab 76 79
+salang 76 77
+akhe 75 78
+haraih 75 115
+mangat 75 85
+mongolia 75 116
+ramee 75 81
+sabe 75 88
+sakti 75 77
+trep 75 78
+lhokseumawe 74 128
+tamong 74 78
+bagi 73 77
+kluet 73 83
+cicem 72 157
+cina 72 96
+rakyat 72 74
+rayeuk 72 80
+aseuli 71 83
+gubernur 71 94
+kapai 71 144
+kareueng 71 76
+umu 71 85
+neu 70 90
+raseumi 70 78
+reusam 70 94
+seunagan 70 71
+beunagi 69 76
+keunan 69 76
+kri 69 79
+luwa 69 78
+seulat 69 95
+tapi 69 72
+tiji 69 69
+itam 68 84
+peunula 68 88
+aman 67 67
+biasa 67 73
+gayo 67 87
+labuhan 67 67
+mirah 67 74
+oblast 67 113
+kureueng 66 68
+tinggai 66 73
+toe 66 70
+tujoh 66 83
+haba 65 72
+langsa 65 136
+macam 65 78
+madinah 65 89
+rumania 65 69
+lumpur 64 103
+sagoe 64 81
+soleutan 64 112
+ala 63 77
+geuboh 63 70
+hukom 63 96
+meuseubab 63 65
+sabang 63 83
+abeh 62 66
+asoe 62 67
+bideueng 62 70
+malaka 62 70
+selatan 61 65
+goh 60 61
+meula 60 63
+saw 60 74
+ulim 60 68
+uteuen 60 69
+wareuna 60 85
+jeumpa 59 63
+keurija 59 77
+lheuh 59 66
+rayeuek 59 67
+tenggara 59 60
+chik 58 72
+geulumpang 58 65
+geunguy 58 69
+matang 58 59
+nyankeuh 58 61
+presiden 58 71
+rasul 58 68
+samalanga 58 60
+babul 57 57
+bandara 57 125
+brat 57 59
+daya 57 65
+timue 57 57
+wajeb 57 73
+asai 56 63
+ceue 56 71
+riwayat 56 64
+seumayang 56 116
+bungong 55 91
+ekonomi 55 66
+indrapuri 55 57
+ingin 55 55
+maghribi 55 85
+peunajoh 55 88
+pucok 55 58
+alas 54 54
+ali 54 70
+jitimoh 54 67
+peudada 54 54
+prefektur 54 145
+chit 53 60
+jipeugot 53 60
+juli 53 67
+keuneuk 53 56
+meunurot 53 58
+tom 53 57
+meurdeka 52 61
+puteh 52 64
+rupa 52 58
+abdul 51 63
+biasajih 51 52
+geumat 51 55
+latin 51 54
+meumacam 51 55
+seujarah 51 53
+tengah 51 51
+ara 50 51
+carekat 50 51
+darat 50 57
+geuh 50 60
+meurumpok 50 54
+peu 50 64
+sikula 50 83
+sistem 50 67
+teudong 50 52
+teuduek 50 51
+teupah 50 51
+bagian 49 68
+hudep 49 55
+keunong 49 61
+mat 49 52
+neupeutron 49 58
+peue 49 53
+peurancih 49 73
+rantau 49 51
+batu 48 50
+dapeuta 48 50
+delima 48 48
+galak 48 51
+geuduek 48 52
+geupeugah 48 53
+gunung 48 49
+jangka 48 53
+juta 48 71
+kembang 48 48
+keudee 48 55
+korea 48 61
+ladom 48 52
+meuyub 48 54
+the 48 86
+lapan 47 47
+nam 47 48
+peuneugah 47 50
+sikureueng 47 50
+sinan 47 51
+beutong 46 46
+get 46 50
+malam 46 73
+panglima 46 53
+seulimum 46 48
+soe 46 49
+tiro 46 72
+universitas 46 75
+dali 45 52
+gandapura 45 47
+puasa 45 83
+rame 45 51
+seugolom 45 48
+umar 45 80
+ureung 45 53
+ahli 44 48
+bani 44 69
+hasan 44 64
+meuiman 44 47
+meuntroe 44 57
+pase 44 65
+ramadhan 44 61
+samudra 44 53
+administrasijih 43 43
+city 43 43
+geubri 43 47
+julok 43 45
+meuninggai 43 50
+meupadum 43 45
+miseue 43 45
+neuh 43 57
+ruja 43 44
+turuki 43 56
+gala 42 43
+jagong 42 96
+kaphe 42 59
+keumawe 42 42
+masyarakat 42 44
+mee 42 43
+mon 42 45
+peugot 42 46
+sungai 42 44
+tanda 42 61
+udara 42 49
+abdullah 41 50
+aseuka 41 47
+australia 41 60
+bacut 41 48
+beu 41 46
+jithee 41 44
+meukah 41 46
+montasik 41 41
+panton 41 43
+peuneudong 41 70
+teutap 41 43
+badan 40 50
+hayeue 40 40
+kute 40 40
+langsong 40 40
+meuhubong 40 44
+meuphom 40 40
+meutamah 40 42
+pasifik 40 42
+romawi 40 46
+siploh 40 41
+bada 39 39
+bambel 39 41
+bangsa 39 51
+banuwa 39 45
+brasil 39 40
+eropa 39 49
+geutanyoe 39 43
+got 39 46
+kulet 39 47
+leupah 39 41
+sigala 39 43
+buleun 38 41
+kecamatan 38 41
+kuasa 38 42
+meuniaga 38 43
+muka 38 41
+sit 38 45
+teuk 38 39
+ubit 38 41
+ueh 38 64
+wih 38 39
+akan 37 42
+badar 37 40
+beuna 37 52
+famili 37 37
+jaroe 37 39
+lampoh 37 39
+lueng 37 37
+meukeusud 37 37
+mutiara 37 37
+samatiga 37 37
+sifeut 37 64
+singkil 37 40
+ummat 37 49
+balee 36 37
+beuet 36 45
+gata 36 65
+ibrahim 36 50
+jakarta 36 46
+kalon 36 37
+kuneng 36 38
+kuril 36 44
+nanjih 36 41
+nurussalam 36 36
+rasulullah 36 51
+sama 36 47
+sukamakmur 36 36
+tangse 36 38
+trumon 36 38
+babussalam 35 35
+imarah 35 35
+lawan 35 37
+nara 35 37
+neubri 35 39
+peudong 35 42
+saweub 35 38
+tanggai 35 39
+teumieng 35 44
+thailand 35 42
+turki 35 43
+urueng 35 47
+woyla 35 35
+bagoe 34 34
+geupeuget 34 36
+hai 34 36
+jalan 34 41
+kalimantan 34 48
+kamboja 34 35
+kiamat 34 36
+leuser 34 35
+meurah 34 37
+muara 34 36
+pintu 34 34
+saket 34 42
+silih 34 35
+tuhan 34 34
+van 34 44
+alat 33 36
+anggeta 33 48
+bayeun 33 35
+bulan 33 33
+deleng 33 33
+gareh 33 45
+geupuga 33 37
+geuthee 33 33
+glie 33 33
+hijriyah 33 36
+honshu 33 34
+kira 33 56
+lhong 33 33
+linge 33 35
+meujan 33 37
+meujangeun 33 41
+nusantara 33 41
+peureulee 33 36
+samadua 33 33
+syiah 33 33
+timang 33 34
+tuboh 33 34
+ubat 33 48
+ujung 33 33
+utsmani 33 43
+alamnyoe 32 53
+bek 32 37
+gam 32 48
+geurakan 32 43
+geuweuek 32 38
+keubit 32 39
+keuduwa 32 33
+khalifah 32 54
+madat 32 34
+malaikat 32 55
+naleueng 32 40
+pegasing 32 35
+ploh 32 39
+tokyo 32 36
+uni 32 53
+adat 31 42
+beunileueng 31 32
+curak 31 36
+gantoe 31 32
+geudong 31 33
+hasanah 31 31
+jipeugah 31 33
+kalheuh 31 33
+keuluarga 31 33
+lage 31 34
+mas 31 32
+meubida 31 32
+milite 31 34
+mongol 31 47
+musa 31 44
+paloh 31 31
+permata 31 32
+peugah 31 33
+rahmah 31 31
+rambong 31 31
+seugohlom 31 32
+syah 31 47
+talo 31 38
+tho 31 37
+untuk 31 40
+away 30 35
+bri 30 30
+budaya 30 38
+genus 30 36
+hikayat 30 66
+hubongan 30 32
+iskandar 30 34
+keudroe 30 30
+kheun 30 32
+leumo 30 39
+meukek 30 31
+meurunoe 30 32
+miet 30 38
+musibah 30 46
+polinesia 30 31
+saudi 30 40
+sigom 30 32
+takalon 30 33
+timoh 30 33
+ayah 29 31
+beunantu 29 33
+geurapee 29 52
+geurija 29 52
+hadih 29 49
+ibadah 29 42
+jan 29 30
+karang 29 29
+karena 29 31
+karu 29 34
+langet 29 33
+leumah 29 34
+meubagoe 29 32
+mita 29 32
+nacit 29 30
+rata 29 42
+sagai 29 31
+suci 29 35
+suka 29 29
+teunuleh 29 39
+tibet 29 37
+timor 29 62
+ujeuen 29 36
+waki 29 30
+bandum 28 32
+barang 28 47
+bidari 28 28
+diwan 28 37
+geunantoe 28 28
+geupeuna 28 30
+geupimpin 28 34
+gla 28 29
+ijo 28 34
+istilah 28 35
+jijak 28 30
+ketambe 28 29
+keulayi 28 28
+keuneubah 28 34
+lhoknga 28 28
+meubileueng 28 30
+mula 28 31
+mulai 28 28
+neupeugot 28 30
+peungaroh 28 34
+peureute 28 44
+singapura 28 32
+suak 28 29
+tabeue 28 28
+teupin 28 28
+tusam 28 28
+ubah 28 36
+umum 28 29
+angen 27 31
+arongan 27 28
+bebesen 27 28
+bireum 27 28
+cukop 27 27
+distrik 27 44
+geutamong 27 29
+internasional 27 29
+jawoe 27 32
+kampong 27 31
+kumbang 27 29
+luah 27 30
+makkiyah 27 28
+makmu 27 28
+man 27 31
+masehi 27 28
+meusapat 27 28
+modern 27 29
+peunyaket 27 36
+sakhalin 27 28
+sunda 27 31
+trieng 27 28
+ukeu 27 27
+abeujad 26 26
+atlantik 26 28
+ayatjih 26 28
+filem 26 55
+geulayang 26 26
+geutuleh 26 28
+iseulam 26 31
+jiba 26 31
+ketol 26 28
+kubu 26 26
+meulaka 26 43
+mulia 26 29
+musem 26 33
+peng 26 36
+pesam 26 27
+rundeng 26 28
+seulamat 26 26
+teunom 26 27
+titek 26 38
+trienggadeng 26 29
+areuti 25 30
+asan 25 28
+bhan 25 40
+breueh 25 31
+cabeueng 25 29
+calitra 25 33
+dengan 25 26
+dong 25 27
+droeneuhnyan 25 33
+gaki 25 35
+geumpa 25 45
+geupinah 25 26
+itali 25 29
+jeu 25 27
+jeundran 25 32
+jroh 25 26
+kanan 25 25
+kanto 25 29
+keude 25 29
+keudeh 25 28
+meuprang 25 28
+neucok 25 26
+pasie 25 25
+quran 25 25
+rime 25 26
+seunurat 25 27
+seupanyo 25 32
+sigli 25 30
+ubena 25 29
+wilayahjih 25 25
+yat 25 26
+airport 24 25
+album 24 50
+aron 24 27
+bohjih 24 26
+bulat 24 26
+buloh 24 24
+daud 24 26
+gadoh 24 25
+geulawan 24 25
+geupeutalo 24 26
+guree 24 31
+hak 24 28
+hate 24 27
+hikmah 24 24
+jareueng 24 25
+jiduek 24 25
+juang 24 24
+kampung 24 24
+kareuna 24 24
+laos 24 24
+leste 24 47
+makkah 24 36
+meuh 24 26
+myanmar 24 27
+ngui 24 25
+paih 24 24
+peujuang 24 26
+peumerentah 24 27
+peunutoh 24 27
+populasi 24 25
+putih 24 25
+sigohlom 24 26
+siuroe 24 24
+taman 24 50
+teuku 24 40
+tropis 24 25
+zat 24 36
+adak 23 23
+ahmad 23 30
+alur 23 23
+balang 23 33
+bida 23 27
+blanda 23 37
+daulat 23 23
+geukalon 23 26
+geupeubuet 23 26
+geuyue 23 27
+glah 23 25
+hareutoejih 23 23
+iata 23 23
+jeureuman 23 32
+lambalek 23 23
+lues 23 25
+medan 23 25
+neujak 23 30
+neupeunan 23 28
+penyanyi 23 23
+peuget 23 25
+peulimbang 23 23
+pue 23 35
+sahbat 23 30
+selamat 23 24
+sipak 23 32
+sira 23 25
+siyasat 23 24
+tingkat 23 32
+tugaih 23 27
+tutong 23 27
+aimag 22 23
+ase 22 23
+asy 22 34
+awaknyan 22 29
+bakar 22 29
+beutoi 22 23
+dimeuyub 22 22
+drien 22 26
+geubagi 22 23
+geubuka 22 22
+geupileh 22 26
+geuteurimong 22 23
+grong 22 46
+janji 22 27
+jipeudong 22 23
+kala 22 27
+kareung 22 39
+kaya 22 22
+kazakhstan 22 29
+keuneulheueh 22 23
+keurajeun 22 26
+keutapang 22 23
+ladang 22 24
+lamuri 22 29
+lawet 22 22
+mekkah 22 31
+mungken 22 29
+nasional 22 26
+nnyang 22 43
+pahlawan 22 27
+pat 22 24
+peudana 22 26
+peutheun 22 22
+piyoh 22 22
+pokhkisen 22 22
+semadam 22 26
+seulawah 22 23
+soviet 22 38
+tanjung 22 22
+wafeuet 22 23
+wangsa 22 36
+yunani 22 24
+awe 21 22
+bala 21 29
+britania 21 26
+gabuek 21 23
+genting 21 21
+geuba 21 22
+geuneuk 21 21
+geupajoh 21 21
+geupeuphon 21 21
+gop 21 24
+hareuta 21 25
+ihsan 21 21
+jabatan 21 21
+jama 21 25
+james 21 21
+jazirah 21 21
+johan 21 22
+john 21 21
+kajeuet 21 22
+kebayakan 21 22
+kode 21 58
+kolonial 21 24
+kulu 21 23
+kusuih 21 22
+meukeumang 21 23
+meunang 21 21
+meusaban 21 22
+mila 21 21
+musoh 21 21
+musyrek 21 22
+neubeuet 21 25
+pandrah 21 22
+panga 21 23
+payah 21 21
+poh 21 26
+ratu 21 25
+sampoiniet 21 21
+serbajadi 21 21
+sipanyang 21 21
+sumur 21 23
+syedara 21 26
+tapeugah 21 21
+teutapi 21 21
+weh 21 25
+amerika 20 22
+anggeeta 20 20
+atau 20 20
+atra 20 25
+bakti 20 20
+bibeueh 20 23
+bicah 20 21
+bupati 20 28
+cok 20 21
+dabeueh 20 27
+federasi 20 21
+geuato 20 25
+industri 20 26
+jambo 20 20
+jicok 20 20
+jidrop 20 21
+jikheun 20 23
+jimeu 20 22
+karab 20 21
+keuadaan 20 23
+khaih 20 20
+luwaih 20 22
+makhluk 20 26
+mancang 20 21
+masen 20 22
+meujak 20 21
+meujampu 20 21
+meumakna 20 21
+miseuejih 20 21
+pada 20 23
+pakiban 20 20
+panah 20 20
+parsi 20 24
+peudawa 20 21
+pisang 20 33
+rhot 20 22
+sampe 20 23
+sigra 20 20
+sri 20 22
+sukajaya 20 20
+sukon 20 20
+takheun 20 20
+teluk 20 20
+teuga 20 21
+tinggi 20 23
+aleuh 19 25
+bagah 19 21
+bakjih 19 19
+bangka 19 24
+eseulam 19 19
+geuangkee 19 20
+geumarit 19 21
+geupeurunoe 19 21
+geupeutamong 19 20
+geupeutron 19 21
+geuplah 19 29
+jikuwasa 19 20
+kalimat 19 33
+kamal 19 21
+katolik 19 21
+khusuih 19 20
+klub 19 23
+kong 19 20
+kotamadya 19 19
+lae 19 19
+luwahjih 19 19
+maju 19 22
+mandiraja 19 20
+maseng 19 38
+meukawen 19 23
+meulaot 19 20
+neumat 19 20
+neupeugah 19 19
+nyo 19 23
+organisasi 19 22
+otonomi 19 25
+peukakaih 19 22
+peurentah 19 19
+peuta 19 44
+pulau 19 21
+pulitek 19 21
+quraisy 19 33
+rimba 19 19
+sudangkan 19 19
+sunnah 19 26
+sya 19 26
+syafi 19 26
+tapajoh 19 21
+tapaktuan 19 20
+tasek 19 38
+tuto 19 24
+acara 18 24
+asyura 18 31
+bahagia 18 18
+bakongan 18 20
+bayu 18 20
+deuh 18 23
+dijak 18 20
+droejih 18 19
+federal 18 19
+geupimpen 18 19
+guron 18 21
+hanjeuet 18 18
+hulu 18 18
+ibnu 18 26
+icaonya 18 18
+kisah 18 27
+kristen 18 23
+lama 18 18
+lapang 18 20
+lembah 18 18
+maka 18 25
+makna 18 24
+malaya 18 18
+mediterania 18 19
+meubaro 18 21
+meulaboh 18 23
+meuligoe 18 24
+meusaboh 18 18
+michael 18 18
+miseu 18 21
+napoleon 18 32
+neupeutrang 18 19
+new 18 21
+oseuha 18 19
+pajoh 18 22
+pakat 18 23
+pangkat 18 22
+pantan 18 18
+pasir 18 18
+peunjajah 18 19
+peunoh 18 18
+polandia 18 19
+punca 18 20
+putroe 18 31
+sah 18 19
+salahuddin 18 29
+seumateh 18 21
+sigo 18 20
+simacam 18 18
+siti 18 31
+tanah 18 18
+wate 18 21
+yup 18 20
+yusuf 18 27
+agustus 17 17
+air 17 19
+akibat 17 18
+almanak 17 25
+anoe 17 17
+ash 17 19
+aziz 17 20
+balkan 17 23
+banjarnegara 17 17
+carong 17 17
+eumpeuen 17 19
+film 17 33
+geografi 17 26
+geulakee 17 18
+geutamah 17 19
+grup 17 19
+guha 17 36
+ija 17 21
+iman 17 25
+indah 17 17
+iran 17 22
+jadi 17 17
+jibantu 17 18
+jirat 17 21
+jiteubiet 17 18
+jurong 17 17
+kameng 17 18
+keunarang 17 17
+klang 17 25
+kulam 17 17
+lagak 17 20
+madura 17 19
+mak 17 19
+meuma 17 21
+meuteuntee 17 17
+minyeuk 17 26
+neumeusifeut 17 17
+neuyue 17 18
+niet 17 21
+papua 17 26
+peumeurintah 17 17
+pinto 17 22
+sahabat 17 23
+sawang 17 20
+setia 17 17
+seu 17 20
+seula 17 18
+sie 17 21
+swedia 17 21
+syahid 17 20
+tgk 17 20
+thoen 17 18
+tii 17 19
+umat 17 19
+untok 17 18
+utosan 17 28
+arah 16 19
+ato 16 17
+bahwa 16 17
+baitussalam 16 16
+bale 16 17
+bali 16 21
+ben 16 32
+beulanja 16 18
+bhutan 16 33
+bube 16 16
+chi 16 19
+dubai 16 34
+geubantu 16 17
+geulanggang 16 16
+geupula 16 18
+iku 16 18
+imum 16 21
+isa 16 19
+jamur 16 16
+kana 16 18
+kiri 16 16
+lagu 16 26
+lon 16 20
+masalah 16 18
+maseukape 16 24
+mesidah 16 16
+mesir 16 17
+meukat 16 23
+meukleh 16 16
+meureumpok 16 16
+meusipreuek 16 17
+niaga 16 17
+nuraka 16 21
+nyawong 16 20
+onjih 16 19
+pade 16 19
+pakriban 16 16
+paneuk 16 16
+paris 16 18
+parlemen 16 23
+pesisir 16 16
+peuneugot 16 16
+pinyin 16 16
+pusaka 16 18
+rimueng 16 27
+rueng 16 17
+rukon 16 18
+selangor 16 18
+sulaiman 16 18
+sumatera 16 18
+syit 16 21
+ube 16 17
+uteun 16 16
+wahyu 16 18
+wisata 16 24
+yakni 16 16
+abee 15 22
+adalah 15 18
+alauddin 15 20
+and 15 17
+angkatan 15 18
+arul 15 15
+aweueh 15 18
+bahan 15 15
+bileueng 15 24
+endatu 15 15
+epinephelus 15 16
+gamba 15 17
+geubeuet 15 15
+geujok 15 17
+geupubloe 15 15
+geupubuet 15 18
+geusatoh 15 17
+geuseubot 15 16
+glumpang 15 16
+golom 15 15
+hagu 15 15
+hape 15 29
+hareutoe 15 15
+iii 15 17
+ile 15 20
+imeum 15 18
+irak 15 20
+jangeun 15 22
+jawi 15 19
+jipajoh 15 16
+jipoh 15 16
+joseph 15 16
+kanada 15 20
+kandang 15 18
+karya 15 16
+keulabee 15 15
+khan 15 30
+lada 15 16
+lee 15 15
+leuh 15 17
+leupung 15 15
+likot 15 20
+mahmud 15 18
+malik 15 24
+manyak 15 15
+melayu 15 16
+meuasai 15 16
+meuceuhu 15 15
+meuhareutoe 15 15
+meuse 15 18
+minangkabau 15 16
+mumacam 15 15
+neukheun 15 15
+nyoekeuh 15 15
+panjang 15 15
+periode 15 20
+peuingat 15 18
+peumimpin 15 15
+peutunyok 15 17
+pinang 15 16
+qinghai 15 18
+revolusi 15 18
+sabee 15 16
+semenanjung 15 15
+seulaen 15 15
+seumah 15 17
+sithon 15 15
+snouck 15 29
+spanyol 15 18
+special 15 15
+sulawesi 15 22
+suriyah 15 37
+tan 15 24
+tawar 15 16
+teujadi 15 17
+teumuleh 15 17
+teuningkat 15 22
+tim 15 17
+toh 15 15
+trang 15 17
+tualang 15 15
+tujuan 15 15
+ugama 15 22
+umayyah 15 24
+wareunajih 15 16
+william 15 16
+yaman 15 15
+alos 14 14
+atoran 14 18
+bajee 14 21
+batavia 14 15
+beuntuk 14 16
+brunei 14 17
+budha 14 17
+buya 14 19
+daerah 14 17
+dagang 14 15
+damee 14 17
+divisi 14 26
+drama 14 20
+droeneuh 14 17
+gadeng 14 15
+gaih 14 19
+geukira 14 16
+geupeunyata 14 16
+geupeusah 14 15
+geureubot 14 15
+haram 14 16
+harapan 14 14
+hoa 14 21
+husen 14 16
+ibadat 14 15
+jakeuet 14 28
+jantho 14 17
+jireubot 14 15
+johor 14 18
+jok 14 19
+kayu 14 14
+leupie 14 19
+lingka 14 15
+majeulih 14 16
+maladewa 14 19
+maroko 14 15
+meunara 14 24
+meusambong 14 15
+meusyeuhu 14 14
+meuteumpat 14 15
+meuubah 14 15
+moto 14 16
+nyak 14 23
+palestina 14 17
+pasukan 14 15
+patong 14 19
+penanggalan 14 17
+peuneujeut 14 17
+peyasan 14 23
+pirak 14 18
+pocut 14 23
+pustaka 14 25
+putoh 14 15
+ranto 14 14
+reuloh 14 18
+salib 14 29
+seri 14 14
+seumeunanjong 14 14
+sosial 14 16
+tambo 14 15
+tanaman 14 16
+tangke 14 19
+tengku 14 18
+turonan 14 17
+uning 14 14
+wal 14 17
+الله 14 22
+abi 13 16
+adam 13 20
+administrasi 13 14
+apui 13 15
+apuy 13 17
+armada 13 18
+ateuk 13 14
+atu 13 13
+baca 13 14
+baharu 13 15
+baiturrahman 13 15
+bantu 13 13
+barona 13 13
+beude 13 16
+bili 13 17
+biru 13 13
+damai 13 14
+dana 13 13
+danau 13 14
+dara 13 15
+dengon 13 17
+der 13 17
+dolar 13 13
+dongxiang 13 20
+eurasia 13 13
+falah 13 13
+geumita 13 13
+geupeu 13 14
+geusurat 13 14
+geutem 13 16
+gohlom 13 13
+ikot 13 14
+ismail 13 14
+jai 13 15
+jamee 13 15
+jimat 13 13
+jimita 13 14
+jipeutalo 13 13
+jipeuteubiet 13 14
+jipimpin 13 14
+kata 13 17
+keubeue 13 22
+keudua 13 14
+keue 13 14
+keuluwarga 13 13
+keumuneng 13 13
+keuphon 13 14
+krai 13 32
+kruet 13 15
+kunyet 13 14
+kureubeuen 13 15
+kutob 13 17
+kyushu 13 16
+lambaro 13 13
+lintang 13 13
+lipeh 13 13
+lot 13 13
+madeuhab 13 15
+mamplam 13 21
+masam 13 14
+melanesia 13 13
+meuagama 13 16
+meupisah 13 13
+meuriam 13 16
+meusigo 13 13
+meusikutu 13 14
+meutumee 13 14
+meuwareuna 13 15
+milyar 13 16
+muslim 13 16
+neunguy 13 15
+ngen 13 17
+pasar 13 13
+peubuet 13 13
+pka 13 23
+pruet 13 15
+pubuet 13 13
+rawa 13 13
+runtoh 13 14
+sabi 13 16
+sensus 13 13
+sepakat 13 13
+seuleusoe 13 14
+seumangat 13 13
+sibagoe 13 16
+silingka 13 13
+sukakarya 13 13
+surabaya 13 18
+suro 13 14
+tem 13 14
+tron 13 14
+tsunami 13 15
+tureuki 13 16
+udeueng 13 23
+wali 13 16
+word 13 13
+yahudi 13 19
+yum 13 15
+đong 13 15
+aktris 12 13
+andaman 12 13
+aneuek 12 19
+angkee 12 13
+areutijih 12 13
+asam 12 18
+bahasa 12 14
+bude 12 43
+bulee 12 17
+club 12 12
+cuco 12 12
+darah 12 16
+dasar 12 12
+dit 12 13
+drop 12 12
+fiqah 12 15
+gansu 12 15
+geukeurija 12 12
+geupeuhanco 12 12
+geupeukeumang 12 14
+geupeulaku 12 12
+geupeupaneuk 12 12
+geupeuturi 12 13
+geutaguen 12 12
+hadits 12 14
+hanco 12 12
+ileumee 12 16
+jibril 12 15
+jiprang 12 13
+jonathan 12 12
+karieng 12 12
+kelipah 12 15
+keulompok 12 15
+leungkap 12 12
+london 12 15
+lua 12 16
+lugat 12 16
+mane 12 14
+manok 12 16
+media 12 12
+meubak 12 12
+meucurak 12 13
+meudagang 12 14
+meugrak 12 13
+meunye 12 18
+meutapi 12 12
+meutuleh 12 14
+mil 12 12
+negeri 12 16
+neuduekjih 12 12
+neuseubot 12 13
+operasi 12 15
+pah 12 12
+pala 12 18
+para 12 12
+pariwisata 12 15
+payong 12 12
+peurintah 12 12
+pihak 12 12
+pimpen 12 12
+qubah 12 24
+raseuki 12 12
+ret 12 12
+roma 12 14
+sajan 12 14
+seluruh 12 12
+sep 12 12
+seulingka 12 12
+seumeubeuet 12 13
+sifeuet 12 15
+singgah 12 12
+sunat 12 19
+syeikh 12 15
+syuruga 12 16
+taiwan 12 14
+thai 12 15
+treuk 12 12
+tubohjih 12 19
+turkmenistan 12 13
+tuwi 12 12
+ukeue 12 12
+ukraina 12 15
+uleh 12 12
+wase 12 14
+xinjiang 12 13
+yub 12 14
+administratif 11 11
+adoe 11 16
+ako 11 12
+ana 11 12
+asaijih 11 11
+ate 11 17
+banten 11 14
+banyak 11 11
+besar 11 13
+beunuwa 11 19
+beureu 11 13
+binh 11 13
+binti 11 11
+brok 11 13
+cham 11 21
+chubu 11 11
+coklat 11 15
+cre 11 11
+daratan 11 11
+del 11 11
+denmark 11 18
+dimulai 11 11
+dolok 11 11
+eut 11 14
+fir 11 11
+garot 11 11
+geuhey 11 11
+geujaga 11 12
+geukirem 11 12
+geumeuprang 11 13
+geupeutheun 11 13
+geupeutubiet 11 14
+gulee 11 12
+hara 11 11
+haro 11 11
+hat 11 12
+hijrah 11 11
+hui 11 14
+ieropa 11 16
+irlandia 11 28
+jajahan 11 14
+jameuen 11 11
+jen 11 11
+jerango 11 12
+jernih 11 13
+jipeunan 11 11
+jrat 11 17
+kamchatka 11 13
+karap 11 11
+keupula 11 11
+khattab 11 12
+knil 11 15
+koloni 11 15
+kreueh 11 12
+lakoe 11 11
+longkib 11 12
+lutjanus 11 12
+maluku 11 11
+mameh 11 13
+mana 11 25
+maret 11 11
+marit 11 11
+meubahsa 11 12
+meugah 11 13
+meugantoe 11 11
+meujangeunasai 11 11
+meuneugoe 11 15
+meureudu 11 15
+meusaneut 11 11
+meusep 11 12
+meususon 11 15
+militer 11 13
+musara 11 11
+muslimin 11 13
+musyawarah 11 14
+muzakir 11 15
+naggroe 11 11
+nakhon 11 19
+nessen 11 25
+neubuet 11 11
+neupiyoh 11 11
+neuteurimong 11 12
+nikobar 11 22
+nusa 11 12
+okhotsk 11 11
+oktober 11 12
+panjoe 11 11
+paus 11 31
+puga 11 12
+puncak 11 15
+punti 11 11
+rasyidin 11 13
+reuda 11 11
+reudeup 11 11
+ruweueng 11 11
+saint 11 14
+sang 11 17
+sebagai 11 12
+seumbahyang 11 14
+seunambong 11 12
+seunjata 11 11
+seupot 11 11
+shaanxi 11 13
+syeh 11 14
+syekh 11 14
+syi 11 12
+symbian 11 17
+taturi 11 11
+tauhid 11 12
+teunong 11 11
+tingkeum 11 14
+titi 11 11
+tuanku 11 28
+tun 11 15
+udepjih 11 11
+yatsrib 11 15
+ambong 10 17
+apa 10 13
+arun 10 11
+asoejih 10 10
+ata 10 13
+belanda 10 13
+beuthat 10 11
+binatang 10 18
+din 10 11
+disinoe 10 10
+endonesiya 10 11
+euncit 10 11
+falaq 10 10
+fathimah 10 17
+fitri 10 13
+geografis 10 10
+geulindong 10 10
+geumeu 10 12
+geumeukeusud 10 10
+geumpang 10 10
+geunteng 10 12
+geupakek 10 14
+geupeuhah 10 11
+geupeusaboh 10 10
+geuplueng 10 11
+geutop 10 10
+geutron 10 10
+geuyakin 10 10
+giang 10 12
+gob 10 12
+hadiah 10 13
+hajat 10 10
+hamba 10 14
+hamid 10 13
+hijriah 10 13
+hilir 10 10
+hindu 10 10
+hokkaido 10 13
+holstein 10 11
+ilmiah 10 10
+international 10 11
+isra 10 13
+israel 10 11
+jaga 10 10
+jiboh 10 10
+jikirem 10 12
+jingui 10 10
+jipeuturi 10 10
+jiteuka 10 11
+jiwa 10 12
+juara 10 11
+kadang 10 12
+khueng 10 12
+kohler 10 12
+konstitusional 10 13
+kupi 10 14
+kyrgyzstan 10 11
+lakseumana 10 14
+latenjih 10 10
+leumiek 10 10
+leungka 10 10
+linteueng 10 13
+lut 10 10
+majapahit 10 19
+mali 10 13
+manee 10 10
+manfa 10 10
+meksiko 10 15
+merdeka 10 10
+meuakhe 10 10
+meubacut 10 10
+meulakee 10 10
+meurandeh 10 10
+meuribee 10 10
+mikronesia 10 11
+moderen 10 13
+monarki 10 20
+moskow 10 13
+muang 10 10
+museum 10 16
+neupeudong 10 10
+neupeujeuet 10 12
+neuraka 10 10
+nga 10 12
+non 10 10
+numboi 10 12
+nyum 10 11
+pabrek 10 27
+panteraja 10 10
+paul 10 10
+peut 10 10
+pinah 10 11
+qanun 10 19
+rahmat 10 10
+rante 10 13
+rapper 10 10
+reubot 10 10
+rhet 10 10
+richard 10 11
+sahara 10 11
+salar 10 24
+saleh 10 11
+sari 10 10
+satu 10 11
+schleswig 10 11
+seubeutoijih 10 10
+seueh 10 10
+seunang 10 10
+seunong 10 10
+sichuan 10 12
+sikutu 10 11
+sing 10 17
+siron 10 11
+sisek 10 15
+skala 10 12
+swiss 10 10
+syarat 10 12
+tahun 10 13
+tanyoe 10 10
+teuleubeh 10 10
+teuntang 10 10
+uem 10 16
+ukheue 10 12
+ulang 10 17
+umue 10 12
+undang 10 20
+utsman 10 15
+wareh 10 11
+yayasan 10 15
+yerusalem 10 10
diff --git a/tika-eval/tika-eval-core/src/main/resources/common_tokens/afr b/tika-eval/tika-eval-core/src/main/resources/common_tokens/afr
new file mode 100644
index 0000000000..9fcdf79213
--- /dev/null
+++ b/tika-eval/tika-eval-core/src/main/resources/common_tokens/afr
@@ -0,0 +1,30020 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#DOC_COUNT 468399
+#SUM_DOC_FREQS 12353817
+#SUM_TERM_FREQS 15662469
+#UNIQUE_TERMS 471297
+#TOKEN DOCFREQ TERMFREQ
+die 414235 1797681
+van 332951 720556
+het 202205 398898
+wat 159401 210416
+met 128972 166766
+word 123547 176204
+vir 106739 133822
+was 98215 139929
+deur 92910 112438
+dit 92524 118113
+aan 82514 101176
+ook 71178 79927
+tot 70462 87382
+nie 58236 119271
+uit 50667 56305
+dat 49869 62747
+hulle 49525 69755
+maar 43412 46521
+eerste 43360 49041
+hierdie 40839 45528
+daar 38932 43954
+soos 37209 41350
+oor 37192 41839
+ander 37058 40190
+suid 36632 43295
+kan 35450 44136
+een 34637 38707
+jaar 31633 42337
+groot 31054 34218
+onder 30770 33683
+gebruik 30533 36446
+baie 30469 33102
+meer 29001 32190
+bekend 28587 29535
+twee 27863 31183
+afrika 26747 31143
+tussen 26600 29540
+teen 25395 29548
+toe 24978 27433
+hul 23395 28309
+begin 22977 24908
+waar 22562 24467
+bestaan 20535 21467
+haar 20178 32662
+hom 19647 23257
+tydens 19028 20844
+afrikaanse 19012 22024
+later 18795 19794
+amerikaanse 18679 19789
+voor 18436 19873
+net 18032 19147
+egter 17655 18151
+nog 17653 18929
+nuwe 17524 19673
+naam 16578 18577
+deel 16092 17444
+keer 16069 17238
+the 15560 23663
+terwyl 15409 15870
+volgens 15217 16042
+tweede 15170 15987
+eeu 15081 17041
+drie 14888 16222
+veral 14797 15448
+gebore 14579 15231
+gehad 14453 15307
+sou 14278 17367
+kom 14259 15199
+kon 14115 15812
+kerk 14101 18423
+mense 13772 15537
+maak 13694 14412
+saam 13652 14563
+verskeie 13142 13726
+laat 12924 13804
+werk 12456 13830
+vorm 12344 13530
+water 12234 14074
+geword 12228 13092
+stad 12138 15538
+weer 12086 13067
+tyd 12046 13078
+neem 11975 12285
+genoem 11768 12578
+klein 11734 12568
+sowat 11725 13412
+land 11665 13066
+gemeente 11626 17908
+gebied 11517 12837
+nasionale 11408 13526
+grootste 11349 12652
+gemaak 11332 11907
+nadat 11259 11653
+vanaf 11117 12043
+wees 11101 12156
+omdat 10711 11284
+spons 10570 11164
+dan 10530 11417
+gevolg 10481 10893
+noord 10236 11438
+reeds 10132 10565
+sal 10108 12964
+moet 10106 11746
+staat 10106 10517
+staan 9995 10311
+hoe 9984 11249
+dikwels 9908 10521
+rolle 9905 9988
+beskou 9885 10433
+lank 9877 10497
+slegs 9713 10142
+familie 9548 10523
+gewone 9536 11181
+meeste 9503 10002
+lewe 9439 10241
+geen 9429 10035
+hier 9324 9967
+dus 9286 9706
+alle 9281 9824
+dieselfde 9263 9819
+wanneer 9219 10148
+vier 9186 9854
+sedert 9029 9586
+mei 9020 9523
+dood 8934 9797
+gaan 8884 9647
+oktober 8836 9227
+januarie 8816 9259
+oos 8644 9775
+jare 8632 8891
+eie 8583 9078
+gestig 8583 9114
+wes 8547 9647
+augustus 8543 8926
+britse 8522 10021
+april 8466 8873
+ste 8463 9492
+verenigde 8421 9384
+julie 8415 8806
+maart 8407 8802
+desember 8382 8794
+junie 8362 8729
+wereld 8344 9103
+september 8343 8722
+rolprente 8328 8423
+aantal 8256 8732
+duitse 8250 9786
+eers 8229 8463
+gelee 8223 8749
+gepubliseer 8205 8447
+daarna 8192 8458
+februarie 8182 8512
+sommige 8179 8565
+sluit 8173 8447
+ten 8149 8496
+november 8147 8457
+moes 8118 9091
+gewoonlik 8067 8727
+gebou 8000 9538
+einde 7978 8433
+waarin 7944 8256
+bevolking 7941 8980
+akteur 7860 8005
+liggaam 7747 8204
+behoort 7736 8017
+asook 7719 7851
+steeds 7687 7957
+ontwikkel 7602 8100
+nou 7555 7900
+elke 7476 8339
+ontstaan 7436 7768
+belangrike 7430 7673
+universiteit 7387 9519
+engels 7336 7944
+verskillende 7252 7997
+volgende 7248 7412
+naby 7190 7546
+stel 7173 7800
+plaaslike 7131 7917
+plaas 7122 7913
+gedurende 7116 7489
+laaste 7106 7514
+hoewel 7094 7193
+byvoorbeeld 6986 7282
+franse 6967 8299
+politieke 6870 7675
+binne 6852 7218
+daarvan 6843 7068
+verwys 6841 7325
+selfs 6823 7023
+regering 6817 7602
+seun 6764 7552
+dorp 6722 8290
+kort 6702 7003
+skrywer 6698 6905
+oorlog 6607 7596
+wetenskaplike 6576 6720
+groep 6530 7791
+dae 6517 6979
+soms 6515 6946
+ongeveer 6496 7195
+plek 6469 7124
+verder 6456 6650
+internasionale 6452 7349
+spesie 6418 6683
+koning 6416 7893
+skryf 6413 7117
+ryk 6412 7447
+kinders 6393 7345
+indeling 6388 6403
+mens 6313 7241
+weens 6310 6489
+taksonomiese 6304 6307
+genus 6291 6870
+europa 6283 6847
+middel 6278 6560
+voorkom 6266 6522
+sponsspesie 6259 6259
+waarvan 6245 6401
+vrou 6219 6957
+moontlik 6217 6489
+besluit 6178 6665
+gee 6166 6433
+frankryk 6162 6966
+rol 6132 6513
+bevat 6131 6605
+gehou 6084 6421
+vyf 6069 6450
+ontvang 6050 6414
+kaap 6030 6856
+bly 6003 6220
+lande 5953 6661
+self 5935 6154
+engelse 5932 6471
+sonder 5913 6139
+paar 5885 6196
+hele 5879 6028
+miljoen 5864 7644
+tydperk 5856 6311
+taal 5855 7594
+groter 5812 6236
+man 5759 6463
+pous 5734 8769
+maande 5721 5989
+state 5687 6281
+vroee 5677 5893
+geneem 5653 5852
+algemene 5646 5912
+swart 5623 6744
+hoofsaaklik 5610 5770
+aktrise 5581 5681
+kry 5577 5839
+derde 5572 5794
+duitsland 5540 6249
+bereik 5539 5842
+sponse 5511 5531
+algemeen 5494 5669
+kaapstad 5491 6028
+europese 5462 6258
+enige 5455 5736
+verskyn 5448 5866
+demospongiae 5432 5432
+geskiedenis 5432 5758
+geskryf 5432 5825
+ons 5423 8133
+aangesien 5390 5488
+hou 5384 5649
+party 5376 7480
+wit 5347 6523
+hoofstad 5336 5863
+beskryf 5278 5517
+per 5273 6115
+engeland 5271 6092
+sterk 5270 5504
+mag 5228 5869
+moderne 5222 5564
+tans 5197 5343
+vandag 5189 5333
+gespeel 5174 5829
+gekom 5170 5323
+gelei 5151 5326
+verander 5102 5461
+sodat 5100 5220
+speel 5038 5456
+daardie 5029 5192
+wie 5016 5292
+kieselnaalde 5008 5008
+pretoria 5007 5928
+sponginevesels 5007 5007
+aanvaar 4988 5202
+ter 4977 5182
+belangrikste 4966 5123
+veroorsaak 4943 5351
+wereldoorlog 4931 5115
+gebiede 4920 5362
+huidige 4904 5155
+ontwerp 4900 5467
+grond 4868 5620
+minder 4867 5124
+sien 4833 5036
+afrikaans 4800 5715
+aarde 4785 5952
+gereformeerde 4777 5932
+reeks 4756 5362
+doen 4742 4975
+dag 4741 5356
+bekende 4731 4892
+langs 4691 4954
+see 4690 5482
+volg 4687 4769
+ses 4669 4888
+gedoen 4664 4819
+enkele 4659 4778
+mekaar 4649 5129
+dele 4647 4947
+enigste 4645 4768
+skool 4629 5747
+aanvanklik 4624 4674
+beteken 4619 4983
+gewen 4616 5390
+gegee 4611 4750
+talle 4602 4719
+ekonomiese 4592 5106
+der 4581 5238
+beide 4544 4694
+amerika 4536 5063
+geldig 4516 4520
+ontwikkeling 4513 4742
+provinsie 4511 5030
+and 4499 5029
+besoek 4497 4781
+republiek 4434 5145
+gekry 4425 4634
+sowel 4369 4513
+lid 4352 4874
+president 4333 4977
+inwoners 4324 4683
+johannesburg 4321 5130
+boek 4311 5054
+huis 4293 4926
+mees 4243 4410
+bou 4238 4533
+koninkryk 4187 4627
+terug 4185 4370
+beheer 4167 4475
+oorlede 4165 4410
+min 4151 4284
+beste 4140 4810
+vind 4133 4279
+woord 4125 5027
+eiland 4083 5542
+alhoewel 4079 4128
+gevind 4077 4310
+wel 4073 4189
+ontdek 4070 4450
+leer 4069 4605
+militere 4050 4439
+lede 4025 4526
+sekere 4025 4246
+jong 3996 4241
+buite 3992 4106
+amptelike 3987 4319
+omgewing 3982 4167
+verklaar 3982 4140
+russiese 3963 4756
+gevorm 3962 4213
+andere 3918 4015
+gesien 3911 4093
+goed 3910 4083
+historiese 3877 4110
+verbind 3870 4112
+daarop 3799 3875
+rooi 3777 4606
+goeie 3753 3925
+uiteindelik 3725 3779
+nederland 3702 4057
+rusland 3701 4351
+val 3693 3885
+waarskynlik 3689 3796
+romeinse 3670 4456
+voltooi 3657 3824
+nieu 3651 4562
+invloed 3650 3783
+lei 3639 3797
+albei 3626 3803
+nederlandse 3624 4062
+ouderdom 3614 3803
+john 3611 3798
+oorspronklike 3604 3743
+oudste 3589 3837
+bepaal 3587 3805
+verloor 3578 3828
+munisipaliteit 3572 4043
+vervaardiger 3568 3603
+gebly 3565 3645
+ooste 3559 3763
+probeer 3555 3720
+suidelike 3522 3805
+noorde 3518 3680
+titel 3516 3869
+vervang 3516 3669
+streek 3509 3855
+verkry 3502 3636
+geval 3499 3644
+dien 3491 3625
+behaal 3487 3718
+vanwee 3484 3559
+vader 3480 3899
+vis 3480 5681
+diens 3465 3755
+nooit 3463 3588
+byna 3456 3514
+spesies 3451 4363
+grens 3446 3886
+verkies 3435 3708
+god 3434 4333
+wil 3430 3728
+londen 3423 3787
+hoer 3412 3661
+gestel 3387 3468
+want 3387 3491
+voormalige 3379 3512
+groei 3371 3709
+kerkraad 3363 4201
+verskil 3352 3509
+meestal 3347 3449
+werke 3334 3701
+handel 3332 3497
+kleiner 3326 3519
+gevestig 3323 3440
+loop 3323 3570
+almal 3302 3426
+suide 3296 3470
+betrokke 3279 3381
+sewe 3267 3479
+opgerig 3226 3377
+natal 3211 3549
+predikant 3209 3570
+australie 3206 3764
+sogenaamde 3205 3277
+rolprent 3201 3529
+diere 3194 3752
+trek 3176 3396
+rivier 3173 4121
+tale 3173 4274
+woon 3169 3347
+kaapse 3165 3477
+aangestel 3164 3382
+altyd 3159 3311
+vervaardig 3153 3370
+new 3149 3593
+noordelike 3126 3344
+oorspronklik 3126 3171
+soort 3110 3260
+pad 3101 3584
+verkoop 3100 3345
+nedersetting 3092 3277
+kalender 3071 3338
+italie 3062 3389
+katolieke 3062 3315
+keiser 3059 3617
+dui 3058 3299
+term 3052 3452
+distrik 3049 3399
+frans 3036 3449
+lyk 3034 3219
+waarna 3034 3087
+groepe 3030 3361
+vroue 3030 3727
+bring 3024 3091
+lig 3024 3470
+dogter 3022 3274
+griekse 3017 3463
+opgeneem 3010 3241
+stelsel 3010 3489
+daarin 3006 3061
+indie 3005 3743
+aangetref 3004 3204
+verdeel 3002 3113
+minister 3000 3568
+televisiereekse 2999 2999
+eerder 2995 3073
+dra 2990 3196
+stede 2990 3256
+destyds 2986 3044
+voordat 2984 3042
+stigting 2972 3147
+meter 2970 3898
+aangebied 2954 3194
+voorheen 2950 3017
+bied 2943 3045
+druk 2943 3289
+persoon 2940 3300
+antieke 2932 3212
+leraar 2913 3330
+hoogste 2906 3222
+jan 2898 3239
+oseaan 2890 3411
+woorde 2888 3290
+sentrale 2887 3025
+eilande 2886 3754
+verlaat 2883 2959
+plaasgevind 2880 2963
+tradisionele 2877 3039
+weke 2873 2950
+vlag 2871 5353
+wet 2869 3448
+vrystaat 2866 3144
+wou 2854 3083
+johannes 2848 3164
+omstreeks 2846 3060
+vsa 2843 3122
+bewind 2838 2987
+beeld 2834 3108
+son 2830 3669
+verteenwoordig 2830 3036
+openbare 2829 3018
+waaronder 2823 2863
+manier 2815 2904
+beweeg 2813 3151
+lewer 2810 2969
+geplaas 2807 2920
+beweging 2803 3140
+china 2803 3310
+sterf 2800 2861
+naas 2798 2849
+gebring 2797 2849
+iii 2797 3070
+weste 2797 2922
+kant 2793 3223
+naamlik 2775 2813
+raak 2770 2883
+artikel 2767 3501
+sosiale 2764 3057
+geraak 2760 2815
+kuns 2757 3228
+natuurlike 2749 2961
+verhaal 2749 3077
+generaal 2745 3028
+kerkgebou 2743 3144
+leef 2742 2939
+ondersoek 2742 2937
+japan 2725 3611
+indien 2715 2888
+menslike 2706 2921
+musiek 2705 3325
+bevestig 2703 2833
+verskeidenheid 2701 2760
+lidmate 2699 3339
+verhouding 2697 2998
+oud 2696 2884
+indiese 2693 3068
+rondom 2681 2773
+vinnig 2679 2774
+raad 2676 3104
+broer 2668 2933
+geld 2664 2855
+gregoriaanse 2663 2684
+daarom 2662 2694
+gedigte 2661 3719
+kennis 2650 2927
+prys 2650 3260
+toon 2649 2738
+agt 2647 2772
+george 2639 2930
+gedien 2637 2738
+gestuur 2634 2738
+getroud 2613 2850
+destydse 2612 2655
+hoof 2611 2787
+unie 2602 2915
+voorbeeld 2596 2665
+kleur 2592 2992
+vlak 2592 2877
+sentraal 2590 2727
+laasgenoemde 2584 2592
+weg 2582 2662
+latere 2581 2636
+stellenbosch 2581 2953
+punt 2580 2962
+waarop 2580 2635
+geskep 2577 2665
+teenoor 2575 2719
+beter 2566 2684
+kus 2566 2746
+sodoende 2562 2588
+kultuur 2559 2776
+digter 2557 2665
+verwerf 2546 2656
+vergadering 2537 2866
+amptelik 2536 2591
+beperk 2536 2624
+beskikbaar 2534 2664
+doel 2534 2607
+duidelik 2534 2575
+erken 2532 2667
+letterkunde 2528 2701
+vroeer 2524 2554
+boeke 2522 2868
+proses 2522 2784
+tog 2507 2568
+vertaal 2504 2648
+help 2503 2622
+oorsprong 2502 2615
+tree 2498 2578
+verkiesing 2488 2892
+vanuit 2487 2595
+besit 2483 2600
+verslaan 2483 2713
+lae 2477 2736
+beskik 2476 2544
+orde 2474 2899
+verskaf 2470 2564
+gemeenskap 2461 2649
+gereeld 2456 2516
+verdere 2447 2498
+kulturele 2446 2612
+basis 2445 2588
+wen 2439 2695
+slag 2438 2716
+rooms 2436 2534
+agter 2426 2526
+hoog 2422 2532
+rome 2422 2795
+gebaseer 2414 2482
+verband 2413 2498
+ingesluit 2411 2483
+regisseur 2408 2518
+reg 2404 2575
+leier 2403 2548
+vertrek 2402 2526
+plekke 2395 2537
+leiding 2390 2464
+huwelik 2382 2737
+blou 2378 2931
+posisie 2376 2522
+magte 2375 2600
+klas 2374 2905
+televisiereeks 2373 2384
+parys 2354 2600
+gese 2352 2488
+nodig 2350 2437
+duits 2348 2641
+deelstaat 2346 2584
+transvaal 2346 2570
+sterre 2342 3278
+oppervlakte 2337 2448
+gestaan 2335 2368
+lug 2333 2826
+persent 2330 3757
+danksy 2328 2349
+res 2304 2332
+veel 2304 2360
+verower 2303 2424
+studie 2297 2503
+mate 2292 2347
+oostelike 2291 2380
+roman 2289 2720
+mans 2287 2752
+ster 2285 3204
+totale 2283 2445
+asie 2282 2507
+studeer 2282 2455
+insluitende 2281 2322
+kilometer 2277 2833
+stryd 2276 2385
+westelike 2276 2394
+genoeg 2269 2358
+voel 2267 3363
+tydskrif 2262 2474
+brittanje 2259 2503
+kind 2256 2596
+spesiale 2253 2347
+eindelik 2250 2287
+beroep 2248 2777
+vierde 2235 2305
+politikus 2234 2251
+tien 2234 2339
+helfte 2231 2401
+italiaanse 2231 2473
+boere 2227 2510
+vorige 2227 2282
+afgelei 2226 2319
+voorgestel 2220 2325
+sentrum 2212 2325
+skep 2210 2302
+ouer 2207 2323
+navorsing 2200 2332
+volk 2199 2417
+gemeentes 2197 2591
+beinvloed 2193 2266
+william 2174 2317
+rigting 2172 2471
+graad 2170 2759
+versprei 2168 2266
+gesin 2167 2360
+toegeken 2162 2308
+wedstryde 2160 2693
+inligting 2154 2420
+voorsien 2154 2209
+sake 2153 2264
+geboue 2152 2342
+onderwys 2150 2418
+weergawe 2148 2392
+anders 2145 2184
+gele 2144 2197
+seuns 2143 2351
+deelgeneem 2141 2291
+nederlands 2141 2486
+homself 2140 2233
+bestuur 2134 2283
+christelike 2132 2356
+diep 2130 2204
+plante 2126 2581
+teenstelling 2126 2133
+vroeg 2119 2151
+heilige 2118 2330
+reis 2113 2351
+vertel 2110 2250
+eienskappe 2109 2303
+behalwe 2105 2123
+gekies 2103 2202
+kerke 2090 2399
+bevorder 2088 2137
+regte 2084 2236
+buitelandse 2082 2254
+maria 2081 2387
+gekenmerk 2078 2100
+seeland 2076 2434
+omtrent 2075 2208
+ouers 2072 2249
+alles 2071 2202
+laer 2065 2192
+spesifieke 2061 2174
+wyse 2058 2119
+hand 2051 2191
+gegaan 2050 2083
+elemente 2047 2351
+voorsitter 2043 2297
+beskerm 2042 2127
+paul 2039 2223
+pas 2036 2241
+herstel 2035 2142
+kanada 2034 2305
+oppervlak 2031 2250
+gedeelte 2029 2178
+strek 2028 2098
+oop 2027 2120
+hendrik 2024 2408
+periode 2019 2173
+volle 2016 2067
+hierna 2012 2049
+vertoon 2008 2163
+chinese 2004 2520
+parlement 2001 2255
+los 1999 2182
+gewerk 1998 2084
+charles 1997 2114
+york 1997 2232
+status 1996 2116
+elk 1994 2127
+geleentheid 1994 2048
+gelede 1993 2284
+massa 1993 2453
+gewilde 1992 2037
+wissel 1990 2094
+bundel 1989 2421
+egipte 1989 2331
+energie 1987 2701
+ierland 1987 2599
+hiervan 1980 1996
+heeltemal 1978 2024
+styl 1975 2174
+maklik 1974 2048
+administratiewe 1973 2128
+ekonomie 1973 2203
+verantwoordelik 1973 2049
+afstand 1970 2187
+sowjetunie 1970 2229
+waarde 1968 2242
+groen 1966 2320
+glo 1964 2122
+kop 1963 2250
+moeder 1962 2152
+oorwinning 1960 2106
+elizabeth 1957 2199
+vloei 1956 2331
+name 1953 2175
+bekendste 1952 1983
+park 1952 2568
+totdat 1952 1980
+onafhanklike 1944 2003
+sukses 1941 1994
+ver 1939 2002
+spanne 1933 2626
+namibie 1932 2220
+chemiese 1931 2200
+russies 1930 2132
+spanje 1923 2137
+aandag 1922 1968
+aangeneem 1922 1980
+intussen 1920 1949
+probleme 1920 2009
+wedstryd 1919 2342
+materiaal 1918 2192
+voer 1918 1953
+nege 1916 1998
+skotland 1911 2281
+stem 1908 2039
+waarmee 1908 1940
+goue 1904 2120
+departement 1903 2092
+kwazulu 1901 1973
+liefde 1901 2131
+meerderheid 1896 2090
+opgevolg 1895 1960
+gewoon 1893 1968
+swaar 1893 1965
+goewerneur 1891 2115
+insluitend 1889 1924
+uitgevoer 1889 1953
+klassieke 1886 2065
+soek 1884 1961
+sint 1875 2194
+vrygestel 1875 2050
+gewild 1874 1926
+loopbaan 1874 1926
+aard 1872 1913
+gemiddelde 1868 2202
+hoogte 1868 2044
+onderskei 1863 1894
+verhoog 1859 1960
+suidwes 1854 2037
+trou 1853 1980
+beleid 1850 2021
+aanleiding 1844 1865
+maatskappy 1838 2161
+gevalle 1837 1933
+vernoem 1834 1893
+inheemse 1833 1929
+iets 1828 1946
+museum 1828 2327
+belang 1827 1876
+steun 1824 1906
+betekenis 1822 2022
+bedryf 1821 1923
+ontmoet 1821 1898
+von 1820 2110
+oranje 1814 2039
+geniet 1812 1835
+swak 1811 1924
+behou 1808 1851
+louis 1806 1940
+prins 1805 2150
+sulke 1798 1858
+tye 1794 1868
+eeue 1791 1825
+spaanse 1790 2047
+feitlik 1789 1811
+vervoer 1788 1948
+demokratiese 1782 1906
+rede 1782 1830
+benoem 1780 1877
+drama 1777 2154
+soortgelyke 1777 1817
+dienste 1776 1939
+james 1776 1930
+temperatuur 1773 2133
+sir 1772 1924
+wetenskap 1771 1903
+opsigte 1769 1826
+voorbeelde 1767 1822
+eenheid 1764 1971
+soldate 1763 1978
+troepe 1758 1944
+onderneem 1757 1808
+tipe 1757 1969
+organisasie 1755 1932
+onafhanklikheid 1752 1860
+pole 1750 2061
+vestig 1749 1794
+bewaar 1748 1798
+persoonlike 1737 1823
+getal 1735 2001
+praat 1734 1883
+gepraat 1730 1966
+saak 1730 1867
+toegelaat 1729 1785
+soorte 1728 1867
+professor 1724 1891
+warm 1724 1895
+krag 1722 1989
+hoerskool 1718 2012
+wys 1713 1794
+bedien 1707 1819
+waardeur 1706 1737
+ondersteun 1701 1770
+geglo 1698 1770
+besonder 1696 1725
+duur 1696 1778
+jaarlikse 1696 1790
+nogtans 1696 1712
+elektriese 1695 2080
+terugkeer 1695 1731
+bloemfontein 1690 1877
+koningin 1690 1882
+voorwerpe 1689 1983
+waargeneem 1689 1771
+daartoe 1687 1696
+sit 1687 1745
+verhuis 1687 1760
+daarmee 1685 1707
+japannese 1683 1996
+feit 1682 1707
+voels 1678 1987
+bestaande 1675 1718
+geopen 1675 1755
+bron 1673 1759
+burgers 1673 1833
+geel 1673 1940
+beweer 1669 1742
+skole 1669 1899
+bruin 1668 1910
+geloof 1665 1780
+regeer 1665 1771
+gelewer 1663 1690
+kruger 1661 2015
+struktuur 1661 1879
+amper 1659 1728
+dorpie 1658 1879
+verbeter 1658 1708
+aangesluit 1650 1708
+burger 1650 1768
+grootte 1650 1758
+uitgawe 1650 1802
+uitgebrei 1648 1686
+donker 1645 1879
+oorgeneem 1644 1678
+verminder 1644 1728
+gebeur 1643 1701
+jarige 1641 1720
+toernooi 1641 2029
+grieks 1640 1761
+langer 1635 1693
+verhale 1629 1965
+lengte 1628 1752
+joodse 1624 2103
+behandel 1621 1681
+natuur 1621 1799
+lys 1619 1782
+vernietig 1613 1680
+vrede 1613 1751
+hulp 1609 1675
+insluit 1606 1642
+willem 1606 1820
+teorie 1605 1830
+alleen 1603 1639
+prof 1603 1828
+plant 1600 1917
+kombinasie 1599 1682
+hoeveelheid 1597 1738
+klub 1594 2620
+vloot 1594 1898
+bepaalde 1586 1702
+poging 1585 1620
+riviere 1584 1757
+stadium 1583 1637
+bewys 1582 1656
+getrek 1581 1612
+koninklike 1580 1720
+berg 1578 1952
+vermoor 1572 1657
+afrikaners 1569 1749
+ernstige 1569 1607
+port 1569 1819
+publiseer 1568 1624
+teruggekeer 1567 1608
+belangstelling 1566 1610
+karakter 1566 1660
+robert 1566 1647
+dateer 1564 1593
+verseker 1564 1601
+bydrae 1559 1617
+godsdienstige 1557 1646
+iemand 1557 1683
+olimpiese 1555 2189
+opdrag 1555 1617
+seisoen 1552 1888
+beslaan 1549 1588
+belangrik 1545 1576
+moeilik 1545 1575
+heelwat 1543 1569
+zimbabwe 1541 1837
+relatief 1538 1584
+ware 1537 1606
+afdeling 1536 1823
+sinode 1536 1937
+maan 1535 2113
+verwyder 1534 1625
+argitek 1532 1609
+studies 1528 1611
+versameling 1527 1744
+mark 1524 1671
+aangekondig 1521 1590
+finansiele 1521 1625
+bronne 1520 1636
+streke 1519 1604
+blyk 1516 1533
+toestand 1516 1662
+gevra 1515 1563
+gewees 1514 1602
+ondanks 1514 1523
+daarvoor 1512 1534
+dinastie 1512 1893
+etniese 1509 1734
+oorheers 1509 1533
+punte 1506 1873
+skrywers 1505 1606
+studente 1505 1738
+vrye 1503 1622
+toekenning 1502 1713
+betaal 1501 1605
+projek 1501 1695
+aangeteken 1497 1623
+samelewing 1497 1632
+plaasvind 1496 1559
+spelers 1493 1866
+stand 1492 1537
+nes 1489 1648
+noem 1488 1541
+kos 1487 1677
+onbekend 1485 1517
+opgetree 1485 1543
+goud 1483 1769
+opleiding 1481 1579
+besig 1479 1514
+produksie 1479 1605
+ruimte 1477 1667
+versoek 1477 1576
+onderwerp 1476 1551
+boom 1471 2082
+moontlike 1464 1506
+pogings 1463 1485
+gedra 1459 1675
+vliegtuig 1459 1904
+daarnaas 1456 1464
+kleure 1456 1801
+uiters 1455 1480
+hoop 1454 1531
+aanval 1453 1596
+lughawe 1450 2362
+oog 1450 1573
+blare 1449 1833
+skiereiland 1447 1616
+wallis 1445 1766
+omstandighede 1444 1476
+latyn 1443 1682
+filosofie 1442 1812
+sin 1438 1550
+stig 1438 1470
+bedek 1437 1523
+terrein 1437 1551
+somer 1436 1510
+plan 1435 1591
+voet 1435 1635
+aangewys 1432 1487
+kaapkolonie 1431 1488
+vlug 1430 1544
+verlede 1428 1523
+geslaag 1426 1451
+model 1426 1614
+vergelyking 1424 1498
+thomas 1422 1517
+stemme 1419 1901
+opvolger 1416 1477
+arabiese 1413 1689
+david 1411 1497
+botha 1410 1618
+voorstad 1410 1515
+artikels 1409 1549
+berlyn 1409 1744
+ingevoer 1409 1456
+uur 1409 1618
+foto 1406 1675
+gou 1406 1446
+behels 1402 1435
+begrawe 1401 1491
+grand 1401 1695
+kunstenaars 1398 1535
+idee 1396 1491
+miljard 1394 1865
+pieter 1392 1554
+oostenryk 1391 1641
+klimaat 1390 1525
+benewens 1389 1399
+stille 1389 1487
+koste 1388 1494
+vyfde 1386 1425
+winter 1385 1474
+karakters 1383 1586
+durban 1382 1622
+wereldwyd 1382 1414
+stuur 1378 1437
+suster 1375 1461
+jaarliks 1372 1424
+ooreenkoms 1371 1475
+verskuif 1368 1402
+opstand 1367 1514
+maand 1364 1552
+planeet 1364 1767
+getalle 1363 1552
+suider 1362 1443
+bestudeer 1361 1417
+grootliks 1361 1370
+spyte 1359 1362
+landbou 1358 1461
+geeindig 1355 1456
+verandering 1354 1475
+radio 1353 1587
+simbool 1353 1507
+bevind 1352 1413
+vol 1352 1383
+noordwes 1351 1390
+siekte 1351 1567
+alexander 1350 1501
+skip 1348 1698
+vele 1348 1369
+dekades 1346 1354
+setel 1345 1410
+teks 1345 1572
+geestelike 1344 1436
+geleidelik 1342 1361
+politiek 1338 1396
+niks 1337 1373
+gevolglik 1335 1344
+verleen 1335 1361
+atmosfeer 1334 1570
+grondwet 1334 1524
+onderskeidelik 1334 1368
+beurt 1332 1384
+reaksie 1332 1450
+stuk 1332 1488
+gebeure 1331 1424
+kommissie 1330 1617
+program 1330 1509
+tradisie 1330 1385
+beklee 1327 1367
+westerse 1327 1422
+geheel 1326 1348
+sedertdien 1325 1331
+ligging 1324 1366
+stedelike 1323 1415
+vermoe 1322 1396
+persone 1318 1375
+eeuse 1316 1374
+grense 1316 1377
+hart 1312 1478
+skepe 1312 1524
+mediese 1308 1442
+nedersettings 1308 1397
+onafhanklik 1307 1340
+besondere 1304 1326
+latynse 1304 1389
+provinsiale 1303 1401
+voort 1303 1321
+droe 1301 1405
+vas 1301 1367
+eenvoudige 1299 1352
+sokker 1299 1662
+jou 1298 1686
+werklikheid 1298 1398
+aangedui 1297 1350
+album 1297 1783
+weermag 1296 1446
+san 1295 1540
+wyk 1295 1477
+veld 1294 1411
+gesluit 1293 1330
+atlantiese 1292 1386
+den 1291 1520
+verdwyn 1291 1314
+vereniging 1290 1448
+dis 1288 1337
+geskenk 1288 1353
+gelyk 1285 1365
+lyn 1285 1526
+element 1282 1562
+oorleef 1282 1334
+stam 1282 1436
+koop 1280 1331
+nasies 1280 1381
+probleem 1280 1368
+amp 1278 1353
+for 1278 1341
+vroulike 1278 1408
+afkomstig 1277 1315
+pos 1276 1369
+dalk 1275 1333
+anna 1274 1479
+plessis 1273 1497
+roete 1267 1399
+fokus 1266 1322
+louw 1262 1563
+produkte 1261 1367
+toegeneem 1261 1299
+bedank 1260 1318
+potchefstroom 1259 1433
+ken 1257 1303
+stof 1257 1453
+kern 1255 1513
+rugby 1254 1692
+besef 1253 1276
+vervolgens 1253 1265
+federale 1252 1523
+kaptein 1251 1396
+geboorte 1250 1342
+gesterf 1250 1288
+hawe 1249 1458
+vertaling 1247 1420
+dorpe 1246 1324
+aartsbiskop 1245 1305
+soortgelyk 1244 1265
+behulp 1240 1278
+terme 1239 1319
+middeleeue 1234 1286
+ontdekking 1234 1328
+koue 1233 1340
+nederduitse 1231 1257
+rand 1231 1334
+biskop 1230 1379
+brand 1230 1388
+australiese 1229 1404
+swede 1229 1446
+dinge 1228 1317
+eintlik 1227 1246
+gevoel 1224 1279
+broers 1223 1340
+direk 1221 1252
+skaars 1218 1224
+metode 1217 1344
+effens 1215 1264
+publiek 1215 1244
+teken 1215 1295
+sowjet 1214 1380
+kolonie 1213 1354
+gebrek 1212 1251
+koloniale 1211 1317
+weeg 1211 1283
+wikipedia 1211 1614
+samewerking 1210 1249
+formule 1209 1398
+getoon 1207 1236
+heel 1207 1233
+uitbreiding 1207 1243
+belgie 1206 1355
+gekoop 1204 1248
+uitgegee 1204 1254
+gegroei 1202 1228
+pers 1201 1330
+troon 1199 1315
+hofmeyr 1198 1553
+rewolusie 1197 1335
+anglo 1195 1251
+poolse 1195 1429
+aktief 1194 1226
+gevaar 1194 1230
+saamgestel 1194 1234
+laag 1193 1389
+redakteur 1193 1354
+voorkoms 1192 1297
+afrikaner 1191 1317
+kunstenaar 1190 1252
+vryheidsoorlog 1190 1220
+gas 1187 1402
+hande 1187 1224
+altesaam 1186 1198
+israel 1186 1413
+african 1183 1277
+aktiewe 1183 1250
+stamme 1183 1360
+akademie 1181 1342
+bome 1181 1340
+national 1179 1265
+komponis 1178 1217
+voedsel 1178 1295
+vryheid 1178 1304
+agtergrond 1177 1248
+media 1176 1307
+nag 1175 1283
+denemarke 1174 1406
+gesag 1174 1276
+moskou 1173 1393
+voorwerp 1172 1503
+dier 1171 1346
+vaste 1171 1232
+binnelandse 1169 1207
+aansienlik 1166 1184
+vliegtuie 1166 1369
+koerant 1165 1389
+verstaan 1164 1223
+manlike 1163 1299
+hulself 1162 1209
+paleis 1160 1466
+bybel 1159 1314
+huisves 1158 1177
+lyf 1155 1481
+stigter 1155 1177
+daaropvolgende 1154 1162
+vernaamste 1154 1167
+geskei 1153 1199
+jongste 1153 1198
+midde 1153 1195
+verslag 1153 1235
+waartydens 1153 1161
+primere 1150 1295
+teologiese 1150 1275
+minstens 1149 1196
+mond 1149 1246
+smith 1149 1349
+suidoos 1148 1177
+eindig 1145 1222
+geveg 1143 1205
+karel 1143 1389
+basiese 1141 1211
+eens 1141 1153
+sanger 1141 1185
+suiwer 1141 1214
+henry 1140 1222
+godsdiens 1137 1245
+hof 1137 1271
+victoria 1136 1282
+ondergaan 1135 1163
+huise 1134 1238
+literere 1134 1231
+motor 1134 1348
+duisende 1129 1146
+waarby 1128 1154
+jonger 1125 1161
+ligte 1125 1174
+uitgereik 1125 1199
+toegang 1123 1182
+pastorie 1122 1312
+getrou 1120 1157
+optrede 1119 1161
+red 1119 1187
+twaalf 1119 1189
+elkeen 1118 1155
+uitvoerende 1118 1230
+poesie 1117 1240
+volwasse 1117 1198
+tegnologie 1116 1215
+blykbaar 1115 1133
+letterlik 1115 1166
+draai 1114 1218
+voorstel 1114 1188
+ingestel 1113 1146
+provinsies 1113 1226
+tipiese 1113 1136
+dogters 1112 1188
+ontbind 1112 1145
+afsonderlike 1110 1147
+south 1110 1213
+via 1110 1182
+vorme 1110 1195
+professionele 1109 1181
+ooit 1108 1135
+konflik 1106 1222
+redes 1106 1145
+betrekking 1105 1140
+bygedra 1105 1113
+munisipale 1105 1162
+teater 1105 1371
+vrugte 1105 1245
+verwerk 1103 1145
+geweier 1102 1130
+richard 1101 1188
+beset 1100 1154
+hoeveelhede 1100 1141
+joernalis 1100 1137
+ierse 1099 1302
+kanadese 1099 1279
+hoogtepunt 1098 1113
+soveel 1098 1140
+switserland 1098 1178
+uitgespreek 1097 1159
+toekoms 1096 1134
+uitgebeeld 1096 1148
+kommersiele 1095 1134
+verdrag 1095 1255
+vroeere 1095 1114
+begrip 1094 1170
+oom 1094 1268
+beleef 1093 1108
+gesondheid 1093 1157
+hout 1093 1235
+vermoedelik 1093 1124
+des 1092 1218
+skerp 1091 1123
+vereis 1091 1140
+toestande 1088 1162
+verwant 1088 1144
+albert 1085 1150
+inkomste 1085 1180
+jode 1085 1413
+bokant 1083 1143
+funksie 1083 1246
+gedig 1083 1255
+verbied 1083 1139
+berge 1082 1180
+ingewy 1082 1121
+mosambiek 1082 1150
+vra 1080 1120
+onlangse 1079 1093
+brasilie 1078 1217
+versterk 1078 1100
+wye 1078 1096
+toit 1077 1255
+betref 1076 1101
+kollege 1076 1234
+toer 1075 1289
+bewyse 1074 1142
+erkenning 1073 1106
+lees 1072 1155
+tradisioneel 1072 1078
+malan 1071 1230
+verenig 1071 1102
+mee 1070 1105
+anti 1066 1148
+afgestig 1065 1188
+kasteel 1065 1376
+genaamd 1064 1093
+helder 1064 1132
+privaat 1064 1113
+spel 1064 1217
+gedwing 1063 1078
+setlaars 1062 1155
+geklassifiseer 1061 1102
+beplan 1060 1078
+vasteland 1060 1115
+weet 1060 1145
+gedrag 1059 1188
+ingelyf 1057 1154
+polisie 1057 1211
+week 1057 1150
+aktiwiteite 1056 1114
+city 1056 1190
+ring 1055 1348
+stelsels 1054 1234
+griekeland 1052 1162
+film 1051 1246
+komitee 1049 1218
+stadion 1049 1557
+britte 1047 1176
+kenmerkende 1047 1058
+twintig 1047 1070
+portugese 1045 1307
+aangewend 1044 1062
+getref 1044 1067
+omring 1043 1080
+sekretaris 1043 1108
+michael 1042 1127
+suksesvol 1042 1057
+suksesvolle 1042 1057
+bediening 1041 1091
+ortodokse 1040 1272
+karoo 1039 1166
+kritiek 1039 1096
+uitgebreide 1039 1055
+gevoer 1038 1056
+geslag 1037 1184
+verwerp 1037 1059
+vriende 1036 1077
+gemeenskaplike 1034 1092
+kyk 1034 1093
+boer 1033 1111
+boonste 1033 1100
+mooi 1033 1081
+waarvoor 1033 1063
+argentinie 1032 1135
+waarvolgens 1029 1052
+beroemde 1028 1039
+ens 1028 1067
+voordeel 1028 1050
+aangepas 1027 1043
+brief 1027 1185
+mettertyd 1027 1036
+noorwee 1027 1210
+hedendaagse 1026 1056
+hertog 1026 1185
+peter 1026 1061
+tuiste 1026 1062
+jean 1024 1085
+standaard 1024 1132
+tegniese 1024 1088
+petrus 1022 1123
+skilder 1021 1086
+verby 1021 1114
+kolonies 1020 1153
+visse 1020 1221
+sensus 1019 1088
+wetenskaplikes 1019 1067
+beeindig 1018 1028
+golf 1016 1247
+hang 1016 1053
+jesus 1016 1385
+afgeneem 1015 1052
+sweedse 1013 1133
+juis 1012 1027
+eenhede 1010 1163
+skade 1010 1069
+murray 1008 1235
+gees 1004 1093
+beskerming 1003 1037
+gereelde 1003 1037
+gehoor 1002 1088
+taak 1002 1050
+bewoners 1001 1037
+here 1001 1170
+bande 1000 1052
+filosoof 1000 1036
+transvaalse 999 1058
+fisiese 998 1113
+afkoms 997 1050
+blanke 996 1122
+toring 996 1307
+vervaardiging 995 1047
+all 994 1158
+area 994 1076
+minste 994 1018
+vereer 994 1046
+grote 993 1035
+tropiese 993 1106
+vreet 993 1096
+gunste 990 1017
+skryfster 990 995
+onderwyser 989 1048
+steyn 989 1215
+bloed 987 1180
+amsterdam 985 1148
+vry 984 1024
+kontak 983 1042
+sondag 983 1030
+world 983 1031
+oorgedra 982 1016
+verloop 981 998
+nader 980 1009
+onderteken 980 1014
+url 980 986
+ervaar 979 1007
+merwe 979 1089
+toenemende 979 995
+middeleeuse 977 1019
+skotse 977 1118
+blomme 976 1163
+verduidelik 976 1004
+beduidende 975 993
+idees 975 1052
+beperkte 974 1002
+watter 973 1066
+produk 972 1051
+eet 971 1101
+fort 971 1262
+terselfdertyd 970 973
+vriend 970 995
+ooskus 969 975
+presies 969 995
+vroegste 968 994
+noordoos 967 995
+vergelyk 965 987
+egiptiese 964 1095
+onderrig 961 1034
+onderneming 959 1120
+aansienlike 958 961
+johann 958 1014
+silwer 958 1094
+verspreiding 958 1000
+onttrek 957 990
+televisie 957 1023
+bevel 956 1019
+christus 956 1089
+kerklike 956 1008
+metropolitaanse 956 1052
+venter 956 1104
+wyd 956 975
+lewende 955 1029
+ondersteuning 955 993
+redelik 955 969
+data 954 1187
+konsep 954 1010
+streng 954 972
+eiers 953 1211
+hoek 953 1051
+seevlak 953 1052
+berig 952 987
+geografiese 952 997
+benodig 951 987
+gemeenskappe 951 1024
+hospitaal 951 1132
+kommunistiese 951 1049
+rugbywereldbeker 951 1178
+verskille 951 1031
+kruis 950 1125
+belydende 949 1193
+direkte 949 985
+reen 949 1069
+goedgekeur 948 977
+dadelik 945 964
+toegepas 945 971
+bewoon 944 974
+geskik 943 970
+abraham 942 1048
+bespreek 941 973
+kortverhale 941 1075
+slaag 941 971
+vergroot 941 964
+wette 940 1069
+volke 939 1015
+angola 938 1068
+direkteur 938 1008
+villiers 938 1063
+permanente 937 981
+finale 936 959
+geweld 936 1031
+sport 936 1032
+tema 936 987
+waaraan 936 946
+ton 935 1178
+vertolk 935 1003
+immigrante 932 1039
+postma 932 1291
+samestelling 932 975
+situasie 932 972
+volksraad 931 1047
+marais 930 1099
+opgestel 930 956
+sesde 930 948
+daniel 929 981
+heerskappy 929 944
+inhoud 929 1032
+leiers 929 969
+onmiddellik 929 936
+kies 928 973
+verwag 928 948
+spele 927 1267
+praktyk 926 951
+werklike 925 961
+aanvalle 924 1006
+aangebring 923 962
+stowwe 922 1045
+minute 921 1082
+vreemde 921 980
+beelde 920 1035
+bekendheid 920 923
+besoekers 920 973
+jacobus 918 967
+planne 918 951
+aparte 916 934
+argitektuur 916 990
+era 916 975
+plat 915 983
+kalifornie 914 1005
+teenwoordigheid 913 940
+toets 913 1069
+vinnige 913 924
+anc 912 1188
+behandeling 912 1007
+oplossing 911 1030
+administrasie 910 937
+gelys 910 930
+uitsondering 910 918
+seksuele 909 1067
+verval 909 988
+kardinaal 908 1043
+teenwoordig 908 923
+botswana 907 1080
+daaraan 907 914
+gode 907 1096
+hoeksteen 907 970
+mev 907 1032
+deursnee 905 1023
+lord 905 980
+maatskaplike 905 961
+opgevoer 904 1006
+vierkante 904 1050
+distriksmunisipaliteit 902 920
+hoogs 902 910
+literatuur 902 966
+deense 901 1077
+maniere 901 915
+toepassing 901 929
+ingeneem 899 923
+oorblywende 899 914
+publikasie 899 938
+burgeroorlog 898 932
+sorg 897 922
+breek 896 931
+partye 895 995
+leeftyd 894 913
+vraag 894 959
+smuts 893 1064
+bree 892 915
+spanning 892 1002
+stap 892 941
+volledige 892 929
+geskrifte 891 953
+middelpunt 891 933
+veldtog 891 948
+inval 890 948
+verwysing 890 910
+industriele 889 950
+kans 888 935
+verlies 888 926
+johan 887 954
+rig 887 896
+eindstryd 886 982
+islamitiese 886 1038
+verlore 886 914
+wentelbaan 884 1068
+fase 883 1070
+spaans 883 986
+unieke 883 897
+zuid 882 947
+genl 881 1037
+suurstof 880 1089
+bloot 879 894
+gedeeltelik 876 908
+meksiko 876 1037
+reels 876 989
+verse 876 1019
+waaruit 876 887
+lange 875 912
+gelaat 874 886
+klerk 874 1070
+romans 874 945
+verbinding 874 931
+voorgekom 874 903
+gewys 873 887
+insekte 871 978
+negatiewe 871 937
+tipies 871 898
+walt 870 1020
+konings 869 933
+verwoes 869 908
+baan 868 1070
+tempel 868 1093
+gedefinieer 867 909
+inheems 867 924
+ere 866 888
+letterkundige 864 917
+saamgesmelt 863 907
+toekomstige 863 882
+geskiedkundige 862 878
+olie 862 1037
+pryse 862 942
+saal 862 1029
+temperature 862 988
+aangeval 861 904
+gasheer 861 951
+planete 861 1070
+siektes 861 967
+tydskrifte 861 907
+dink 860 897
+edward 860 934
+kompetisie 860 973
+wiskundige 860 947
+alfabet 859 1263
+francois 859 908
+oscar 859 1005
+versamel 858 878
+landelike 857 879
+wapen 857 1051
+joseph 856 890
+martin 856 912
+optree 856 869
+spesifiek 856 860
+persiese 855 1040
+king 854 930
+effek 853 913
+kere 853 866
+plase 853 959
+vorming 853 888
+hanteer 852 873
+vaar 852 874
+ernstig 851 864
+nabygelee 850 857
+mpumalanga 849 867
+graaf 848 965
+totaal 848 905
+mitologie 847 933
+tekste 845 953
+prix 843 1068
+sigbaar 843 881
+asiatiese 842 936
+wind 842 922
+metodes 841 894
+romeine 841 918
+strukture 839 898
+duitsers 838 933
+fees 838 980
+stroom 838 1009
+stukke 838 926
+daardeur 836 840
+portugal 836 949
+middestad 835 870
+werking 835 860
+oprigting 834 860
+aand 833 876
+bedoel 832 846
+bynaam 832 858
+house 832 902
+moord 832 919
+organismes 832 985
+roux 832 929
+gely 831 842
+gereken 831 843
+vii 831 873
+vuur 831 989
+beslis 830 861
+kroon 829 899
+arabies 828 908
+gewildste 828 850
+lente 828 861
+selfstandige 828 889
+normale 827 872
+werklik 827 846
+faktore 826 874
+instellings 826 873
+rapport 826 862
+selde 826 841
+veranderinge 826 877
+hare 825 966
+verhoudings 825 883
+gevolge 824 840
+kenia 824 974
+noorse 824 1014
+daarbenewens 823 825
+heelal 823 1052
+lewens 823 860
+afhanklik 822 843
+duisend 822 848
+skaal 822 878
+aangekom 821 840
+bekom 821 837
+merendeels 820 823
+dun 819 867
+gauteng 819 859
+turkye 818 892
+weerspieel 818 823
+harde 817 847
+produseer 817 860
+andrew 816 887
+motors 816 938
+toeriste 816 884
+beoefen 815 847
+bedreig 814 866
+oorloe 814 868
+jag 813 906
+naaste 813 874
+beginsel 812 859
+fifa 812 1163
+maksimum 811 855
+aspekte 810 840
+beskrywing 810 832
+seker 810 823
+vlieg 810 916
+beloop 809 837
+omstrede 809 825
+stert 809 937
+stories 808 933
+verwante 808 821
+grotendeels 807 812
+mnr 807 956
+werkers 807 904
+datum 806 856
+positiewe 806 870
+coetzee 805 940
+saint 804 968
+akademiese 803 852
+apartheid 802 878
+elektroniese 802 884
+klank 802 944
+piet 802 897
+behoefte 801 830
+lugmag 801 955
+ondernemings 801 877
+royal 801 897
+slawiese 801 1016
+oorsese 800 851
+deurdat 799 807
+gehuisves 799 823
+speler 799 1055
+hierin 798 801
+nywerhede 798 868
+arm 796 863
+natuurlik 796 819
+american 795 856
+iran 795 955
+myl 795 941
+organisasies 795 851
+straat 795 936
+gerig 794 806
+voorste 794 820
+waardes 794 883
+etlike 793 807
+omrede 793 818
+storie 793 883
+toegerus 793 879
+hiervoor 792 796
+maal 792 849
+heen 791 800
+prestasie 791 810
+bene 790 908
+outonome 790 883
+student 790 826
+gehelp 789 801
+goedere 789 876
+pierre 789 852
+voldoen 789 810
+dokumente 788 860
+grootskaalse 788 797
+monument 787 916
+vallei 787 886
+klooster 786 990
+nommer 786 900
+gemeet 785 846
+individuele 785 815
+nederlaag 785 832
+selle 785 1051
+groeiende 784 795
+haal 784 806
+tradisies 784 816
+weerstand 784 869
+bank 783 1011
+graaff 783 888
+buiten 782 795
+litaue 782 948
+aksie 781 840
+burgerlike 781 824
+katedraal 781 967
+noordooste 781 799
+instituut 780 862
+rekord 780 865
+boereoorlog 779 809
+gesig 779 827
+vleis 779 904
+wapens 779 888
+hitte 778 889
+kante 778 812
+paaie 778 848
+opsig 777 786
+sodra 777 787
+switserse 777 893
+grondslag 776 785
+school 776 868
+vasgestel 776 792
+skelet 775 814
+verhoed 775 789
+dirk 774 845
+private 772 815
+skei 772 806
+bisantynse 771 833
+danke 771 776
+netwerk 771 850
+ontsnap 771 796
+elf 770 787
+onlangs 769 771
+bydraes 768 790
+gehalte 768 795
+kardinale 767 866
+wilhelm 767 836
+bygevoeg 766 790
+kandidaat 766 872
+mere 766 892
+presiese 766 779
+tekens 765 831
+geduur 764 770
+gesamentlike 764 790
+halfrond 764 961
+minerale 764 873
+namate 764 779
+pakistan 764 1004
+slawe 764 938
+sterrebeeld 764 825
+uitgestrekte 764 767
+weergawes 764 815
+marie 763 843
+verbonde 763 771
+families 762 821
+dik 760 819
+sing 760 837
+uitbreek 760 768
+debuut 759 780
+yster 759 906
+gemiddeld 758 849
+hans 758 835
+bykomende 757 769
+funksies 757 826
+krieket 757 916
+moedergemeente 757 856
+reel 757 830
+burgemeester 756 817
+maatskappye 755 821
+vlakke 755 816
+afdelings 754 794
+geheime 754 803
+wiskunde 754 888
+ervaring 752 814
+impak 752 788
+kongres 752 847
+ooreenkomste 752 778
+sending 752 852
+sonnestelsel 752 858
+verdedig 752 769
+verskyning 752 769
+beywer 751 762
+bygewoon 751 783
+individue 751 811
+enjin 750 978
+voorsiening 750 761
+been 749 812
+deesdae 749 757
+plato 749 876
+fyn 748 771
+ligjare 748 928
+mengsel 748 816
+mening 748 771
+figuur 747 778
+skakel 747 775
+uitwerking 747 780
+aandui 746 762
+uitvoer 746 769
+besonderhede 745 759
+deelneem 745 768
+laerskool 745 905
+kamer 744 838
+voortgesit 744 746
+binneland 743 772
+noordweste 743 763
+opvoeding 743 779
+universiteite 743 807
+volledig 743 753
+suidooste 742 758
+kanaal 741 929
+tabel 741 785
+webwerf 741 798
+federasie 740 821
+hoofkwartier 740 768
+honderd 738 758
+programme 738 831
+toegeskryf 738 751
+gevier 737 780
+leidende 737 749
+frederik 735 838
+nazi 735 816
+verdediging 735 768
+witwatersrand 735 767
+suidweste 734 750
+susters 734 794
+taamlik 734 749
+verskynsel 734 768
+aangehou 733 771
+belange 733 757
+voortdurend 733 746
+angeles 732 854
+internet 732 813
+jeug 732 763
+spoorlyn 732 924
+gevange 731 752
+organiese 731 850
+uitgesaai 731 800
+vrees 731 813
+glad 730 740
+verteenwoordigers 730 774
+buiteland 729 760
+moontlikheid 729 740
+somerspele 729 882
+wenner 729 824
+keuse 728 759
+aftrede 727 756
+eiendom 727 783
+gehaal 727 761
+kenmerke 727 762
+klere 727 814
+kommunikasie 727 785
+onthou 727 760
+skilderye 727 796
+somerset 726 837
+toestemming 726 767
+africa 725 778
+hexactinellida 725 725
+predikante 725 832
+prosesse 725 781
+waarheid 725 806
+alternatiewe 724 759
+beskawing 723 827
+vel 723 827
+andries 722 788
+briewe 722 861
+top 722 795
+leo 721 836
+owerheid 721 747
+wag 721 757
+oorwegend 720 733
+ottomaanse 720 870
+bekroon 719 743
+belgiese 719 787
+denke 719 789
+sosialistiese 719 806
+verbindings 719 832
+honderde 718 731
+pius 718 815
+sterrekundige 718 779
+argeologiese 717 749
+uitgeoefen 717 732
+biblioteek 716 817
+kenmerk 716 731
+krieketwereldbeker 716 919
+owerhede 716 740
+tuis 716 750
+elders 715 719
+komplekse 715 764
+sekondere 714 780
+senior 714 751
+eenvoudig 713 718
+interne 713 757
+antwoord 712 761
+burgersdorp 712 843
+clemens 711 779
+diegene 711 756
+moeilike 711 721
+verban 711 735
+sewende 710 727
+wereldwye 710 731
+metaal 709 828
+ooreen 709 721
+dokter 708 783
+duidelike 708 716
+christene 706 800
+germaanse 706 847
+johanna 706 785
+egpaar 705 720
+hollandse 705 745
+napoleon 705 884
+styg 705 750
+geleenthede 704 716
+passasiers 704 817
+spoor 704 741
+waarom 704 731
+wilde 704 756
+gemik 703 714
+tak 701 765
+tsaar 701 787
+eienaar 700 739
+handhaaf 700 712
+ronde 700 745
+kalksponse 699 700
+algehele 698 740
+klem 698 716
+calcarea 697 697
+oostenrykse 697 743
+vermy 697 708
+middellandse 696 727
+spoed 696 800
+ewe 695 730
+hongarye 695 777
+gebeurtenis 694 742
+landskap 694 719
+dam 693 946
+benadering 692 743
+aanspraak 691 719
+identiteit 690 729
+liberale 690 738
+toneel 690 728
+onderwerpe 689 712
+uitmaak 689 700
+digitale 688 854
+onderkant 688 723
+volksrepubliek 688 730
+aankoms 687 702
+opening 687 737
+vorms 686 726
+reageer 685 727
+teoriee 685 761
+vooruitgang 685 710
+beginsels 684 723
+gewy 684 698
+sand 684 786
+harry 683 751
+kunste 682 732
+letters 682 835
+digters 681 754
+life 681 711
+toename 681 730
+tydelik 681 690
+snelheid 680 814
+black 679 738
+brug 679 977
+vergesel 679 688
+viii 679 707
+rus 678 700
+andre 677 717
+limpopo 677 705
+tuin 677 823
+band 676 747
+kalsiumkarbonaat 676 677
+karl 676 733
+mure 676 731
+gram 675 723
+deelstate 674 754
+definisie 674 741
+figure 674 717
+aangele 673 691
+geleerdes 673 704
+korea 673 888
+unesco 673 698
+eerw 672 809
+gedeel 672 692
+verrig 672 693
+breed 671 712
+daaglikse 671 682
+gegrond 671 684
+grys 671 749
+vinniger 671 703
+deels 670 759
+munisipaliteite 670 730
+oorblyfsels 670 696
+brits 669 714
+gestaak 669 676
+gewapende 669 701
+omliggende 669 673
+bereken 668 707
+gesit 668 678
+instelling 668 690
+navorsers 668 684
+testament 668 779
+vlerke 668 795
+zambie 668 721
+alfred 667 700
+emeritaat 667 677
+paarl 667 751
+temas 667 706
+siek 666 691
+eweneens 665 666
+modelle 665 764
+omskep 665 679
+behartig 664 673
+langste 664 708
+mede 664 684
+pragtige 664 669
+stadig 664 679
+beland 663 680
+lodewyk 663 785
+rug 663 703
+vloeistof 663 824
+dusver 662 691
+koms 662 673
+skrif 662 801
+voldoende 662 673
+ongeluk 661 708
+oortuig 661 668
+skuld 661 728
+wyfie 661 818
+afgelope 660 668
+grondgebied 660 685
+heerser 660 695
+oorsaak 660 693
+tesame 660 663
+vang 660 700
+diepsee 659 672
+snelweg 658 706
+afstigting 657 743
+beskadig 657 686
+dekade 657 671
+dialekte 657 827
+distrikte 657 723
+aanhangers 656 692
+gereis 656 679
+italiaans 656 701
+reuse 656 681
+uitspraak 656 729
+geskied 655 668
+jupiter 655 879
+lee 655 727
+woude 655 727
+springbokke 654 784
+verre 654 672
+aanvanklike 653 671
+arbeid 653 724
+geidentifiseer 653 673
+geproduseer 653 686
+grade 653 742
+kleinste 653 688
+koerante 653 688
+korter 653 679
+medium 653 708
+waarnemings 652 693
+liggame 651 700
+carl 650 684
+formele 650 685
+ingespan 649 665
+with 649 671
+matrikuleer 648 648
+meisie 648 695
+verkeer 648 669
+volume 648 753
+lyne 647 753
+noodsaaklik 647 657
+blootgestel 646 652
+geneig 646 681
+sendeling 646 697
+friedrich 644 693
+muur 644 771
+sponsdiere 644 645
+sri 644 897
+wereldbekertoernooi 644 796
+onbekende 643 655
+opera 643 793
+prinses 643 736
+reinet 643 710
+aktiwiteit 642 674
+kat 642 823
+kimberley 642 748
+leerders 642 834
+sagte 642 684
+dryf 641 661
+joubert 641 722
+kabinet 641 749
+onmoontlik 641 649
+oral 641 650
+regstreeks 641 649
+deurgebring 640 646
+gebruike 640 666
+insig 640 656
+leon 640 670
+pretorius 640 779
+regs 640 703
+washington 640 702
+gevlug 639 655
+keiserlike 639 705
+paulus 639 712
+sangeres 639 659
+waterstof 639 772
+boodskap 638 721
+chinees 638 759
+adam 637 729
+reenval 637 708
+tydelike 637 656
+chris 636 673
+christiaan 636 713
+filosofiese 636 686
+ingenieur 636 657
+oekraine 635 720
+premier 635 676
+soogdiere 635 723
+gedruk 634 668
+protestantse 634 692
+rio 634 929
+college 633 708
+klasse 633 723
+leser 633 714
+veg 633 656
+sokkerspan 632 669
+prent 631 793
+vrystaatse 631 707
+gekroon 630 647
+indruk 630 639
+openbaar 630 641
+werksaam 630 641
+publikasies 627 651
+strand 627 724
+tegniek 627 675
+company 626 684
+kaapland 626 662
+toerisme 625 687
+wetgewing 625 670
+buitenste 624 675
+gang 624 649
+love 624 665
+meet 624 672
+steek 624 644
+voorspel 624 664
+geleer 623 657
+grieke 623 668
+wyn 623 776
+beker 622 736
+uitsluitlik 622 630
+zar 622 730
+bewus 621 631
+misluk 621 625
+renaissance 621 670
+toerusting 621 666
+christendom 620 661
+liedjies 620 703
+simbole 620 711
+voorstede 620 671
+frank 619 706
+gewildheid 619 627
+mannetjies 619 760
+mars 619 878
+praktiese 617 628
+bergreeks 616 684
+gepaard 616 625
+hotel 616 741
+turkse 616 733
+verdryf 616 631
+gesteun 615 624
+kenmerkend 615 618
+hoor 614 650
+kongo 614 770
+saterdag 614 631
+tel 614 647
+vars 614 655
+bekendgestel 613 642
+besorg 613 616
+gelyknamige 613 623
+graf 613 674
+deeltjies 612 804
+islam 612 691
+les 612 686
+nasie 612 666
+vlae 612 807
+uitgemaak 611 613
+vee 611 641
+niemand 610 634
+opgemerk 610 621
+rhodesie 610 751
+spreek 610 618
+hiermee 609 613
+konserwatiewe 609 639
+aandeel 608 649
+art 608 685
+bewering 608 619
+geologiese 608 648
+skielik 608 617
+veroordeel 608 625
+betrekkinge 607 643
+international 607 643
+beklemtoon 606 624
+buitengewone 606 612
+jerusalem 606 698
+ruk 606 622
+uitgewers 606 657
+bedrywighede 605 618
+bewerkstellig 605 613
+getree 605 608
+jaargang 605 612
+konteks 605 630
+kulture 605 665
+diepte 604 664
+eer 604 618
+hugo 604 662
+moslems 604 685
+stasie 604 686
+telkens 603 617
+lanka 601 807
+personeel 601 631
+roep 601 615
+aangevoer 600 612
+gemengde 600 617
+jack 600 694
+suidwaarts 600 609
+samesmelting 599 631
+teenoorgestelde 599 627
+video 598 707
+kommentaar 597 629
+rhodes 597 707
+gratis 596 623
+oorhandig 596 613
+uitstekende 596 600
+gregorius 595 667
+lied 595 694
+gedink 594 607
+graafskap 594 743
+hertzog 594 735
+broei 593 637
+gevegte 593 613
+oorwinnings 593 646
+ure 593 649
+resultate 592 614
+gelderland 591 597
+glassponse 591 593
+kiesel 591 591
+daarby 590 594
+elektrisiteit 590 678
+makliker 590 596
+slagoffers 590 640
+teologie 590 645
+voortgegaan 589 592
+bykans 588 598
+hoofkarakter 588 603
+koper 588 687
+pare 588 626
+skrikkeljaar 588 598
+strategiese 588 626
+vestiging 588 599
+bewegings 587 632
+middelburg 587 695
+smit 587 640
+wellington 587 665
+digkuns 586 629
+gereel 586 589
+individu 586 646
+woestyn 586 662
+begrens 585 600
+blankes 585 644
+gegewe 585 619
+ondervind 585 589
+arthur 584 625
+geloop 584 599
+meen 584 602
+oewer 584 610
+sterker 584 595
+vertikale 584 622
+farao 583 694
+gedagte 583 600
+nodige 583 588
+spikula 583 583
+verklaring 583 631
+hede 582 591
+huisgenoot 582 656
+leerlinge 582 655
+nelson 582 613
+dialek 581 666
+komponente 581 644
+lopies 581 825
+prosa 581 642
+gelyke 580 621
+gestrek 580 595
+krisis 580 604
+regerings 580 602
+wedren 580 667
+wentel 580 632
+geinspireer 579 584
+melkweg 579 718
+onderhoud 579 594
+oupa 579 653
+toetse 579 640
+vore 579 587
+materiale 578 646
+operasie 578 678
+standpunte 578 592
+gevang 577 596
+meganiese 577 619
+super 577 679
+lok 576 585
+onderdruk 576 595
+onthul 576 589
+redaksie 576 646
+rotse 576 619
+skepping 576 600
+union 576 683
+verbou 576 606
+verdien 576 628
+hulpbronne 575 644
+namens 575 603
+persentasie 575 607
+depressie 574 622
+geklop 574 606
+jacob 574 601
+behoeftes 573 613
+daaroor 573 583
+finland 573 712
+ontwikkelde 573 609
+afsterwe 572 581
+dramaturg 572 581
+ietwat 572 581
+tipes 572 598
+tydstip 572 577
+verowering 572 597
+volgorde 572 656
+from 571 583
+gewig 571 617
+ondersteuners 571 613
+ontgin 571 601
+vaderland 571 615
+afrikaansche 570 589
+invloede 570 598
+konferensie 569 659
+prominente 569 576
+sprake 569 572
+wese 569 592
+besetting 568 587
+biologiese 568 621
+boonop 568 572
+gekwalifiseer 568 650
+priester 568 598
+bedreiging 567 575
+gekoppel 567 593
+georganiseer 567 575
+ingang 567 605
+romantiese 567 595
+spoorwee 567 635
+afloop 566 580
+geslagte 566 582
+miljoene 566 581
+bedrag 565 603
+dertig 565 576
+digte 565 585
+half 565 613
+kaart 565 640
+star 565 642
+west 565 600
+konstruksie 564 593
+toesig 564 574
+aangrensende 563 568
+deelname 563 578
+dek 563 591
+handelaars 563 600
+horisontale 563 596
+ideale 563 594
+litause 563 697
+risiko 563 636
+ruim 563 566
+vrydag 563 579
+aangekoop 562 575
+pruise 562 670
+slaan 562 586
+golden 561 587
+ras 561 610
+rekenaar 561 655
+beaufort 560 655
+chili 560 656
+daal 560 584
+hard 560 578
+omvang 560 583
+society 560 612
+tegnieke 560 594
+veranderings 560 586
+volwassenes 560 594
+belangrikheid 559 566
+gematigde 559 587
+hervormde 559 651
+rebellie 559 604
+weskus 559 581
+air 558 692
+bevordering 558 571
+you 557 602
+asof 556 567
+berus 556 561
+dramas 556 618
+gevul 556 575
+heidelberg 556 627
+jacques 556 593
+opkoms 556 561
+perspektief 556 577
+versier 556 578
+gemeen 555 569
+konsulent 555 592
+gebeurtenisse 554 578
+kamp 554 670
+plus 554 574
+fossiele 553 661
+onderwysers 553 593
+verwar 553 559
+afgelee 552 559
+brandstof 552 635
+kompleks 552 588
+konstantinopel 552 612
+londense 552 578
+perd 552 659
+plantegroei 552 608
+simon 552 612
+uitgewer 552 573
+bal 551 892
+congress 551 606
+tuine 551 592
+smaak 550 600
+vervul 550 569
+betrek 549 556
+ekstra 549 578
+internasionaal 549 561
+morele 549 608
+musikale 549 604
+onderste 549 592
+steenselle 549 549
+strepe 549 666
+tanzanie 549 584
+beskuldig 548 555
+dans 548 664
+tref 548 565
+betreklik 547 550
+beveel 547 561
+bietjie 547 586
+enorme 547 553
+geskrewe 547 581
+glas 547 685
+kragte 547 598
+roemenie 547 632
+bouwerk 546 577
+rock 546 625
+mary 545 585
+oblast 545 849
+perde 545 643
+spore 545 599
+toenemend 545 552
+amptenare 544 578
+atkv 544 591
+geskikte 544 553
+leeus 544 686
+verkiesings 544 598
+white 544 588
+klip 543 632
+benaming 542 573
+gebruikers 542 640
+tekort 542 578
+athene 541 645
+nuus 541 583
+afgele 540 557
+skiet 540 556
+wyfies 540 653
+ekspedisie 539 596
+gedoop 539 564
+geskiet 539 568
+houding 539 549
+natalse 539 585
+opname 539 572
+rondte 539 631
+setels 539 728
+sirie 539 595
+spoedig 539 546
+stabiele 539 587
+vergader 539 553
+anton 538 597
+chicago 538 648
+getuig 538 554
+rond 538 554
+steenkool 538 625
+nietemin 537 537
+projekte 537 574
+prooi 537 681
+weereens 537 542
+eugene 536 567
+fisika 536 601
+gelees 536 553
+graag 536 542
+grahamstad 536 613
+herbou 536 566
+rykdom 536 585
+seks 536 679
+oomblik 535 554
+toekennings 535 598
+erfenis 534 555
+medalje 534 617
+voorganger 534 543
+beraam 533 543
+eienskap 533 573
+gevorderde 533 555
+noemenswaardige 532 535
+opnuut 532 546
+otto 532 607
+genetiese 531 598
+grey 531 605
+vrugbare 531 541
+julius 530 565
+geroep 529 533
+guinee 529 656
+heer 529 596
+mandela 529 610
+neef 529 559
+opposisie 529 555
+rots 529 606
+weduwee 529 550
+geeis 528 534
+hamilton 528 761
+infrastruktuur 528 545
+muller 528 605
+one 527 565
+ontleen 527 549
+times 527 577
+gevoeg 526 531
+noodwendig 526 535
+normaalweg 526 533
+wene 526 582
+besluite 525 561
+samuel 525 563
+senaat 525 583
+tevore 525 528
+liedjie 524 616
+religieuse 524 558
+skryfwerk 524 549
+toneelstuk 524 603
+vergeleke 524 545
+vyand 524 552
+amerikaners 523 619
+chemie 523 611
+ding 523 555
+geassosieer 523 547
+gedeeltes 523 542
+letter 523 713
+wortels 523 551
+bodem 522 551
+gestyg 522 542
+tande 522 632
+benedictus 520 599
+resultaat 520 533
+wladimir 520 600
+woning 520 550
+hemel 519 582
+instrumente 519 573
+walter 519 540
+histories 518 522
+keur 518 556
+kiesers 518 621
+petersburg 518 563
+standvoel 518 519
+strate 518 549
+gevoelens 517 551
+papier 517 629
+takke 517 564
+verblyf 517 529
+genera 516 574
+kantoor 516 551
+laagste 516 545
+latyns 516 542
+platteland 516 531
+aanvang 515 519
+belasting 515 578
+benut 515 526
+formaat 515 554
+konstante 515 575
+lady 515 555
+ongelukkig 515 515
+stadsraad 515 568
+toegestaan 515 524
+verdeling 515 546
+volop 515 531
+vyftig 515 532
+aansluit 514 529
+geteken 514 525
+vlakte 514 550
+behoue 513 524
+boord 513 536
+ingewikkelde 513 525
+kiesafdeling 513 571
+leierskap 513 531
+nikolaas 512 631
+orrel 512 651
+rousseau 512 657
+sendelinge 512 558
+verken 512 529
+prente 511 586
+rustenburg 511 604
+oorgang 510 542
+skuilnaam 510 538
+swaartekrag 510 573
+beeste 509 585
+onderskeid 509 532
+opgebou 509 517
+bymekaar 508 519
+kapasiteit 508 550
+madagaskar 508 570
+oorweeg 508 520
+afhangende 507 512
+alliansie 507 563
+argitektoniese 507 522
+identifiseer 507 523
+regter 507 562
+vorster 507 627
+afgevaardigdes 506 558
+ethiopie 506 607
+links 506 567
+onderhou 506 515
+opvoedkundige 506 524
+tronk 506 550
+afname 505 534
+doeleindes 505 510
+historikus 505 511
+lewis 505 548
+ligter 505 533
+lof 505 544
+night 505 526
+veilig 505 518
+wetgewende 505 552
+bereid 504 511
+brasiliaanse 504 556
+hitler 504 622
+holland 504 564
+uitdrukking 504 525
+uitgebreek 504 510
+afgeskaf 503 510
+digtheid 503 600
+gras 503 551
+hervormings 503 528
+kategorie 503 592
+mannetjie 503 613
+nek 503 534
+riebeeck 503 573
+skyf 503 611
+sout 503 563
+sprekers 503 557
+sterrestelsels 503 622
+aanneem 502 507
+gotiese 502 570
+indonesie 502 537
+konstantyn 502 661
+skuif 502 581
+versamelbundel 502 547
+voorloper 502 509
+aansoek 501 554
+gedagtes 501 527
+ontwerpe 501 531
+khan 500 707
+pietermaritzburg 500 572
+pools 500 545
+standbeeld 500 600
+afwesigheid 499 507
+ingedeel 499 507
+pro 499 561
+voortbestaan 499 503
... 3719473 lines suppressed ...