Files
Radixor/docs/benchmarks/languages/norwegian-nynorsk.md
Leo Galambos 05f3855b99 feat(benchmarks): expand multilingual stemming quality evaluation
* cover all Radixor dictionary languages
* add PRIMARY_OUTPUT, ANY_CANDIDATE, and ALL_CANDIDATES policies
* measure pairwise over-stemming and under-stemming
* add balanced accuracy and complementary quality metrics
* compare single-output and multi-output stemmers fairly
* improve result validation, reporting, and documentation
* move stemming quality tests into the standard test source set
* preserve the existing JMH benchmark structure and badge output
2026-07-20 23:20:17 +02:00

25 KiB
Raw Blame History

Norwegian Nynorsk Stemmer Benchmarks

This page reports same-language stemming benchmarks for Norwegian Nynorsk. Accuracy is listed first because speed without root agreement is not enough to interpret stemmer quality.

All speed values are environment-specific and were measured on the hardware and JVM listed in the benchmark overview. Speed benchmark operations process changed dictionary tokens only. Accuracy uses the complete Radixor dictionary for the language.

Radixor must not be read as simply "slower" when a narrow competitor has a lower timing row. In these tables Radixor is the quality-oriented baseline: its exact-root accuracy is typically close to 100%, while many faster rule-based, light, minimal, or possessive filters reach that speed by doing much less linguistic work and often score far lower in All exact and Changed exact. The Radixor rows in this benchmark refresh use the contracted compiled patch trie: compilation collapses uniform patch-command subtrees into accepting leaves, reducing hot lookup depth while preserving the preferred stemming result measured by the accuracy pass. The EnglishRadixorDictionaryCoverageBenchmark table shows the resulting quality/speed envelope explicitly. The same interpretation applies to this language page: speed rows must be read together with the accuracy table above them.

Dictionary Corpus

Resource Dictionary rows Complete quality tokens Already-root tokens Changed speed tokens
NN_NO 4,688 19,651 6,089 13,562

Radixor Patch Command Distribution

Radixor stores the preferred transformation for each normalized dictionary word form as a compiled patch command. This distribution shows which runtime command class is selected by the trained trie for the complete language dictionary. The total number of preferred patch commands analyzed for this language is 19,651.

Command class Meaning Word forms Share
AppendCharacterCommand Appends one character to the end of the word form. 224 1.140%
BackwardCompoundCommand Applies a multi-step backward patch made from skip, delete, insert, and replace operations. 1,505 7.659%
DeleteSuffixCommand Deletes one or more trailing characters from the word form. 11,017 56.063%
PreserveCommand Returns the word form unchanged because it already matches the preferred root. 6,427 32.706%
ReplaceLastCharacterCommand Replaces the final character of the word form. 478 2.432%

Accuracy

Accuracy is computed from JMH auxiliary counters in the current report. The counters are deterministic for a fixed corpus and stemmer; percentages divide matching counters by evaluated counters from the same report and are not timing metrics.

Stemmer All exact Changed exact Root preserved Note
Radixor 93.089% 91.395% 96.863% Full Radixor dictionary patch-command stemmer.
Official Snowball direct 60.974% 60.212% 62.670% Official Snowball generated Java stemmer; rule-based suffix algorithm.
Lucene SnowballFilter 60.918% 60.146% 62.638% Lucene TokenFilter integration path around the Snowball algorithm.

Speed

Speed uses JMH average time, 3 warmup iterations, 5 measurement iterations, 1 fork, and 1 thread. Relative factor is computed against the single Radixor row on this language page. Values below 1.000 are faster than that Radixor baseline; values above 1.000 are slower.

Stemmer Benchmark method Score ms/op Error ms ns/token Relative vs Radixor Note
Radixor radixor[NORWEGIAN_NYNORSK] 0.571 0.012 42.1 1.000 Full Radixor dictionary patch-command stemmer.
Official Snowball direct snowballDirect[NORWEGIAN_NYNORSK] 0.919 0.038 67.7 1.609 Official Snowball generated Java stemmer; direct API.
Lucene SnowballFilter luceneSnowballFilter[NORWEGIAN_NYNORSK] 1.309 0.015 96.5 2.292 Lucene TokenFilter path around Snowball; includes TokenStream overhead.

