id_core_news_md

A medium-size Indonesian spaCy pipeline, built the way en_core_web_md relates to en_core_web_sm: the components of id_core_news_sm 0.6.1 plus static word vectors. These are 20,000 fastText vectors covering 500,000 words, used by the named entity recognizer. The vectors improve NER on every 18-label test set and on four of the five human-annotated ones; tagging, lemmas and parsing are those of id_core_news_sm 0.6.1, unchanged. CPU-only, about 16k words/s.

Components:

  • a tokenizer that follows Universal Dependencies word segmentation;
  • a morphologizer (UPOS + morphological features);
  • a lemmatizer and a dependency parser;
  • named entity recognition with the 18 OntoNotes labels;
  • a sentence segmenter, included but disabled, as in English. The parser sets sentence boundaries.

Research use only. Training data includes the IDN Tagged Corpus (CC BY-NC-SA 4.0). This model is licensed CC BY-NC-SA 4.0 and must not be used commercially. Several of the NER training sets have no stated licence (details).

Version 0.1.0 (first release)
spaCy ≥ 3.8, < 3.9
Size 34.8 MB wheel (the small model: 14.0 MB)
Speed ~16k words/s on an Apple M3 Pro CPU, about the same as the small model

Install and use

pip install https://huggingface.co/firqaaa/id_core_news_md/resolve/main/id_core_news_md-0.1.0-py3-none-any.whl

The small model without vectors is id_core_news_sm. Its UD components and rules are the same; this model differs only in its NER component and the word vectors.

import spacy

nlp = spacy.load("id_core_news_md")
doc = nlp("Presiden Joko Widodo meresmikan Bandara Yogyakarta di Kabupaten Kulon Progo "
          "pada 28 Agustus 2020 dengan biaya Rp 11 triliun. Bukunya dibaca warga Tionghoa.")

print([(e.text, e.label_) for e in doc.ents])
# [('Joko Widodo', 'PERSON'), ('Bandara Yogyakarta', 'FAC'), ('Kabupaten Kulon Progo', 'GPE'),
#  ('28 Agustus 2020', 'DATE'), ('Rp 11 triliun', 'MONEY'), ('Tionghoa', 'NORP')]
print([(t.text, t.pos_, t.lemma_, t.dep_) for t in doc][:4])
# [('Presiden', 'PROPN', 'Presiden', 'nsubj'), ('Joko', 'PROPN', 'Joko', 'flat:name'), ...]

The wheel bundles the custom components: the tokenizer (id_ud_tokenizer.v1), the lemma fallback (id_lemma_fallback) and the rule entity component (id_rule_ner). To load the files in this repo directly instead of the wheel, import id_tokenizer.py, id_lemma.py and id_rules.py first.

What it does

Component Notes
tok2vec Pretrained with spacy pretrain (character objective) on Indonesian Wikipedia plus a truecased sample of Indo4B, then trained with each component.
Tokenizer UD-style segmentation. Clitics are split off (bukunya → buku nya, apakah → apa kah) only when a word list confirms the rest is a word, so hanya and punya stay whole. Hyphenated words stay whole (anak-anak, ke-3, 1990-an).
morphologizer UPOS + UD features (not XPOS: the UD Indonesian treebanks use different XPOS tagsets).
trainable_lemmatizer UD Indonesian lemmas, with affixes stripped (meresmikan → resmi).
id_lemma_fallback For words not seen in training: spaCy's Indonesian lemma lookup table, reduplication (anjing-anjing → anjing) and a verb affix stripper checked against a root list. For all words: full reduplications get the lemma of their half (toko-toko → toko) unless training keeps them whole. Sets one casing convention: proper-noun lemmas keep their case (Jakarta), all others are lowercase.
parser UD dependency relations; also sets sentence boundaries.
Word vectors 20,000 × 300 fastText vectors (cc.id.300, trained on Common Crawl and Wikipedia) covering the 500,000 most frequent words. Pruned the way en_core_web_md's are: rare words share the vector of their nearest frequent neighbour. token.vector and doc.similarity() use them.
ner Uses the word vectors as an extra input. All 18 OntoNotes labels: PERSON, NORP, FAC, ORG, GPE, LOC, PRODUCT, EVENT, WORK_OF_ART, LAW, LANGUAGE, DATE, TIME, PERCENT, MONEY, QUANTITY, ORDINAL, CARDINAL.
id_rule_ner Rules for dates, times, money, percentages, quantities, ordinals, numbers, laws (UU No. 11 Tahun 2008), NORP, LANGUAGE, EVENT and WORK_OF_ART. It fills gaps left by ner, and fixes split date, number and law spans; it never overrides names.

