--- language: - id license: cc-by-nc-sa-4.0 library_name: spacy pipeline_tag: token-classification tags: - spacy - token-classification - dependency-parsing - pos-tagging - lemmatization - ner - transformers base_model: indolem/indobert-base-uncased model-index: - name: id_core_web_trf results: - task: type: token-classification name: POS (UPOS) dataset: type: universal_dependencies name: UD Indonesian-GSD r2.19 (test) metrics: - type: accuracy value: 0.9102 name: UPOS accuracy - task: type: token-classification name: Morphological features dataset: type: universal_dependencies name: UD Indonesian-GSD r2.19 (test) metrics: - type: accuracy value: 0.9221 name: Feats accuracy - task: type: token-classification name: Lemmatization dataset: type: universal_dependencies name: UD Indonesian-GSD r2.19 (test) metrics: - type: accuracy value: 0.7767 name: Lemma accuracy - type: accuracy value: 0.9432 name: Lemma accuracy (case-insensitive) - task: type: token-classification name: Dependency parsing dataset: type: universal_dependencies name: UD Indonesian-GSD r2.19 (test) metrics: - type: uas value: 0.8396 name: UAS - type: las value: 0.7352 name: LAS - task: type: token-classification name: Sentence segmentation dataset: type: universal_dependencies name: UD Indonesian-GSD r2.19 (test) metrics: - type: f1 value: 0.8611 name: Sentence F1 - task: type: token-classification name: POS (UPOS) dataset: type: universal_dependencies name: UD Indonesian-CSUI r2.19 (test) metrics: - type: accuracy value: 0.9216 name: UPOS accuracy - task: type: token-classification name: Morphological features dataset: type: universal_dependencies name: UD Indonesian-CSUI r2.19 (test) metrics: - type: accuracy value: 0.9233 name: Feats accuracy - task: type: token-classification name: Lemmatization dataset: type: universal_dependencies name: UD Indonesian-CSUI r2.19 (test) metrics: - type: accuracy value: 0.8822 name: Lemma accuracy - type: accuracy value: 0.9277 name: Lemma accuracy (case-insensitive) - task: type: token-classification name: Dependency parsing dataset: type: universal_dependencies name: UD Indonesian-CSUI r2.19 (test) metrics: - type: uas value: 0.7679 name: UAS - type: las value: 0.6695 name: LAS - task: type: token-classification name: Sentence segmentation dataset: type: universal_dependencies name: UD Indonesian-CSUI r2.19 (test) metrics: - type: f1 value: 0.8712 name: Sentence F1 - task: type: token-classification name: POS (UPOS) dataset: type: universal_dependencies name: UD Indonesian-PUD r2.19 (test) metrics: - type: accuracy value: 0.9181 name: UPOS accuracy - task: type: token-classification name: Morphological features dataset: type: universal_dependencies name: UD Indonesian-PUD r2.19 (test) metrics: - type: accuracy value: 0.8983 name: Feats accuracy - task: type: token-classification name: Lemmatization dataset: type: universal_dependencies name: UD Indonesian-PUD r2.19 (test) metrics: - type: accuracy value: 0.8808 name: Lemma accuracy - type: accuracy value: 0.8961 name: Lemma accuracy (case-insensitive) - task: type: token-classification name: Dependency parsing dataset: type: universal_dependencies name: UD Indonesian-PUD r2.19 (test) metrics: - type: uas value: 0.8345 name: UAS - type: las value: 0.6779 name: LAS - task: type: token-classification name: Sentence segmentation dataset: type: universal_dependencies name: UD Indonesian-PUD r2.19 (test) metrics: - type: f1 value: 0.9346 name: Sentence F1 - task: type: token-classification name: NER (PERSON/ORG/PLACE) dataset: type: indolem/nerui name: NER UI (IndoLEM, fold 01 test) metrics: - type: precision value: 0.9359 name: NER precision - type: recall value: 0.8922 name: NER recall - type: f1 value: 0.9135 name: NER F1 - task: type: token-classification name: NER (PERSON/ORG/PLACE) dataset: type: indolem/nerugm name: NER UGM (IndoLEM, fold 01 test) metrics: - type: precision value: 0.7851 name: NER precision - type: recall value: 0.8444 name: NER recall - type: f1 value: 0.8137 name: NER F1 - task: type: token-classification name: NER (PERSON/ORG/PLACE) dataset: type: indonlp/indonlu-nergrit name: NERGRIT (IndoNLU test) metrics: - type: precision value: 0.7903 name: NER precision - type: recall value: 0.7834 name: NER recall - type: f1 value: 0.7869 name: NER F1 - task: type: token-classification name: NER (PERSON/ORG/PLACE) dataset: type: ialfina/ner-dataset-modified-dee name: Luthfi et al. (2014) Wikipedia gold standard metrics: - type: precision value: 0.8753 name: NER precision - type: recall value: 0.7934 name: NER recall - type: f1 value: 0.8324 name: NER F1 - task: type: token-classification name: NER (PERSON/ORG/PLACE) dataset: type: indonlp/indonlu-nerp name: NERP (IndoNLU test, truecased) metrics: - type: precision value: 0.7766 name: NER precision - type: recall value: 0.8616 name: NER recall - type: f1 value: 0.8169 name: NER F1 - task: type: token-classification name: NER, 18 OntoNotes labels (LLM-annotated test set, not human-verified) dataset: type: ner18-test name: 'NER-18 test: UD Indonesian-GSD and -CSUI r2.19 test sentences (931), annotated by an LLM, not human-verified' metrics: - type: precision value: 0.8749 name: NER precision, all labels - type: recall value: 0.8467 name: NER recall, all labels - type: f1 value: 0.8606 name: NER F1, all labels - type: f1 value: 0.9327 name: PERSON F1 - type: f1 value: 0.7288 name: NORP F1 - type: f1 value: 0.6606 name: FAC F1 - type: f1 value: 0.8166 name: ORG F1 - type: f1 value: 0.8855 name: GPE F1 - type: f1 value: 0.6078 name: LOC F1 - type: f1 value: 0.6364 name: PRODUCT F1 - type: f1 value: 0.5758 name: EVENT F1 - type: f1 value: 0.7167 name: WORK_OF_ART F1 - type: f1 value: 0.3200 name: LAW F1 - type: f1 value: 0.9143 name: LANGUAGE F1 - type: f1 value: 0.8526 name: DATE F1 - type: f1 value: 0.6667 name: TIME F1 - type: f1 value: 0.9927 name: PERCENT F1 - type: f1 value: 0.9799 name: MONEY F1 - type: f1 value: 0.9000 name: QUANTITY F1 - type: f1 value: 0.8039 name: ORDINAL F1 - type: f1 value: 0.9175 name: CARDINAL F1 - task: type: token-classification name: NER, 18 OntoNotes labels (LLM-annotated test set, not human-verified) dataset: type: ner18-test-pud name: 'NER-18 test, batch 3: UD Indonesian-PUD r2.19 test sentences (1,000, translated), annotated by an LLM, not human-verified' metrics: - type: precision value: 0.8275 name: NER precision, all labels - type: recall value: 0.7961 name: NER recall, all labels - type: f1 value: 0.8115 name: NER F1, all labels - type: f1 value: 0.9078 name: PERSON F1 - type: f1 value: 0.6512 name: NORP F1 - type: f1 value: 0.4407 name: FAC F1 - type: f1 value: 0.6622 name: ORG F1 - type: f1 value: 0.8455 name: GPE F1 - type: f1 value: 0.7774 name: LOC F1 - type: f1 value: 0.3556 name: PRODUCT F1 - type: f1 value: 0.6835 name: EVENT F1 - type: f1 value: 0.8041 name: WORK_OF_ART F1 - type: f1 value: 0.8000 name: LAW F1 - type: f1 value: 0.6250 name: LANGUAGE F1 - type: f1 value: 0.8226 name: DATE F1 - type: f1 value: 0.5455 name: TIME F1 - type: f1 value: 0.9545 name: PERCENT F1 - type: f1 value: 0.8302 name: MONEY F1 - type: f1 value: 0.8421 name: QUANTITY F1 - type: f1 value: 0.8000 name: ORDINAL F1 - type: f1 value: 0.8993 name: CARDINAL F1 - task: type: token-classification name: NER, 18 OntoNotes labels (silver dev, not a test set) dataset: type: silver-dev name: 'Silver dev set (1,362 sentences): gold PERSON/ORG/place spans plus rule and LLM labels, not human-annotated' metrics: - type: precision value: 0.8075 name: NER precision, all labels (silver) - type: recall value: 0.8308 name: NER recall, all labels (silver) - type: f1 value: 0.8190 name: NER F1, all labels (silver) - type: f1 value: 0.8918 name: PERSON F1 (silver) - type: f1 value: 0.6047 name: NORP F1 (silver) - type: f1 value: 0.7745 name: FAC F1 (silver) - type: f1 value: 0.7847 name: ORG F1 (silver) - type: f1 value: 0.8891 name: GPE F1 (silver) - type: f1 value: 0.8247 name: LOC F1 (silver) - type: f1 value: 0.5244 name: PRODUCT F1 (silver) - type: f1 value: 0.4696 name: EVENT F1 (silver) - type: f1 value: 0.4970 name: WORK_OF_ART F1 (silver) - type: f1 value: 0.9474 name: LAW F1 (silver) - type: f1 value: 0.6667 name: LANGUAGE F1 (silver) - type: f1 value: 0.8326 name: DATE F1 (silver) - type: f1 value: 0.9250 name: TIME F1 (silver) - type: f1 value: 0.7755 name: PERCENT F1 (silver) - type: f1 value: 0.8267 name: MONEY F1 (silver) - type: f1 value: 0.6269 name: QUANTITY F1 (silver) - type: f1 value: 0.8324 name: ORDINAL F1 (silver) - type: f1 value: 0.8226 name: CARDINAL F1 (silver) --- # id_core_web_trf An Indonesian transformer spaCy pipeline, built the way `en_core_web_trf` relates to `en_core_web_sm`. One transformer, [`indolem/indobert-base-uncased`](https://huggingface.co/indolem/indobert-base-uncased), is shared by all trained components, which are trained together on the same data as [`id_core_web_sm`](https://huggingface.co/firqaaa/id_core_web_sm) 0.6.1. It uses the small model's tokenizer, lemma fallback and entity rules. Against `id_core_web_sm` 0.6.1, **NER is much better**: +9.4 F on the 18-label NER-18 test and +5 to +11 F on each of the five human-annotated test sets. **Tagging, lemmas and parsing are worse**: −1.4 to −2.4 UPOS, and −1.9 LAS on GSD and CSUI (+1.0 on PUD). It is also about 6 times slower on CPU and 30 times larger. Use it when entities matter most; for everything else, `id_core_web_sm` is the better choice. Components: - a tokenizer that follows Universal Dependencies word segmentation (the same as `id_core_web_sm`); - a transformer (IndoBERT, 12 layers, lowercase input); - a morphologizer (UPOS + morphological features); - a lemmatizer and a dependency parser; - named entity recognition with the 18 OntoNotes labels. > **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](#training-data-and-licences)). | | | |---|---| | Version | 0.1.0 | | spaCy | ≥ 3.8.18, < 3.9; spacy-transformers ≥ 2.0.3, < 2.1 | | Size | 414 MB wheel (`id_core_web_sm`: 14.0 MB) | | Speed | ~2.7k words/s on an Apple M3 Pro CPU (`id_core_web_sm`: ~17k). Much faster on a GPU (`spacy.prefer_gpu()`). | ## Install and use ```bash pip install https://huggingface.co/firqaaa/id_core_web_trf/resolve/main/id_core_web_trf-0.1.0-py3-none-any.whl ``` This installs `spacy-transformers` (and PyTorch) as dependencies. **Renamed on 2026-12-04** from `id_core_news_trf` to `id_core_web_trf`, to match the `en_core_web_*` models it follows. The old repo address redirects here. **0.1.0 is a new model**, not an update of the 2024 one that this repo held before (version 0.0.4, spaCy 3.7, with an XPOS tagger). That model's wheel, `id_core_news_trf-any-py3-none-any.whl`, is still in this repo, so its install link keeps working, and its files are in the repo's history. ```python import spacy nlp = spacy.load("id_core_web_trf") 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 | |---|---| | `transformer` | `indolem/indobert-base-uncased` (IndoLEM; BERT base, trained on 220M words of Indonesian Wikipedia, news and web text). Fine-tuned with all components. The model lowercases its input, so it cannot see capital letters. | | Tokenizer | UD-style segmentation, the same as `id_core_web_sm`. 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 (`dibaca` → `baca`). | | `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. | | `ner` | 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. Evaluation is on raw text, so the pipeline's own tokenizer is included, which is how `en_core_web_sm` is reported. One training run (seed 0); `id_core_web_sm` 0.6.1 is shown for comparison. **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 | 91.02 | 92.21 | 77.67 | 94.32 | 83.96 | 73.52 | 86.11 | | `id_core_web_sm` 0.6.1 | 99.64 | **93.30** | **94.32** | **80.40** | **97.92** | **84.27** | **75.40** | **88.42** | | CSUI | 98.99 | 92.16 | 92.33 | 88.22 | 92.77 | 76.79 | 66.95 | **87.12** | | `id_core_web_sm` 0.6.1 | 98.99 | **94.55** | **94.59** | **92.56** | **96.83** | **78.85** | **68.89** | 85.44 | | PUD | 99.43 | 91.81 | 89.83 | 88.08 | 89.61 | **83.45** | **67.79** | **93.46** | | `id_core_web_sm` 0.6.1 | 99.43 | **93.16** | **91.23** | **90.43** | **92.09** | 81.79 | 66.82 | 90.79 | The tokenizer is the small model's, so Token F is the same. **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. **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 | `id_core_web_sm` 0.6.1 | |---|---:|---:| | NER UI (IndoLEM, fold 01) | **91.35** | 84.24 | | NER UGM (IndoLEM, fold 01) | **81.37** | 76.34 | | NERGRIT (IndoNLU) | **78.69** | 68.00 | | Luthfi et al. (2014) Wikipedia gold | **83.24** | 72.57 | | NERP (IndoNLU), truecased | **81.69** | 73.97 | | Average | **83.27** | 75.02 | **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 an LLM, 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** | **86.06** (precision 87.49, recall 84.67; `id_core_web_sm` 0.6.1: 76.67) | | PERCENT, MONEY, PERSON, CARDINAL, LANGUAGE, QUANTITY | 99.3, 98.0, 93.3, 91.8, 91.4, 90.0 | | GPE, DATE, ORG, ORDINAL | 88.5, 85.3, 81.7, 80.4 | | NORP, WORK_OF_ART, TIME, FAC, PRODUCT, LOC | 72.9, 71.7, 66.7, 66.1, 63.6, 60.8 | | EVENT, LAW | 57.6, 32.0: **unreliable** | **Batch 3, translated text** (UD Indonesian-PUD test, 1,000 sentences, 1,976 entities, annotated the same way): **81.15** F (precision 82.75, recall 79.61; `id_core_web_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 overstates some labels and understates others, so don't read its numbers as accuracy. For this model it gives 81.9 (`id_core_web_sm` 0.6.1: 76.7), against 86.1 on the NER-18 test. ## Training spaCy's quickstart config for Indonesian (accuracy, GPU, transformer), filled with `spacy init fill-config`, without the tagger (the UD data has no shared XPOS tagset). All components train together on one corpus: UD Indonesian-GSD and -CSUI train plus the IDN Tagged Corpus (POS only), and the NER training data of `id_core_web_sm` 0.6.1. Training ran on a Colab T4 GPU for about 3.5 hours, with a learning rate of 5e-5 (warmup, then linear decay) and early stopping after 1,600 steps without improvement. It was evaluated every 200 steps on GSD dev plus the LLM-annotated NER dev set. The best checkpoint was step 11,400 of 13,000. That trained model was then wrapped in `id_core_web_sm`'s tokenizer, lemma fallback and rules. On the dev sets this was chosen over the model as trained, with spaCy's default tokenizer: GSD dev lemma 90.05 → 91.81, LAS 70.18 → 71.62, sentence F 86.18 → 86.21, with NER about the same (human-annotated dev splits 84.17 → 84.12). Compared with `id_core_web_sm` 0.6.1 on the same dev sets: | Dev set | This model | `id_core_web_sm` 0.6.1 | |---|---:|---:| | GSD dev UPOS / lemma / LAS | 89.89 / 91.81 / 71.62 | **92.94 / 96.46 / 74.59** | | NER, LLM-annotated dev set | **83.86** | 73.60 | | NER, human-annotated dev splits (NERGRIT, NER UI, NER UGM, NERP), average | **84.12** | 76.79 | ## Training data and licences | Data | Used for | Licence | |---|---|---| | `indolem/indobert-base-uncased` (Koto et al. 2020) | Pretrained transformer | MIT | | 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 | | 4,675 UD Indonesian-GSD and -CSUI train sentences, annotated with the 18 labels by an LLM, not human-verified | NER training | 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 | 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. ## Limitations - **Tagging, lemmas and parsing are below `id_core_web_sm`** on GSD and CSUI (UPOS −2.3 and −2.4, case-insensitive lemma −3.6 and −4.1, LAS −1.9 on both). The transformer is uncased, which most likely hurts proper nouns and lemmas. - **The lemmatizer leaves some affixed verbs unchanged** (`meresmikan` stays `meresmikan`; `id_core_web_sm` gives `resmi`). The clitic `nya` occasionally gets an empty lemma: 29 of about 41,000 test tokens. - **LAW and EVENT are unreliable** (32.0 and 57.6 F on the NER-18 test), and LOC, PRODUCT, FAC and TIME are weak (60.8–66.7). - **Slow and large**: about 6 times slower than `id_core_web_sm` on CPU, and 414 MB. - One training run. `id_core_web_sm`'s scores vary by about ±1–2 F between seeds, so single differences smaller than that are not reliable. - The NER-18 test and dev sets, and 6,675 training sentences, were annotated by an LLM, not by humans. The human-annotated 3-label test sets improved too, but the 18-label scores are provisional. - **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. ## Source The full code, data pipeline and reports are in the project repository under `id-core-web-trf/` (this model) and `id-core-web-sm/` (shared code, data and reports): the data inventory, conventions, NER guideline, the NER-18 test report (docs/11) and the quickstart config comparison (docs/15).