Interpretation Notes

  • Radixor is a dictionary-derived patch-command stemmer. Its quality depends on the language resource used to train the compiled trie.
  • Light, minimal, plural, and possessive filters are narrow baselines. They can be fast because they intentionally perform less linguistic work.
  • Lucene TokenFilter rows include TokenStream, attribute, and required normalization overhead. Direct rows measure exposed direct APIs.
  • Morfologik rows are dictionary-based and can emit multiple terms for one input token. Quality rows use the first returned term when no ranking weight is available.
  • Snowball rows are rule-based generated suffix stemmers; they are useful algorithmic baselines, not dictionary-root equivalence guarantees.

Stemming Quality

Runtime performance and linguistic grouping quality are independent dimensions. This section evaluates language NN_NO using the complete validated stemming-quality result matrix. Every usable dictionary row is one gold-standard group of forms expected to share a morphological family or lemma. Exact equality with a predetermined lemma is not required. Same-row pairs are positive pairs; pairs from different rows are negative pairs.

ALL_WORDS includes every valid group and its original forms. LOWERCASE_GROUPS_ONLY excludes an entire group when any Unicode code point is uppercase or titlecase; retained words are not lowercased or otherwise rewritten. This isolates case-handling effects without changing retained inputs. Download the complete machine-readable result snapshot.

Evaluation Scope and Key Findings

The dictionary resource is src/main/resources/nn_no/stemmer.gz. The following findings compare only deterministic PRIMARY_OUTPUT rows over identical included groups; candidate policies are reported separately as capability analyses.

  • ALL_WORDS: Radixor ranks first by balanced accuracy at 0.935777 among 3 deterministic stemmers. The runner-up is SNOWBALL NORWEGIAN NYNORSK DIRECT at 0.858908, a difference of 0.076869. This rank does not imply leadership in throughput or every secondary metric.
  • LOWERCASE_GROUPS_ONLY: Radixor ranks first by balanced accuracy at 0.935853 among 3 deterministic stemmers. The runner-up is SNOWBALL NORWEGIAN NYNORSK DIRECT at 0.859037, a difference of 0.076816. This rank does not imply leadership in throughput or every secondary metric.

ALL_WORDS

This mode contains 5 result rows, 3 evaluated stemmers, and 3 output policies. Applied-row and form counts are shown per row because adapters share the language corpus but policy rows remain independently auditable. Rankings are separated by output policy and ordered by unrounded balanced accuracy, followed by MCC, F1, over-stemming rate, over-stemming count, under-stemming rate, and stemmer. Balanced accuracy is a navigation metric, not a universally authoritative quality score.

PRIMARY_OUTPUT ranking

Rank Stemmer Output policy Balanced accuracy Over-stemming Under-stemming F0.5 F1 MCC
1 Radixor PRIMARY_OUTPUT 0.935777 6230 / 166491473 (0.003742%) 3936 / 30652 (12.840924%) 0.822355 0.840152 0.840669
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 0.858908 8274 / 166491473 (0.004970%) 8648 / 30652 (28.213493%) 0.724941 0.722271 0.722234
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 0.858484 8295 / 166491473 (0.004982%) 8674 / 30652 (28.298317%) 0.724180 0.721477 0.721440
Classification metrics
Rank Stemmer Output policy Precision Recall Specificity Balanced accuracy Pairwise accuracy Error rate
1 Radixor PRIMARY_OUTPUT 0.810903 0.871591 0.999963 0.935777 0.999939 0.000061
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 0.726732 0.717865 0.999950 0.858908 0.999898 0.000102
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 0.725993 0.717017 0.999950 0.858484 0.999898 0.000102
Pair-relation metrics
Rank Stemmer Output policy F0.5 F1 F2 Jaccard FowlkesMallows MCC
1 Radixor PRIMARY_OUTPUT 0.822355 0.840152 0.858737 0.724364 0.840699 0.840669
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 0.724941 0.722271 0.719621 0.565278 0.722285 0.722234
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 0.724180 0.721477 0.718794 0.564305 0.721491 0.721440
Partition metrics (PRIMARY_OUTPUT only)
Rank Stemmer Output policy Adjusted Rand Index Homogeneity Completeness V-measure Normalized mutual information
1 Radixor PRIMARY_OUTPUT 0.840122 0.983845 0.986802 0.985321 0.985321
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 0.722221 0.980542 0.964998 0.972708 0.972708
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 0.721426 0.980461 0.964862 0.972599 0.972599
Raw pair counts
Rank Stemmer Output policy TP FP FN TN Over error / possible Under error / possible
1 Radixor PRIMARY_OUTPUT 26716 6230 3936 166485243 6230 / 166491473 3936 / 30652
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 22004 8274 8648 166483199 8274 / 166491473 8648 / 30652
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 21978 8295 8674 166483178 8295 / 166491473 8674 / 30652

