Token Classification
spaCy
Indonesian
dependency-parsing
pos-tagging
lemmatization
ner
Eval Results (legacy)
Run this model with HF Jobs
Run firqaaa/id_core_web_sm on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/firqaaa/id_core_web_sm. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/firqaaa/id_core_web_sm on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use firqaaa/id_core_web_sm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- spaCy
How to use firqaaa/id_core_web_sm with spaCy:
!pip install https://huggingface.co/firqaaa/id_core_web_sm/resolve/main/id_core_web_sm-any-py3-none-any.whl # Using spacy.load(). import spacy nlp = spacy.load("id_core_web_sm") # Importing as module. import id_core_web_sm nlp = id_core_web_sm.load() - Notebooks
- Google Colab
- Kaggle
Release id_core_news_sm 0.6.1
Browse filesFiles changed (7)
44 unmodified lines45464744 unmodified linesid_core_news_sm-0.4.1-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.5.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.6.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text44 unmodified lines4546474844 unmodified linesid_core_news_sm-0.4.1-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.5.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.6.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.6.1-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
299 unmodified lines30030130230330430530630730830931031131229 unmodified lines3423433443453463473483493503513523533543553563573583593603613623633643653663 unmodified lines37037137237337437537637737837938038138229 unmodified lines41241341441541641741841942042142242342442542642742842943043143243343443543612 unmodified lines4494504514524534544551 unmodified line45745845946046146246346446546656 unmodified lines52352452552652752852953053153253353453553653720 unmodified lines558559560561562563299 unmodified linesname: 'NER-18 test: UD Indonesian-GSD and -CSUI r2.19 test sentences (931), annotated by Claude, not human-verified'metrics:- type: precisionvalue: 0.7680name: NER precision, all labels- type: recallvalue: 0.7424name: NER recall, all labels- type: f1value: 0.7550name: NER F1, all labels- type: f1value: 0.787229 unmodified linesvalue: 0.7586name: LANGUAGE F1- type: f1value: 0.8333name: DATE F1- type: f1value: 0.6316name: TIME F1- type: f1value: 0.9562name: PERCENT F1- type: f1value: 0.9407name: MONEY F1- type: f1value: 0.6667name: QUANTITY F1- type: f1value: 0.8911name: ORDINAL F1- type: f1value: 0.8333name: CARDINAL F1- task:type: token-classification3 unmodified linesname: 'Silver dev set (1,362 sentences): gold PERSON/ORG/place spans plus rule and LLM labels, not human-annotated'metrics:- type: precisionvalue: 0.7683name: NER precision, all labels (silver)- type: recallvalue: 0.7909name: NER recall, all labels (silver)- type: f1value: 0.7794name: NER F1, all labels (silver)- type: f1value: 0.796329 unmodified linesvalue: 0.4000name: LANGUAGE F1 (silver)- type: f1value: 0.8784name: DATE F1 (silver)- type: f1value: 0.9383name: TIME F1 (silver)- type: f1value: 0.9600name: PERCENT F1 (silver)- type: f1value: 0.9189name: MONEY F1 (silver)- type: f1value: 0.8525name: QUANTITY F1 (silver)- type: f1value: 0.8973name: ORDINAL F1 (silver)- type: f1value: 0.8860name: CARDINAL F1 (silver)---12 unmodified lines| | ||---|---|| Version | 0.6.0 (replaces 0.5.0) || spaCy | ≥ 3.8, < 3.9 || Size | 14.0 MB wheel || Speed | ~17k words/s on an Apple M3 Pro CPU |1 unmodified line## Install and use```bashpip install https://huggingface.co/firqaaa/id_core_news_sm/resolve/main/id_core_news_sm-0.6.0-py3-none-any.whl```Earlier wheels are still in this repo: `id_core_news_sm-0.5.0-py3-none-any.whl`, `id_core_news_sm-0.4.1-py3-none-any.whl`, `id_core_news_sm-0.4.0-py3-none-any.whl`, `id_core_news_sm-0.3.0-py3-none-any.whl` and `id_core_news_sm-0.2.0-py3-none-any.whl`.```pythonimport spacy56 unmodified lines| | F1 ||---|---:|| **All labels** | **75.50** (precision 76.80, recall 74.24; 3 seeds of this recipe: 75.89 ± 0.50; 0.5.0: 72.67; 0.4.1: 65.75) || PERCENT, MONEY, ORDINAL, DATE, CARDINAL | 95.6, 94.1, 89.1, 83.3, 83.3 || GPE, PERSON, LANGUAGE, QUANTITY, ORG, TIME | 80.4, 78.7, 75.9, 66.7, 65.3, 63.2 || LOC, NORP, FAC | 58.9, 54.2, 51.3 || LAW, EVENT, WORK_OF_ART, PRODUCT | 41.7, 39.4, 31.0, 26.5: **unreliable** |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 0.6.0 it gives 77.9, against 75.5 on the NER-18 test. Don't read its numbers as accuracy.## Training data and licences20 unmodified lines- **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.6.0- The NER model is retrained with 4,675 more Claude-annotated sentences: the remaining UD GSD training sentences, and 2,000 Wikipedia sentences picked for PRODUCT, EVENT, WORK_OF_ART, LAW and FAC. That makes 6,675 Claude-annotated sentences alongside the older NER datasets.299 unmodified lines30030130230330430530630730830931031131229 unmodified lines3423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354363 unmodified lines44044144244344444544644744844945045145229 unmodified lines48248348448548648748848949049149249349449549649749849950050150250350450550612 unmodified lines5195205215225235245251 unmodified line52752852953053153253353453553656 unmodified lines59359459559659759859960060160260360460560660760860920 unmodified lines630631632633634635636637638639640641299 unmodified linesname: 'NER-18 test: UD Indonesian-GSD and -CSUI r2.19 test sentences (931), annotated by Claude, not human-verified'metrics:- type: precisionvalue: 0.7807name: NER precision, all labels- type: recallvalue: 0.7533name: NER recall, all labels- type: f1value: 0.7667name: NER F1, all labels- type: f1value: 0.787229 unmodified linesvalue: 0.7586name: LANGUAGE F1- type: f1value: 0.8683name: DATE F1- type: f1value: 0.6316name: TIME F1- type: f1value: 0.9854name: PERCENT F1- type: f1value: 0.9802name: MONEY F1- type: f1value: 0.7778name: QUANTITY F1- type: f1value: 0.8911name: ORDINAL F1- type: f1value: 0.8578name: CARDINAL F1- task:type: token-classificationname: NER, 18 OntoNotes labels (Claude-annotated test set, not human-verified)dataset:type: ner18-test-pudname: 'NER-18 test, batch 3: UD Indonesian-PUD r2.19 test sentences (1,000, translated), annotated by Claude, not human-verified'metrics:- type: precisionvalue: 0.7244name: NER precision, all labels- type: recallvalue: 0.6878name: NER recall, all labels- type: f1value: 0.7056name: NER F1, all labels- type: f1value: 0.7409name: PERSON F1- type: f1value: 0.5070name: NORP F1- type: f1value: 0.3810name: FAC F1- type: f1value: 0.4500name: ORG F1- type: f1value: 0.7432name: GPE F1- type: f1value: 0.6240name: LOC F1- type: f1value: 0.2400name: PRODUCT F1- type: f1value: 0.6410name: EVENT F1- type: f1value: 0.5111name: WORK_OF_ART F1- type: f1value: 0.9474name: LAW F1- type: f1value: 0.1111name: LANGUAGE F1- type: f1value: 0.8215name: DATE F1- type: f1value: 0.7273name: TIME F1- type: f1value: 0.9565name: PERCENT F1- type: f1value: 0.7407name: MONEY F1- type: f1value: 0.7778name: QUANTITY F1- type: f1value: 0.8085name: ORDINAL F1- type: f1value: 0.8649name: CARDINAL F1- task:type: token-classification3 unmodified linesname: 'Silver dev set (1,362 sentences): gold PERSON/ORG/place spans plus rule and LLM labels, not human-annotated'metrics:- type: precisionvalue: 0.7568name: NER precision, all labels (silver)- type: recallvalue: 0.7766name: NER recall, all labels (silver)- type: f1value: 0.7665name: NER F1, all labels (silver)- type: f1value: 0.796329 unmodified linesvalue: 0.4000name: LANGUAGE F1 (silver)- type: f1value: 0.8246name: DATE F1 (silver)- type: f1value: 0.9383name: TIME F1 (silver)- type: f1value: 0.8400name: PERCENT F1 (silver)- type: f1value: 0.8108name: MONEY F1 (silver)- type: f1value: 0.7869name: QUANTITY F1 (silver)- type: f1value: 0.8973name: ORDINAL F1 (silver)- type: f1value: 0.8436name: CARDINAL F1 (silver)---12 unmodified lines| | ||---|---|| Version | 0.6.1 (replaces 0.6.0) || spaCy | ≥ 3.8, < 3.9 || Size | 14.0 MB wheel || Speed | ~17k words/s on an Apple M3 Pro CPU |1 unmodified line## Install and use```bashpip install https://huggingface.co/firqaaa/id_core_news_sm/resolve/main/id_core_news_sm-0.6.1-py3-none-any.whl```Earlier wheels are still in this repo: `id_core_news_sm-0.6.0-py3-none-any.whl`, `id_core_news_sm-0.5.0-py3-none-any.whl`, `id_core_news_sm-0.4.1-py3-none-any.whl`, `id_core_news_sm-0.4.0-py3-none-any.whl`, `id_core_news_sm-0.3.0-py3-none-any.whl` and `id_core_news_sm-0.2.0-py3-none-any.whl`.```pythonimport spacy56 unmodified lines| | F1 ||---|---:|| **All labels** | **76.67** (precision 78.07, recall 75.33; 3 seeds of this recipe: 76.80; 0.6.0: 75.50; 0.4.1: 65.75) || PERCENT, MONEY, ORDINAL, DATE, CARDINAL | 98.5, 98.0, 89.1, 86.8, 85.8 || GPE, PERSON, LANGUAGE, QUANTITY, ORG, TIME | 80.4, 78.7, 75.9, 77.8, 65.3, 63.2 || LOC, NORP, FAC | 58.9, 54.2, 51.3 || LAW, EVENT, WORK_OF_ART, PRODUCT | 41.7, 39.4, 31.0, 26.5: **unreliable** |**Batch 3, translated text** (UD Indonesian-PUD test, 1,000 sentences, 1,976 entities, annotated the same way): **70.56** F (3 seeds of this recipe: 71.31; 0.6.0: 69.69; 0.4.1's recipe: 61.21). It is reported separately, so the numbers above stay comparable with earlier versions.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 0.6.1 it gives 76.7, against 76.7 on the NER-18 test. Don't read its numbers as accuracy.## Training data and licences20 unmodified lines- **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.6.1- The rule component now follows guideline v0.2 span conventions (`conventions="v0.2"`). Approximators are inside number spans (`sekitar Rp 9.000`, `lebih dari 20 persen`), `lalu` / `mendatang` are inside full dates (`14 Maret 2007 lalu`), date ranges are one span, and a weekday with a time of day is TIME. The NER and UD models are those of 0.6.0.- NER-18 test: 76.67 F (0.6.0: 75.50); 3 seeds of the recipe: 76.80 (0.6.0's: 75.89). The new batch 3 (PUD, translated text) gives 70.56 (0.6.0: 69.69). The change was chosen on the Claude-annotated dev set: +1.0 over 3 seeds.- The human-annotated 3-label test sets are unchanged, because they score names only.## Changes in 0.6.0- The NER model is retrained with 4,675 more Claude-annotated sentences: the remaining UD GSD training sentences, and 2,000 Wikipedia sentences picked for PRODUCT, EVENT, WORK_OF_ART, LAW and FAC. That makes 6,675 Claude-annotated sentences alongside the older NER datasets.
160 unmodified lines161162163164165166160 unmodified lines[components.id_rule_ner]factory = "id_rule_ner"overwrite = false[components.senter]160 unmodified lines161162163164165166167160 unmodified lines[components.id_rule_ner]factory = "id_rule_ner"conventions = "v0.2"overwrite = false[components.senter]
123version https://git-lfs.github.com/spec/v1oid sha256:7e1ee2e13c01cb6dd4ff226ff6d60d9cc458dcd20145df8940424358d0abbefbsize 14041935123version https://git-lfs.github.com/spec/v1oid sha256:76cbb5061e4394fd4de85c49c11d2a41231d747b704a352ce11208da8856f9f2size 14040864123version https://git-lfs.github.com/spec/v1oid sha256:7e1ee2e13c01cb6dd4ff226ff6d60d9cc458dcd20145df8940424358d0abbefbsize 14041935
7 unmodified lines89101112136 unmodified lines202122232425217 unmodified lines24324424524624724824925025110 unmodified lines26226326426526626726815 unmodified lines2842852862872882897 unmodified linesORDINAL > CARDINAL).Register with `--code scripts/id_rules.py` (or import this module)."""from __future__ import annotations6 unmodified linesfrom spacy.util import filter_spans# --- Lexicon ----------------------------------------------------------------UNITS_WORDS = ["nol", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan","sepuluh", "sebelas", "seratus", "seribu", "sejuta", "semiliar", "setengah", "separuh"]SCALE_WORDS = ["belas", "puluh", "ratus", "ribu", "juta", "miliar", "milyar", "triliun"]217 unmodified linesclass RuleNER:def __init__(self, nlp: Language, name: str = "id_rule_ner", overwrite: bool = False):self.name = nameself.overwrite = overwriteself.matcher = Matcher(nlp.vocab, validate=True)self.meta: dict[str, tuple[str, int, int]] = {}for i, (label, pat, tl, tr) in enumerate(_patterns()):10 unmodified linescands.append(Span(doc, s, e, label=label))# Longest first, then label priority; filter_spans keeps the first of overlapping spanscands.sort(key=lambda sp: (-(sp.end - sp.start), LABEL_PRIORITY.index(sp.label_), sp.start))return filter_spans(cands)def __call__(self, doc: Doc) -> Doc:found = self.find(doc)15 unmodified linesreturn doc@Language.factory("id_rule_ner", default_config={"overwrite": False})def make_rule_ner(nlp: Language, name: str, overwrite: bool):return RuleNER(nlp, name, overwrite)7 unmodified lines8910111213141516171819202122236 unmodified lines3031323334353637383940414243217 unmodified lines26126226326426526626726826927027127210 unmodified lines28328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032115 unmodified lines3373383393403413427 unmodified linesORDINAL > CARDINAL).Register with `--code scripts/id_rules.py` (or import this module).`conventions` (config, default "v0.1"): "v0.2" applies the span decisions ofguideline v0.2 (docs/03-ner-guideline.md) to rule spans:- D1: an approximator or bound before a number is inside the span(`sekitar Rp 9.000`, `lebih dari 20 persen`, `minus 1,2 persen`); not forDATE/TIME, where `hingga` means "until".- D14: `lalu` / `mendatang` / `silam` after a full date are inside the span,and two DATE spans joined by `hingga` / `sampai` / `-` / `–` become one range.- D15: a weekday followed by a time of day (`Selasa pagi`) is TIME."v0.1" keeps the behaviour of releases up to 0.6.0."""from __future__ import annotations6 unmodified linesfrom spacy.util import filter_spans# --- Lexicon ----------------------------------------------------------------APPROX_PREFIX = [["lebih", "dari"], ["kurang", "dari"], ["lebih", "kurang"], ["paling", "tidak"], ["di", "atas"],["di", "bawah"], ["tidak", "sampai"], ["belum", "sampai"], ["sekitar"], ["hampir"], ["setidaknya"],["sedikitnya"], ["minimal"], ["maksimal"], ["maksimum"], ["minimum"], ["kira-kira"], ["hingga"],["sampai"], ["minus"], ["plus"]]APPROX_LABELS = {"MONEY", "PERCENT", "QUANTITY", "CARDINAL"}DATE_TAIL = {"lalu", "mendatang", "silam"}RANGE_JOIN = {"hingga", "sampai", "-", "–", "s.d.", "s/d"}UNITS_WORDS = ["nol", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan","sepuluh", "sebelas", "seratus", "seribu", "sejuta", "semiliar", "setengah", "separuh"]SCALE_WORDS = ["belas", "puluh", "ratus", "ribu", "juta", "miliar", "milyar", "triliun"]217 unmodified linesclass RuleNER:def __init__(self, nlp: Language, name: str = "id_rule_ner", overwrite: bool = False, conventions: str = "v0.1"):if conventions not in ("v0.1", "v0.2"):raise ValueError(f"id_rule_ner: unknown conventions {conventions!r}")self.name = nameself.overwrite = overwriteself.conventions = conventionsself.matcher = Matcher(nlp.vocab, validate=True)self.meta: dict[str, tuple[str, int, int]] = {}for i, (label, pat, tl, tr) in enumerate(_patterns()):10 unmodified linescands.append(Span(doc, s, e, label=label))# Longest first, then label priority; filter_spans keeps the first of overlapping spanscands.sort(key=lambda sp: (-(sp.end - sp.start), LABEL_PRIORITY.index(sp.label_), sp.start))spans = filter_spans(cands)if self.conventions == "v0.2":spans = self._v02(doc, spans)return spansdef _v02(self, doc: Doc, spans: list[Span]) -> list[Span]:"""Guideline v0.2 span decisions D1, D14 and D15 (see the module docstring)."""spans = sorted(spans, key=lambda sp: sp.start)taken_end = 0out = []for sp in spans:start, end, label = sp.start, sp.end, sp.label_if label in APPROX_LABELS: # D1: approximator before the numberfor pre in sorted(APPROX_PREFIX, key=len, reverse=True):k = len(pre)if start - k >= taken_end and [t.lower_ for t in doc[start - k:start]] == pre:start -= kbreakif label == "DATE" and end < len(doc) and doc[end].lower_ in DATE_TAIL: # D14: "... 2007 lalu"end += 1if label == "DATE" and doc[start].lower_ in DAYS and end - start == 2 \and doc[start + 1].lower_ in TIME_OF_DAY: # D15: "Selasa pagi"label = "TIME"out.append(Span(doc, start, end, label=label))taken_end = endmerged = [] # D14: "4 Desember hingga 11 Januari 2010"for sp in out:if merged and sp.label_ == merged[-1].label_ == "DATE" and sp.start == merged[-1].end + 1 \and doc[merged[-1].end].lower_ in RANGE_JOIN:merged[-1] = Span(doc, merged[-1].start, sp.end, label="DATE")else:merged.append(sp)return filter_spans(merged)def __call__(self, doc: Doc) -> Doc:found = self.find(doc)15 unmodified linesreturn doc@Language.factory("id_rule_ner", default_config={"overwrite": False, "conventions": "v0.1"})def make_rule_ner(nlp: Language, name: str, overwrite: bool, conventions: str):return RuleNER(nlp, name, overwrite, conventions)
1234567{"lang": "id","name": "core_news_sm","version": "0.6.0","spacy_version": ">=3.8.18,<3.9.0","description": "Indonesian pipeline modelled on en_core_web_sm: UD-style tokenizer, morphologizer, lemmatizer, parser, senter (disabled), ner and rule-based entities (labels: CARDINAL, DATE, EVENT, FAC, GPE, LANGUAGE, LAW, LOC, MONEY, NORP, ORDINAL, ORG, PERCENT, PERSON, PRODUCT, QUANTITY, TIME, WORK_OF_ART).","author": "",1234567{"lang": "id","name": "core_news_sm","version": "0.6.1","spacy_version": ">=3.8.18,<3.9.0","description": "Indonesian pipeline modelled on en_core_web_sm: UD-style tokenizer, morphologizer, lemmatizer, parser, senter (disabled), ner and rule-based entities (labels: CARDINAL, DATE, EVENT, FAC, GPE, LANGUAGE, LAW, LOC, MONEY, NORP, ORDINAL, ORG, PERCENT, PERSON, PRODUCT, QUANTITY, TIME, WORK_OF_ART).","author": "",
.gitattributes+1
README.md+101-23
config.cfg+1
id_core_news_sm-0.6.1-py3-none-any.whlAdded+3
id_core_news_sm-any-py3-none-any.whl+2-2
id_rules.py+58-5
meta.json+1-1