legal-ner / README.md
gradientflow's picture
add dataset card
411df81 verified
---
language:
- sr
license: cc-by-4.0
task_categories:
- token-classification
tags:
- ner
- legal
- conllu
dataset_info:
features:
- name: id
dtype: string
- name: doc_id
dtype: string
- name: tokens
sequence: string
- name: ner_tags
sequence:
class_label:
names:
0: B-ADR
1: B-COM
2: B-CONTACT
3: B-COURT
4: B-DATE
5: B-IDCOM
6: B-IDOTH
7: B-IDPER
8: B-IDTAX
9: B-INST
10: B-LAW
11: B-MISC
12: B-MONEY
13: B-NUMACC
14: B-NUMCAR
15: B-NUMDOC
16: B-NUMPLOT
17: B-ORGOTH
18: B-PER
19: B-REF
20: B-TOP
21: I-ADR
22: I-COM
23: I-COURT
24: I-DATE
25: I-INST
26: I-LAW
27: I-MISC
28: I-MONEY
29: I-NUMCAR
30: I-ORGOTH
31: I-PER
32: I-REF
33: I-TOP
34: O
---
# Dataset Card for Legal NER dataset
## Dataset Description
This dataset is based on **COMtext.SR.legal**, the first corpus of legal-administrative texts in Serbian that has been manually annotated for **Named Entities (NER)** according to the IOB2 standard.
The corpus was created during 2023. The selection of representative legal texts of various types (contracts, judgments, conclusions, decisions, requests, appeals, rulebooks, laws, decrees, statutes, etc.) was conducted with the assistance of the lawyers.
The corpus includes **79 documents**, comprising **4,762 sentences** or **105,470 tokens**.
## NER Statistics
Out of a total of 105,470 tokens, **14,113 (13.4%)** belong to named entities.
Systematization and frequency of entity types:
| Category | Subcategory | Tag | Count / Percentage | Avg. Length in Tokens |
| :--- | :--- | :--- | :--- | :--- |
| **Persons** | | **PER** | 694 (19.2%) | 1.89 |
| **Locations** | Toponyms | **TOP** | 294 (8.1%) | 1.24 |
| | Addresses | **ADR** | 203 (5.6%) | 6.96 |
| **Organizations** | Courts | **COURT** | 148 (4.1%) | 3.59 |
| | Institutions | **INST** | 395 (10.9%) | 2.75 |
| | Companies | **COM** | 337 (9.3%) | 2.28 |
| | Other Organizations | **ORGOTH** | 97 (2.7%) | 2.27 |
| **Legal Docs** | General Legal Acts | **LAW** | 395 (10.9%) | 9.17 |
| | Individual Legal Acts | **REF** | 227 (6.3%) | 10.52 |
| **Sensitive Data** | Personal ID (JMBG) | **IDPER** | 21 (0.6%) | 1.0 |
| | Company Reg. No. | **IDCOM** | 33 (0.9%) | 1.0 |
| | Tax ID (PIB) | **IDTAX** | 16 (0.4%) | 1.0 |
| | Bank Account No. | **NUMACC** | 6 (0.2%) | 1.0 |
| | ID Card/Passport No. | **NUMDOC** | 9 (0.2%) | 1.0 |
| | Car Plate/Chassis | **NUMCAR** | 6 (0.2%) | 2.67 |
| | Cadastral Plot No. | **NUMPLOT** | 67 (1.9%) | 1.0 |
| | Other IDs | **IDOTH** | 18 (0.5%) | 1.0 |
| | Contact (Email, Phone) | **CONTACT** | 8 (0.2%) | 1.0 |
| **Time/Money** | Dates | **DATE** | 352 (9.7%) | 4.1 |
| | Monetary Amounts | **MONEY** | 246 (6.8%) | 2.32 |
| **Other** | | **MISC** | 39 (1.1%) | 5.0 |
## Structure & Usage
The data has been converted from CoNLL-U format to Hugging Face columnar format.
### Train/Test Split
The split into training and testing sets was performed using the **GroupShuffleSplit** strategy on the `doc_id` attribute. This guarantees that sentences from the same document do not appear simultaneously in both sets, preventing data leakage and ensuring realistic model evaluation.
### Usage Example
```python
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("gradientflow/legal-ner")
# Display the first example from the train set
print(dataset['train'][0])
# Display all available tags
print(dataset['train'].features['ner_tags'].feature.names)
```
## Source Data
The original annotated corpus is available on GitHub:
* [COMtext.SR](https://github.com/ICEF-NLP/COMtext.SR/tree/main/data)