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.4.1
Browse filesFiles changed (7)
41 unmodified lines42434441 unmodified linesid_core_news_sm-0.2.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.3.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.4.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text41 unmodified lines4243444541 unmodified linesid_core_news_sm-0.2.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.3.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.4.0-py3-none-any.whl filter=lfs diff=lfs merge=lfs -textid_core_news_sm-0.4.1-py3-none-any.whl filter=lfs diff=lfs merge=lfs -text
51 unmodified lines5253545556575859606156 unmodified lines11811912012112212312412512612756 unmodified lines184185186187188189190191192193185 unmodified lines37938038138238338438538638738838939039139239322 unmodified lines4164174184194204214226 unmodified lines42943043143243343443543643743843940 unmodified lines48048148248348448551 unmodified linesname: UD Indonesian-GSD r2.19 (test)metrics:- type: accuracyvalue: 0.8012name: Lemma accuracy- type: accuracyvalue: 0.9764name: Lemma accuracy (case-insensitive)- task:type: token-classification56 unmodified linesname: UD Indonesian-CSUI r2.19 (test)metrics:- type: accuracyvalue: 0.9245name: Lemma accuracy- type: accuracyvalue: 0.9673name: Lemma accuracy (case-insensitive)- task:type: token-classification56 unmodified linesname: UD Indonesian-PUD r2.19 (test)metrics:- type: accuracyvalue: 0.9008name: Lemma accuracy- type: accuracyvalue: 0.9174name: Lemma accuracy (case-insensitive)- task:type: token-classification185 unmodified lines| | ||---|---|| Version | 0.4.0 (replaces 0.3.0) || spaCy | ≥ 3.8, < 3.9 || Size | 13.7 MB wheel || Speed | ~17k words/s on an Apple M3 Pro CPU |## Install and use```bashpip install https://huggingface.co/firqaaa/id_core_news_sm/resolve/main/id_core_news_sm-0.4.0-py3-none-any.whl```Earlier wheels are still in this repo: `id_core_news_sm-0.3.0-py3-none-any.whl` and `id_core_news_sm-0.2.0-py3-none-any.whl`.22 unmodified lines| 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. 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. |6 unmodified lines| Test set | Token F | UPOS | Feats | Lemma | Lemma (case-insensitive) | UAS | LAS | Sentence F ||---|---:|---:|---:|---:|---:|---:|---:|---:|| GSD | 99.64 | 93.30 | 94.32 | 80.12 | 97.64 | 84.27 | 75.40 | 88.42 || CSUI | 98.99 | 94.55 | 94.59 | 92.45 | 96.73 | 78.85 | 68.89 | 85.44 || PUD | 99.43 | 93.16 | 91.23 | 90.08 | 91.74 | 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. 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.40 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.4.0- Lemma casing follows one convention (UD/spaCy style): proper nouns keep their case, everything else is lowercase. The training lemmas were rewritten to it, because GSD and CSUI disagree.51 unmodified lines5253545556575859606156 unmodified lines11811912012112212312412512612756 unmodified lines184185186187188189190191192193185 unmodified lines37938038138238338438538638738838939039139239322 unmodified lines4164174184194204214226 unmodified lines42943043143243343443543643743843940 unmodified lines48048148248348448548648748848949051 unmodified linesname: UD Indonesian-GSD r2.19 (test)metrics:- type: accuracyvalue: 0.8040name: Lemma accuracy- type: accuracyvalue: 0.9792name: Lemma accuracy (case-insensitive)- task:type: token-classification56 unmodified linesname: UD Indonesian-CSUI r2.19 (test)metrics:- type: accuracyvalue: 0.9256name: Lemma accuracy- type: accuracyvalue: 0.9683name: Lemma accuracy (case-insensitive)- task:type: token-classification56 unmodified linesname: UD Indonesian-PUD r2.19 (test)metrics:- type: accuracyvalue: 0.9043name: Lemma accuracy- type: accuracyvalue: 0.9209name: Lemma accuracy (case-insensitive)- task:type: token-classification185 unmodified lines| | ||---|---|| Version | 0.4.1 (replaces 0.4.0) || spaCy | ≥ 3.8, < 3.9 || Size | 14.0 MB wheel || Speed | ~17k words/s on an Apple M3 Pro CPU |## Install and use```bashpip install https://huggingface.co/firqaaa/id_core_news_sm/resolve/main/id_core_news_sm-0.4.1-py3-none-any.whl```Earlier wheels are still in this repo: `id_core_news_sm-0.3.0-py3-none-any.whl` and `id_core_news_sm-0.2.0-py3-none-any.whl`.22 unmodified lines| 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. || `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. |6 unmodified lines| 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.40 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.4.1- `id_lemma_fallback` now also lemmatizes full reduplications seen in training (`toko-toko` → `toko`, `hak-hak` → `hak`), which the trained lemmatizer often left whole. Forms that training lemmatizes whole more often than as the half are kept.- Case-insensitive lemma accuracy +0.28 (GSD), +0.09 (CSUI) and +0.34 (PUD), the same on each of 3 seeds. All other scores, including NER, are identical to 0.4.0.## Changes in 0.4.0- Lemma casing follows one convention (UD/spaCy style): proper nouns keep their case, everything else is lowercase. The training lemmas were rewritten to it, because GSD and CSUI disagree.
123version https://git-lfs.github.com/spec/v1oid sha256:2f2a047eacf5a79ec6aff3f4957d511bb8b56f2ea0d36b259f30662834b075e1size 14019468123version https://git-lfs.github.com/spec/v1oid sha256:4b88df81520422dc625e458090aa18605eefa83ddf2812f0a685a53b2e166422size 13958346123version https://git-lfs.github.com/spec/v1oid sha256:2f2a047eacf5a79ec6aff3f4957d511bb8b56f2ea0d36b259f30662834b075e1size 14019468
8 unmodified lines910111213141516173 unmodified lines21222324252627282930313285 unmodified lines1181191201211221231241251261271281291301311321331341352 unmodified lines13813914014114214314413 unmodified lines1581591601611621631641651661678 unmodified lines1. PROPN: lemma = the word as written (no stripping).2. The word is in spaCy's Indonesian lemma lookup table (spacy-lookups-data,MIT): use that lemma.3. Full reduplication `X-X`: the lemma of `X`, by these same steps. A fewlexicalised forms (`masing-masing`) that keep the whole form in trainingare left alone.4. VERB only: affix stripping (prefixes meN-/peN- with nasal assimilation,ber-, ter-, di-, ke-, se-, per-; suffixes -kan, -an, -i; particles-lah/-kah/-pun; confixes such as ke-...-an), accepted only if the stripped3 unmodified linesadjectives (6 vs 17), where UD often keeps derived forms (keterampilan).5. Otherwise the trained lemmatizer's prediction stays.Casing (UD/spaCy convention, applied to every token): PROPN lemmas keep theform's case when the lemma is the form; SYM and X lemmas are left as they are;all other lemmas are lowercased. Note that UD Indonesian-GSD lowercases alllemmas, while CSUI keeps the form's case (docs/09-lemmatizer.md).Data (seen forms, roots, lookup table, reduplication exceptions) is built byscripts/build_lemma_data.py and saved with the pipeline."""85 unmodified linesself.seen: set[str] = set()self.lookup: dict[str, str] = {}self.redup_keep: set[str] = set()self.stripper = AffixStripper(set())self.counts = {"propn": 0, "lookup": 0, "redup": 0, "stripped": 0}def _base_lemma(self, w: str) -> str | None:if w in self.lookup:return self.lookup[w]return self.stripper.stem(w)def __call__(self, doc: Doc) -> Doc:for t in doc:low = t.text.lower()if t.pos_ not in ("PUNCT", "SYM", "NUM", "X") and low not in self.seen and t.text.strip():if t.pos_ == "PROPN":t.lemma_ = t.textself.counts["propn"] += 12 unmodified linesself.counts["lookup"] += 1elif "-" in low and low.count("-") == 1 and low.split("-")[0] == low.split("-")[1] and low not in self.redup_keep:half = low.split("-")[0]t.lemma_ = self._base_lemma(half) or halfself.counts["redup"] += 1elif t.pos_ == "VERB":s = self.stripper.stem(low)13 unmodified linesself.seen = set(data["seen"])self.lookup = dict(data["lookup"])self.redup_keep = set(data["redup_keep"])self.stripper = AffixStripper(set(data["roots"]))def get_data(self) -> dict:return {"seen": sorted(self.seen), "lookup": self.lookup, "redup_keep": sorted(self.redup_keep),"roots": sorted(self.stripper.roots)}def initialize(self, get_examples=None, *, nlp=None, data_path: str | None = None):8 unmodified lines910111213141516173 unmodified lines2122232425262728293031323334353637383940414285 unmodified lines1281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591602 unmodified lines16316416516616716816913 unmodified lines1831841851861871881891901911921931941958 unmodified lines1. PROPN: lemma = the word as written (no stripping).2. The word is in spaCy's Indonesian lemma lookup table (spacy-lookups-data,MIT): use that lemma.3. Full reduplication `X-X`: the lemma of `X`, by these same steps. Formsthat training lemmatizes as the whole form more often than as the half(lexicalised) are left alone.4. VERB only: affix stripping (prefixes meN-/peN- with nasal assimilation,ber-, ter-, di-, ke-, se-, per-; suffixes -kan, -an, -i; particles-lah/-kah/-pun; confixes such as ke-...-an), accepted only if the stripped3 unmodified linesadjectives (6 vs 17), where UD often keeps derived forms (keterampilan).5. Otherwise the trained lemmatizer's prediction stays.Reduplication of seen words (only when the data has `train_lemma`, which0.4.0's data lacks): a full reduplication `X-X` that does occur in UDtraining, but is not lexicalised there, also gets the lemma of `X`. The trained lemmatizer often leaves such words whole(toko-toko, hak-hak), while UD training gives the half in most cases.The lemma of `X` (here and in step 3 when `train_lemma` is present) is X'smost frequent UD training lemma, else the lookup table's, else X itself;no affix stripping (it turned laki-laki into lak on GSD dev). PROPN tokensare left alone.Casing (UD/spaCy convention, applied to every token): PROPN lemmas keep theform's case when the lemma is the form; SYM and X lemmas are left as they are;all other lemmas are lowercased. Note that UD Indonesian-GSD lowercases alllemmas, while CSUI keeps the form's case (docs/09-lemmatizer.md).Data (seen forms, roots, lookup table, reduplication exceptions, traininglemmas of non-hyphenated forms) is built byscripts/build_lemma_data.py and saved with the pipeline."""85 unmodified linesself.seen: set[str] = set()self.lookup: dict[str, str] = {}self.redup_keep: set[str] = set()self.train_lemma: dict[str, str] = {}self.redup_seen = Falseself.stripper = AffixStripper(set())self.counts = {"propn": 0, "lookup": 0, "redup": 0, "stripped": 0, "redup_seen": 0}def _base_lemma(self, w: str) -> str | None:if w in self.lookup:return self.lookup[w]return self.stripper.stem(w)def _is_redup(self, low: str) -> bool:a = low.split("-")return len(a) == 2 and a[0] == a[1] and a[0].isalpha() and low not in self.redup_keepdef _half_lemma(self, half: str) -> str:if half in self.train_lemma:return self.train_lemma[half]return self.lookup.get(half, half)def __call__(self, doc: Doc) -> Doc:for t in doc:low = t.text.lower()if (self.redup_seen and low in self.seen and t.pos_ not in ("PROPN", "PUNCT", "SYM", "NUM", "X")and self._is_redup(low)):t.lemma_ = self._half_lemma(low.split("-")[0])self.counts["redup_seen"] += 1elif t.pos_ not in ("PUNCT", "SYM", "NUM", "X") and low not in self.seen and t.text.strip():if t.pos_ == "PROPN":t.lemma_ = t.textself.counts["propn"] += 12 unmodified linesself.counts["lookup"] += 1elif "-" in low and low.count("-") == 1 and low.split("-")[0] == low.split("-")[1] and low not in self.redup_keep:half = low.split("-")[0]t.lemma_ = self._half_lemma(half) if self.redup_seen else (self._base_lemma(half) or half)self.counts["redup"] += 1elif t.pos_ == "VERB":s = self.stripper.stem(low)13 unmodified linesself.seen = set(data["seen"])self.lookup = dict(data["lookup"])self.redup_keep = set(data["redup_keep"])self.train_lemma = dict(data.get("train_lemma", {}))self.redup_seen = "train_lemma" in dataself.stripper = AffixStripper(set(data["roots"]))def get_data(self) -> dict:return {"seen": sorted(self.seen), "lookup": self.lookup, "redup_keep": sorted(self.redup_keep),**({"train_lemma": self.train_lemma} if self.redup_seen else {}),"roots": sorted(self.stripper.roots)}def initialize(self, get_examples=None, *, nlp=None, data_path: str | None = None):
1234567193 unmodified lines201202203204205206207{"lang": "id","name": "core_news_sm","version": "0.4.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": "",193 unmodified lines"morph_micro_p": 0.9739130435,"morph_micro_r": 0.9444546288,"morph_micro_f": 0.9589576547,"lemma_acc": 0.8011571514,"sents_p": 0.8710801394,"sents_r": 0.8976660682,"sents_f": 0.884173298,1234567193 unmodified lines201202203204205206207{"lang": "id","name": "core_news_sm","version": "0.4.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": "",193 unmodified lines"morph_micro_p": 0.9739130435,"morph_micro_r": 0.9444546288,"morph_micro_f": 0.9589576547,"lemma_acc": 0.8039649451,"sents_p": 0.8710801394,"sents_r": 0.8976660682,"sents_f": 0.884173298,
.gitattributes+1
README.md+19-14
id_core_news_sm-0.4.1-py3-none-any.whlAdded+3
id_core_news_sm-any-py3-none-any.whl+2-2
id_lemma.py+35-7
id_lemma_fallback/lemma_data.json
meta.json+2-2