ANY_CANDIDATE ranking

Rank Stemmer Output policy Balanced accuracy Over-stemming Under-stemming F0.5 F1 MCC
1 Radixor ANY_CANDIDATE 1.000000 0 / 166491473 (0.000000%) 0 / 30652 (0.000000%) 1.000000 1.000000 1.000000
Classification metrics
Rank Stemmer Output policy Precision Recall Specificity Balanced accuracy Pairwise accuracy Error rate
1 Radixor ANY_CANDIDATE 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000
Pair-relation metrics
Rank Stemmer Output policy F0.5 F1 F2 Jaccard FowlkesMallows MCC
1 Radixor ANY_CANDIDATE 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
Partition metrics (PRIMARY_OUTPUT only)
Rank Stemmer Output policy Adjusted Rand Index Homogeneity Completeness V-measure Normalized mutual information
1 Radixor ANY_CANDIDATE n/a n/a n/a n/a n/a
Raw pair counts
Rank Stemmer Output policy TP FP FN TN Over error / possible Under error / possible
1 Radixor ANY_CANDIDATE 30652 0 0 166491473 0 / 166491473 0 / 30652

ALL_CANDIDATES ranking

Rank Stemmer Output policy Balanced accuracy Over-stemming Under-stemming F0.5 F1 MCC
1 Radixor ALL_CANDIDATES 0.999960 13214 / 166491473 (0.007937%) 0 / 30652 (0.000000%) 0.743562 0.822674 0.835888
Classification metrics
Rank Stemmer Output policy Precision Recall Specificity Balanced accuracy Pairwise accuracy Error rate
1 Radixor ALL_CANDIDATES 0.698764 1.000000 0.999921 0.999960 0.999921 0.000079
Pair-relation metrics
Rank Stemmer Output policy F0.5 F1 F2 Jaccard FowlkesMallows MCC
1 Radixor ALL_CANDIDATES 0.743562 0.822674 0.920624 0.698764 0.835921 0.835888
Partition metrics (PRIMARY_OUTPUT only)
Rank Stemmer Output policy Adjusted Rand Index Homogeneity Completeness V-measure Normalized mutual information
1 Radixor ALL_CANDIDATES n/a n/a n/a n/a n/a
Raw pair counts
Rank Stemmer Output policy TP FP FN TN Over error / possible Under error / possible
1 Radixor ALL_CANDIDATES 30652 13214 0 166478259 13214 / 166491473 0 / 30652

Multi-output analysis

Alternative candidates are capability analyses, not replacements for the deterministic comparison.

Stemmer Under pairs repaired Best-case over pairs avoided All-candidate collisions added Multi-candidate forms Multi-candidate share Maximum candidates Total candidate assignments
Radixor 3936 6230 6984 2404 13.172603% 5 21513

LOWERCASE_GROUPS_ONLY

This mode contains 5 result rows, 3 evaluated stemmers, and 3 output policies. Applied-row and form counts are shown per row because adapters share the language corpus but policy rows remain independently auditable. Rankings are separated by output policy and ordered by unrounded balanced accuracy, followed by MCC, F1, over-stemming rate, over-stemming count, under-stemming rate, and stemmer. Balanced accuracy is a navigation metric, not a universally authoritative quality score.

PRIMARY_OUTPUT ranking