Results

All scores are in % on frozen test sets that were never used for training or model selection (NER models are chosen on a Claude-annotated dev set and the human-annotated dev splits of the NER sets below). Evaluation is on raw text, so the pipeline's own tokenizer is included, which is how en_core_web_sm is reported.

Tagging, lemmas and parsing (UD r2.19 test sets):

Test set Token F UPOS Feats Lemma Lemma (case-insensitive) UAS LAS Sentence F
GSD 99.64 93.30 94.32 80.40 97.92 84.27 75.40 88.42
CSUI 98.99 94.55 94.59 92.56 96.83 78.85 68.89 85.44
PUD 99.43 93.16 91.23 90.43 92.09 81.79 66.82 90.79

These are the released pipeline's scores. Lemma casing differs between treebanks. GSD lowercases every lemma; CSUI and PUD keep the case of proper nouns, as this pipeline does. So GSD's case-sensitive lemma score is low for reasons of convention only. The case-insensitive column measures the lemmatization itself. Over 3 seeds, compared with 0.3.0's recipe, case-insensitive lemma accuracy is up +0.7 (GSD), +0.6 (CSUI) and +1.4 (PUD), and PUD's case-sensitive score rose from 80.0 to 90.1. 0.4.1's reduplication rule adds +0.3 (GSD), +0.1 (CSUI) and +0.3 (PUD) case-insensitive. Against 0.2.0's recipe, LAS is up about +1 on average.

For comparison, en_core_web_sm 3.8 reports LAS 89.9 on OntoNotes. It has about 13 times more training data than the ~116k words of UD Indonesian.

NER on existing Indonesian test sets. These annotate only persons, organisations and places, so GPE, LOC and FAC are scored together as PLACE, and other labels are ignored:

Test set F1
NER UI (IndoLEM, fold 01) 88.10
NER UGM (IndoLEM, fold 01) 76.98
NERGRIT (IndoNLU) 69.34
Luthfi et al. (2014) Wikipedia gold 74.49
NERP (IndoNLU), truecased 73.35

