CoolFace
Modelpublic

hyperquest/atom-classifier

sourceHugging Faceapache-2.0updated 5mo agoView on Hugging Face
0likes45downloads
Model Card

Atom Classifier

A multilingual token classifier for semantic hypergraph parsing. It classifies each token in a sentence into one of 39 semantic atom types/subtypes, serving as the first stage (alpha) of the Alpha-Beta semantic hypergraph parser.

Model Details

  • Architecture: DistilBertForTokenClassification
  • Base model: distilbert-base-multilingual-cased
  • Labels: 39 semantic atom types
  • Max sequence length: 512

Label Taxonomy

Atoms are typed according to the Semantic Hyperedge (SH) notation system. The 7 main types and their subtypes:

Concepts (C)

LabelDescription
CGeneric concept
CcCommon noun
CpProper noun
CaAdjective (as concept)
CiPronoun
CdDeterminer (as concept)
CmNominal modifier
CwInterrogative word
C#Number

Predicates (P)

LabelDescription
PGeneric predicate
PdDeclarative predicate
P!Imperative predicate

Modifiers (M)

LabelDescription
MGeneric modifier
MaAdjective modifier
McConceptual modifier
MdDeterminer modifier
MeAdverbial modifier
MiInfinitive particle
MjConjunctional modifier
MlParticle
MmModal (auxiliary verb)
MnNegation
MpPossessive modifier
MsSuperlative modifier
MtPrepositional modifier
MvVerbal modifier
MwSpecifier
M#Number modifier
M=Comparative modifier
M^Degree modifier

Builders (B)

LabelDescription
BGeneric builder
BpPossessive builder
BrRelational builder (preposition)

Triggers (T)

LabelDescription
TGeneric trigger
TtTemporal trigger
TvVerbal trigger

Conjunctions (J)

LabelDescription
JGeneric conjunction
JrRelational conjunction

Special

LabelDescription
XExcluded token (punctuation, etc.)

Usage

python
from transformers import AutoTokenizer, AutoModelForTokenClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("hyperquest/atom-classifier")
model = AutoModelForTokenClassification.from_pretrained("hyperquest/atom-classifier")

sentence = "Berlin is the capital of Germany."
encoded = tokenizer(sentence, return_tensors="pt", return_offsets_mapping=True)
offset_mapping = encoded.pop("offset_mapping")

with torch.no_grad():
    outputs = model(**encoded)

predictions = outputs.logits.argmax(-1)[0].tolist()
word_ids = encoded.word_ids(0)

for idx, word_id in enumerate(word_ids):
    if word_id is not None:
        start, end = offset_mapping[0][idx].tolist()
        label = model.config.id2label[predictions[idx]]
        print(f"{sentence[start:end]:15s} -> {label}")

Intended Use

This model is designed to be used as the first stage of the Alpha-Beta semantic hypergraph parser (hyperbase-parser-ab). It assigns atom types to tokens, which are then combined into nested hypergraph structures by rule-based grammar in the beta stage.

Part of