Rank Stemmer Output policy Balanced accuracy Over-stemming Under-stemming F0.5 F1 MCC
1 Radixor PRIMARY_OUTPUT 0.935853 6230 / 165926276 (0.003755%) 3924 / 30595 (12.825625%) 0.822169 0.840084 0.840609
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 0.859037 8274 / 165926276 (0.004987%) 8624 / 30595 (28.187612%) 0.724757 0.722255 0.722216
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 0.858661 8274 / 165926276 (0.004987%) 8647 / 30595 (28.262788%) 0.724438 0.721772 0.721734
Classification metrics
Rank Stemmer Output policy Precision Recall Specificity Balanced accuracy Pairwise accuracy Error rate
1 Radixor PRIMARY_OUTPUT 0.810644 0.871744 0.999962 0.935853 0.999939 0.000061
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 0.726434 0.718124 0.999950 0.859037 0.999898 0.000102
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 0.726226 0.717372 0.999950 0.858661 0.999898 0.000102
Pair-relation metrics
Rank Stemmer Output policy F0.5 F1 F2 Jaccard FowlkesMallows MCC
1 Radixor PRIMARY_OUTPUT 0.822169 0.840084 0.858798 0.724263 0.840639 0.840609
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 0.724757 0.722255 0.719771 0.565258 0.722267 0.722216
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 0.724438 0.721772 0.719126 0.564666 0.721785 0.721734
Partition metrics (PRIMARY_OUTPUT only)
Rank Stemmer Output policy Adjusted Rand Index Homogeneity Completeness V-measure Normalized mutual information
1 Radixor PRIMARY_OUTPUT 0.840054 0.983815 0.986842 0.985326 0.985326
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 0.722204 0.980506 0.965065 0.972724 0.972724
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 0.721721 0.980506 0.964945 0.972663 0.972663
Raw pair counts
Rank Stemmer Output policy TP FP FN TN Over error / possible Under error / possible
1 Radixor PRIMARY_OUTPUT 26671 6230 3924 165920046 6230 / 165926276 3924 / 30595
2 SNOWBALL NORWEGIAN NYNORSK DIRECT PRIMARY_OUTPUT 21971 8274 8624 165918002 8274 / 165926276 8624 / 30595
3 SNOWBALL NORWEGIAN NYNORSK LUCENE FILTER PRIMARY_OUTPUT 21948 8274 8647 165918002 8274 / 165926276 8647 / 30595

ANY_CANDIDATE ranking

Rank Stemmer Output policy Balanced accuracy Over-stemming Under-stemming F0.5 F1 MCC
1 Radixor ANY_CANDIDATE 1.000000 0 / 165926276 (0.000000%) 0 / 30595 (0.000000%) 1.000000 1.000000 1.000000
Classification metrics
Rank Stemmer Output policy Precision Recall Specificity Balanced accuracy Pairwise accuracy Error rate
1 Radixor ANY_CANDIDATE 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000
Pair-relation metrics
Rank Stemmer Output policy F0.5 F1 F2 Jaccard FowlkesMallows MCC
1 Radixor ANY_CANDIDATE 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000
Partition metrics (PRIMARY_OUTPUT only)
Rank Stemmer Output policy Adjusted Rand Index Homogeneity Completeness V-measure Normalized mutual information
1 Radixor ANY_CANDIDATE n/a n/a n/a n/a n/a
Raw pair counts
Rank Stemmer Output policy TP FP FN TN Over error / possible Under error / possible
1 Radixor ANY_CANDIDATE 30595 0 0 165926276 0 / 165926276 0 / 30595

ALL_CANDIDATES ranking

Rank Stemmer Output policy Balanced accuracy Over-stemming Under-stemming F0.5 F1 MCC
1 Radixor ALL_CANDIDATES 0.999960 13214 / 165926276 (0.007964%) 0 / 30595 (0.000000%) 0.743207 0.822402 0.835654
Classification metrics
Rank Stemmer Output policy Precision Recall Specificity Balanced accuracy Pairwise accuracy Error rate
1 Radixor ALL_CANDIDATES 0.698372 1.000000 0.999920 0.999960 0.999920 0.000080
Pair-relation metrics
Rank Stemmer Output policy F0.5 F1 F2 Jaccard FowlkesMallows MCC
1 Radixor ALL_CANDIDATES 0.743207 0.822402 0.920488 0.698372 0.835687 0.835654
Partition metrics (PRIMARY_OUTPUT only)
Rank Stemmer Output policy Adjusted Rand Index Homogeneity Completeness V-measure Normalized mutual information
1 Radixor ALL_CANDIDATES n/a n/a n/a n/a n/a
Raw pair counts
Rank Stemmer Output policy TP FP FN TN Over error / possible Under error / possible
1 Radixor ALL_CANDIDATES 30595 13214 0 165913062 13214 / 165926276 0 / 30595