Single-run NER scores vary by about ±1–2 F. Over 3 seeds the recipe averages NER UI 87.12, NER UGM 75.98, NERGRIT 69.48, Luthfi 74.43 and NERP 73.45 (id_core_news_sm 0.6.1's recipe: 84.64, 77.12, 67.43, 72.34, 73.00).

All 18 labels: the NER-18 test set. 931 sentences from the UD Indonesian-GSD and -CSUI test sets, 2,675 entities. It was annotated by Claude (Anthropic's model), not by humans: independent first passes, a blind second pass on 200 sentences (exact-match agreement 0.963), and a review of every sentence against the guideline. No human has verified it yet, so read these as provisional.

F1
All labels 78.32 (precision 80.37, recall 76.37; 3 seeds of this recipe: 78.06 ± 0.48; id_core_news_sm 0.6.1: 76.67)
PERCENT, MONEY, ORDINAL, DATE, CARDINAL 98.2, 94.7, 90.4, 88.4, 85.7
GPE, PERSON, LANGUAGE, QUANTITY, ORG, TIME 83.3, 81.1, 58.3, 80.9, 69.2, 31.6
LOC, NORP, FAC 54.9, 52.0, 45.8
LAW, EVENT, WORK_OF_ART, PRODUCT 44.4, 46.4, 42.0, 37.2: unreliable

Batch 3, translated text (UD Indonesian-PUD test, 1,000 sentences, 1,976 entities, annotated the same way): 73.84 F (3 seeds of this recipe: 73.40; id_core_news_sm 0.6.1: 70.56).

LANGUAGE, LAW and TIME have fewer than 20 mentions each.

Silver dev set (development only, listed separately in the evaluation results). It has gold person, organisation and place spans plus rule and LLM labels, made the same way as the training data. It scored 0.4.1 at 80.8 overall, 15 points above the NER-18 test, and overstated the rare labels most (LAW and LANGUAGE 100, NORP 88). For this model it gives 78.3, against 78.3 on the NER-18 test. Don't read its numbers as accuracy.

Training data and licences

Data Used for Licence
fastText Indonesian word vectors cc.id.300 (Grave et al. 2018), pruned Word vectors used by ner CC BY-SA 3.0
UD Indonesian-GSD and -CSUI r2.19 (train) Tokenizer word list, tagging, lemmas, parsing CC BY-SA 4.0
IDN Tagged Corpus (Dinakaramani et al. 2014), mapped to UPOS Extra POS data CC BY-NC-SA 4.0
NERGRIT, NERP (IndoNLU); NER UI, NER UGM (IndoLEM) NER (NERP truecased) Not stated by the authors
Wikidata place names Splitting PLACE into GPE / LOC / FAC in the training data CC0
spaCy lookup tables (spacy-lookups-data) Tokenizer word list; lemma fallback (Indonesian lemma lookup table) MIT
Indonesian Wikipedia, 2023-11-01 dump (105M words, filtered) tok2vec pretraining (raw text, no labels) CC BY-SA 3.0 / GFDL
Indo4B (IndoNLU): 99M words sampled from web, news and subtitle text, truecased tok2vec pretraining (raw text, no labels) Stated CC0 by SEACrowd; the texts themselves are third-party
4,675 UD Indonesian-GSD and -CSUI train sentences, annotated with the 18 labels by Claude (Anthropic), not human-verified NER training (2,000 since 0.5.0, all since 0.6.0) CC BY-SA 4.0 (the UD text's licence)
2,000 Indonesian Wikipedia sentences picked for rare labels, annotated the same way NER training (since 0.6.0) CC BY-SA 3.0 / 4.0
Qwen3 8B (local, via Ollama) Classified ~3,000 span types already marked in NERP as ORG / PRODUCT / EVENT / WORK_OF_ART / DATE Labels only; no model text is in the pipeline

Test sentences from every frozen test set were removed from all training data, including the pretraining text.

Limitations

  • PRODUCT, WORK_OF_ART, LAW and EVENT are unreliable (37.2–46.4 F on the NER-18 test), and NORP and FAC are weak (52.0, 45.8). ORG (69.2) is the weakest of the frequent labels.
  • NER UGM is the one human-annotated test set that does not improve over id_core_news_sm (3-seed means 75.98 vs 77.12), although its dev split did.
  • The NER-18 test and dev sets, and 6,675 training sentences, were annotated by Claude, not by humans. The human-annotated 3-label test sets improved too, but the 18-label scores are provisional.
  • Merging GPE, LOC and FAC back into one place label costs some place recall compared with a single PLACE label. 15–30% of training place mentions could not be typed, so they were left out of training.
  • Mostly formal written Indonesian (news, Wikipedia). Expect lower accuracy on social media, informal or regional-language text.
  • The two UD treebanks segment some words differently (e.g. hyphenated ranges, Tbk.); the tokenizer follows GSD.

Changes in 0.1.0

First release. It is id_core_news_sm 0.6.1 with a NER component retrained with the word vectors, on the same data. The NER data is the older NER datasets plus 6,675 Claude-annotated sentences. The model was chosen on the Claude-annotated dev set (73.74 → 74.10 over 3 seeds) and on the human-annotated NER dev splits (76.43 → 77.63). Training the UD components with the vectors instead of the pretrained tok2vec cost 0.6 LAS, so they are kept from id_core_news_sm 0.6.1. For the small model's version history, see its model card.

Source

The full code, data pipeline and reports are in the project repository under id-core-web-md/ (this model) and id-core-web-sm/ (shared code, data and reports): the data inventory, conventions, NER guideline, phase reports, the 3-seed noise study (docs/07), the pretraining report (docs/08) and the lemmatizer report (docs/09).

Downloads last month
12
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Evaluation results

  • Token F1 on UD Indonesian-GSD r2.19 (test)
    self-reported
    0.996
  • UPOS accuracy on UD Indonesian-GSD r2.19 (test)
    self-reported
    0.933
  • Feats accuracy on UD Indonesian-GSD r2.19 (test)
    self-reported
    0.943
  • Lemma accuracy on UD Indonesian-GSD r2.19 (test)
    self-reported
    0.804
  • Lemma accuracy (case-insensitive) on UD Indonesian-GSD r2.19 (test)
    self-reported
    0.979
  • UAS on UD Indonesian-GSD r2.19 (test)
    self-reported
    0.843
  • LAS on UD Indonesian-GSD r2.19 (test)
    self-reported
    0.754
  • Sentence F1 on UD Indonesian-GSD r2.19 (test)
    self-reported
    0.884