You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

STUSSU

Extracting key entities from text.

Install

pip install gliner

Usage:

from gliner import GLiNER
from IPython.display import display, HTML


model = GLiNER.from_pretrained("beyoru/STUSSU")

text = """
Báo cáo đề xuất điều chỉnh đãi ngộ – Nhân viên anh Nguyễn Duy Cương

Dựa trên phân tích tổng thể, nhân viên anh Nguyễn Duy Cương hiện đang có mức lương khoảng 22–23 M VND, trong khi mức lương thị trường cho vị trí Senior Backend Engineer với thâm niên tương đương dao động quanh 27–28 triệu VND.

Khoảng cách hiện tại giữa lương nhân viên và thị trường vào khoảng 4–6 M, tương đương 15–20% thấp hơn mặt bằng chung. Với hiệu suất vượt mong đợi trong hai kỳ liên tiếp và có giải thưởng Tech Excellence Award Q3, mức chênh lệch này là chưa hợp lý.

Do đó, đề xuất tăng lương khoảng 3–4 M (~15%), đưa mức lương mới lên xấp xỉ 25–26 M.
"""

labels = ["person", "salary", "position", "award", "date"]

# ----------------------------
# Merge broken entities
# ----------------------------
def merge_entities(entities):
    entities = sorted(entities, key=lambda x: x["start"])
    merged = []

    for ent in entities:
        if not merged:
            merged.append(ent)
            continue

        last = merged[-1]

        if ent["label"] == last["label"] and ent["start"] <= last["end"] + 1:
            last["text"] += ent["text"]
            last["end"] = ent["end"]
        else:
            merged.append(ent)

    return merged



def highlight_html(text, entities):
    entities = sorted(entities, key=lambda x: x["start"], reverse=True)

    for e in entities:
        text = (
            text[:e["start"]]
            + f"<mark class='{e['label']}'>{text[e['start']:e['end']]}</mark>"
            + text[e["end"]:]
        )

    return text



entities = model.predict_entities(text, labels)
entities = merge_entities(entities)


html = f"""
<style>
mark.person   {{ background:#7dd3fc; padding:2px }}
mark.salary   {{ background:#86efac; padding:2px }}
mark.position {{ background:#fde047; padding:2px }}
mark.award    {{ background:#f0abfc; padding:2px }}
mark.date     {{ background:#c7d2fe; padding:2px }}
</style>

<div style="font-size:16px; line-height:1.6">
{highlight_html(text, entities).replace("\n", "<br>")}
</div>
"""

display(HTML(html))
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support