Multi-output analysis

Alternative candidates are capability analyses, not replacements for the deterministic comparison.

Stemmer Under pairs repaired Best-case over pairs avoided All-candidate collisions added Multi-candidate forms Multi-candidate share Maximum candidates Total candidate assignments
Radixor 3924 6230 6984 2399 13.167572% 5 21477

Output Policies and Metric Definitions

PRIMARY_OUTPUT uses one deterministic stem per form and therefore defines a strict partition. ANY_CANDIDATE is an optimistic oracle-assisted pairwise upper bound: a same-group pair succeeds when candidates intersect, while a different-group pair succeeds when a non-colliding selection exists. Candidate choices may differ between pairs, so this is not deterministic runtime behaviour and need not represent one globally consistent assignment. ALL_CANDIDATES activates every returned candidate; forms are related when candidate sets intersect. Alternatives can reduce under-stemming but can introduce cross-group collisions, and the resulting relation can overlap and need not be a partition.

For each row, TP = underPossiblePairs - underErrorPairs, FN = underErrorPairs, FP = overErrorPairs, and TN = overPossiblePairs - overErrorPairs. TP and FN concern same-group pairs; FP and TN concern different-group pairs. Consequently, under-stemming and over-stemming use different denominators. Undefined values are rendered as n/a.

  • Under-stemming rate: FN / (TP + FN), the false-negative rate over same-group pairs.
  • Over-stemming rate: FP / (TN + FP), the false-positive rate over different-group pairs.
  • Pairwise precision: TP / (TP + FP), the fraction of predicted conflations that are gold-standard positive pairs.
  • Pairwise recall: TP / (TP + FN), the fraction of gold-standard positive pairs successfully connected.
  • Pairwise specificity: TN / (TN + FP), the fraction of different-group pairs correctly separated.
  • Balanced accuracy: (recall + specificity) / 2. It gives equal weight to positive and negative pair classes and is less dominated by the large true-negative class than ordinary accuracy. It does not replace the raw errors or other metrics.
  • Pairwise F-beta: ((1 + betaSquared) * TP) / (((1 + betaSquared) * TP) + (betaSquared * FN) + FP). F0.5 emphasizes precision and penalizes over-stemming more; F1 weights precision and recall equally; F2 emphasizes recall and penalizes under-stemming more.
  • MCC: (TP * TN - FP * FN) / sqrt((TP + FP) * (TP + FN) * (TN + FP) * (TN + FN)). It uses all confusion counts and remains useful under class imbalance, except when its denominator is degenerate.
  • Jaccard index: TP / (TP + FP + FN).
  • FowlkesMallows index: sqrt(precision * recall).
  • Pairwise accuracy: (TP + TN) / (TP + TN + FP + FN). It can be dominated by true-negative cross-group pairs.
  • Pairwise error rate: (FP + FN) / (TP + TN + FP + FN).

Adjusted Rand Index uses the gold/predicted contingency table and chance correction. Homogeneity is 1 - H(gold | predicted) / H(gold); completeness is 1 - H(predicted | gold) / H(predicted); V-measure is their harmonic mean; normalized mutual information uses the arithmetic-mean entropy normalization MI / ((H(gold) + H(predicted)) / 2). These partition-only metrics apply to PRIMARY_OUTPUT; candidate-relation rows show n/a.

Provenance

  • Authoritative source: docs/benchmarks/data/stemming-quality.csv
  • Source SHA-256: 5a93a6ab60e46489737cd649eb1ac48182114b9038f7f20195ab9d1c1fc0dd28
  • Evaluation command: ./gradlew stemmingQuality
  • Dictionary language: NN_NO
  • Processing modes: ALL_WORDS, LOWERCASE_GROUPS_ONLY
  • Stemmer versions and transitive artifacts: resolved by the repository's JMH Gradle configuration and gradle.lockfile
  • Radixor version, Git revision, generation date, JDK version, operating system, and dictionary revision: not recorded in the authoritative CSV