Span Annotation
Named entity recognition और अन्य कार्यों के लिए text span हाइलाइट और लेबल करें।
Span Annotation
Span annotation एनोटेटर्स को टेक्स्ट के हिस्सों को चुनने और लेबल करने की अनुमति देता है, जो आमतौर पर named entity recognition (NER), part-of-speech tagging, और text highlighting कार्यों के लिए उपयोग किया जाता है।
बुनियादी कॉन्फ़िगरेशन
annotation_schemes:
- annotation_type: span
name: entities
description: "Highlight named entities in the text"
labels:
- PERSON
- ORGANIZATION
- LOCATIONकॉन्फ़िगरेशन विकल्प
Entity लेबल
एनोटेटर्स जो span प्रकार बना सकते हैं उन्हें परिभाषित करें:
labels:
- PERSON
- ORGANIZATION
- LOCATION
- DATE
- EVENTलेबल रंग
दृश्य अंतर के लिए रंग कस्टमाइज़ करें:
label_colors:
PERSON: "#3b82f6"
ORGANIZATION: "#10b981"
LOCATION: "#f59e0b"
DATE: "#8b5cf6"
EVENT: "#ec4899"रंग hex (#ff0000) या RGB (rgb(255, 0, 0)) हो सकते हैं।
कीबोर्ड शॉर्टकट
कीबोर्ड बाइंडिंग के साथ एनोटेशन तेज़ करें:
keyboard_shortcuts:
PERSON: "1"
ORGANIZATION: "2"
LOCATION: "3"
DATE: "4"Tooltip
प्रत्येक लेबल के लिए मार्गदर्शन प्रदान करें:
tooltips:
PERSON: "Names of people, characters, or personas"
ORGANIZATION: "Companies, agencies, institutions"
LOCATION: "Physical locations, addresses, geographic regions"ओवरलैपिंग Span
ओवरलैपिंग की अनुमति दें
ओवरलैप करने वाले span सक्षम करें:
- annotation_type: span
name: entities
labels:
- PERSON
- ROLE
allow_overlapping: trueयह उपयोगी है जब एक ही टेक्स्ट के कई लेबल हो सकते हैं (जैसे, "Dr. Smith" PERSON और ROLE दोनों है)।
ओवरलैपिंग अक्षम करें (डिफ़ॉल्ट)
- annotation_type: span
name: entities
labels:
- PERSON
- ORGANIZATION
allow_overlapping: false # Default behaviorSpan चयन मोड
शब्द-स्तरीय चयन
केवल पूर्ण शब्द चुनें:
- annotation_type: span
name: entities
selection_mode: word
labels:
- ENTITYवर्ण-स्तरीय चयन
आंशिक शब्दों के चयन की अनुमति दें:
- annotation_type: span
name: entities
selection_mode: character
labels:
- ENTITYपूर्व-एनोटेट Span
समीक्षा या सुधार के लिए मौजूदा एनोटेशन लोड करें:
{
"id": "doc1",
"text": "John Smith works at Microsoft in Seattle.",
"spans": [
{"start": 0, "end": 10, "label": "PERSON"},
{"start": 20, "end": 29, "label": "ORGANIZATION"},
{"start": 33, "end": 40, "label": "LOCATION"}
]
}पूर्व-एनोटेशन लोड करने के लिए कॉन्फ़िगर करें:
- annotation_type: span
name: entities
load_pre_annotations: true
pre_annotation_field: spansसामान्य NER कॉन्फ़िगरेशन
मानक NER (4 प्रकार)
- annotation_type: span
name: ner
description: "Label named entities"
labels:
- PER # Person
- ORG # Organization
- LOC # Location
- MISC # Miscellaneous
label_colors:
PER: "#3b82f6"
ORG: "#10b981"
LOC: "#f59e0b"
MISC: "#6b7280"
keyboard_shortcuts:
PER: "1"
ORG: "2"
LOC: "3"
MISC: "4"विस्तारित NER (OntoNotes शैली)
- annotation_type: span
name: ner_extended
labels:
- PERSON
- NORP # Nationalities, religious/political groups
- FAC # Facilities
- ORG
- GPE # Geopolitical entities
- LOC
- PRODUCT
- EVENT
- WORK_OF_ART
- LAW
- LANGUAGE
- DATE
- TIME
- PERCENT
- MONEY
- QUANTITY
- ORDINAL
- CARDINALजैव चिकित्सा NER
- annotation_type: span
name: bio_ner
labels:
- GENE
- PROTEIN
- DISEASE
- DRUG
- SPECIES
label_colors:
GENE: "#22c55e"
PROTEIN: "#3b82f6"
DISEASE: "#ef4444"
DRUG: "#f59e0b"
SPECIES: "#8b5cf6"सोशल मीडिया NER
- annotation_type: span
name: social_ner
labels:
- PERSON
- ORGANIZATION
- LOCATION
- PRODUCT
- CREATIVE_WORK
- GROUPगुण के साथ Span
समृद्ध एनोटेशन के लिए span में गुण जोड़ें:
annotation_schemes:
- annotation_type: span
name: entities
labels:
- PERSON
- ORGANIZATION
- annotation_type: radio
name: entity_type
description: "What type of entity is this?"
show_for_span: entities
labels:
- Named
- Nominal
- Pronominalएकाधिक Span स्कीमा
अलग-अलग पहलुओं को अलग-अलग एनोटेट करें:
annotation_schemes:
# Named entities
- annotation_type: span
name: entities
description: "Label named entities"
labels:
- PERSON
- ORGANIZATION
- LOCATION
# Sentiment expressions
- annotation_type: span
name: sentiment_spans
description: "Highlight sentiment expressions"
labels:
- POSITIVE
- NEGATIVE
label_colors:
POSITIVE: "#22c55e"
NEGATIVE: "#ef4444"Multi-Field Span Annotation
v2.1.0 में नया
Span annotation target_field विकल्प का उपयोग करके multi-field डेटा में विशिष्ट टेक्स्ट फ़ील्ड को लक्षित कर सकता है। यह उपयोगी है जब आपके डेटा में कई टेक्स्ट फ़ील्ड हों और आप किसी विशेष एक में span एनोटेट करना चाहते हों।
कॉन्फ़िगरेशन
annotation_schemes:
- annotation_type: span
name: source_entities
description: "Label entities in the source text"
target_field: "source_text"
labels:
- PERSON
- ORGANIZATION
- annotation_type: span
name: summary_entities
description: "Label entities in the summary"
target_field: "summary"
labels:
- PERSON
- ORGANIZATIONMulti-Field डेटा फॉर्मेट
आपके डेटा में अलग-अलग टेक्स्ट फ़ील्ड शामिल होने चाहिए:
{
"id": "doc1",
"source_text": "John Smith works at Microsoft in Seattle.",
"summary": "Smith is employed by Microsoft."
}आउटपुट फॉर्मेट
target_field का उपयोग करते समय, एनोटेशन फ़ील्ड के अनुसार कुंजीबद्ध होते हैं:
{
"id": "doc1",
"source_entities": {
"source_text": [
{"start": 0, "end": 10, "text": "John Smith", "label": "PERSON"},
{"start": 20, "end": 29, "text": "Microsoft", "label": "ORGANIZATION"}
]
},
"summary_entities": {
"summary": [
{"start": 0, "end": 5, "text": "Smith", "label": "PERSON"},
{"start": 22, "end": 31, "text": "Microsoft", "label": "ORGANIZATION"}
]
}
}एक पूर्ण कार्यशील उदाहरण के लिए, Potato रिपॉजिटरी में project-hub/simple_examples/simple-multi-span/ देखें।
प्रदर्शन विकल्प
Span में लेबल दिखाएँ
हाइलाइट किए गए span के भीतर लेबल टेक्स्ट प्रदर्शित करें:
- annotation_type: span
name: entities
show_label_in_span: trueरेखांकन शैली
पृष्ठभूमि हाइलाइटिंग के बजाय रेखांकन का उपयोग करें:
- annotation_type: span
name: entities
display_style: underlineआउटपुट फॉर्मेट
Span एनोटेशन character offset के साथ सहेजे जाते हैं:
{
"id": "doc1",
"entities": [
{
"start": 0,
"end": 10,
"text": "John Smith",
"label": "PERSON"
},
{
"start": 20,
"end": 29,
"text": "Microsoft",
"label": "ORGANIZATION"
}
]
}पूर्ण उदाहरण: NER कार्य
task_name: "Named Entity Recognition"
data_files:
- path: data/documents.json
text_field: text
annotation_schemes:
- annotation_type: span
name: entities
description: "Highlight and label all named entities"
labels:
- PERSON
- ORGANIZATION
- LOCATION
- DATE
- MONEY
label_colors:
PERSON: "#3b82f6"
ORGANIZATION: "#10b981"
LOCATION: "#f59e0b"
DATE: "#8b5cf6"
MONEY: "#ec4899"
keyboard_shortcuts:
PERSON: "1"
ORGANIZATION: "2"
LOCATION: "3"
DATE: "4"
MONEY: "5"
tooltips:
PERSON: "Names of people"
ORGANIZATION: "Companies, agencies, institutions"
LOCATION: "Cities, countries, addresses"
DATE: "Dates and time expressions"
MONEY: "Monetary values"
allow_overlapping: false
selection_mode: word
- annotation_type: radio
name: difficulty
description: "How difficult was this document to annotate?"
labels:
- Easy
- Medium
- Hardअसंतत Span
v2.2.0 में नया
allow_discontinuous पैरामीटर के साथ गैर-सन्निहित टेक्स्ट span सक्षम करें। यह एनोटेटर्स को एकल span एनोटेशन के रूप में कई गैर-आसन्न टेक्स्ट सेगमेंट चुनने की अनुमति देता है, जो असंतत entity या विभाजित अभिव्यक्तियों के लिए उपयोगी है।
- annotation_type: span
name: entities
labels:
- PERSON
- ORGANIZATION
allow_discontinuous: trueसक्षम होने पर, एनोटेटर वर्तमान span में अतिरिक्त टेक्स्ट सेगमेंट जोड़ने के लिए modifier key दबाकर अतिरिक्त टेक्स्ट सेगमेंट चुन सकते हैं। आउटपुट में प्रत्येक सेगमेंट के लिए कई start/end जोड़े शामिल होते हैं।
Entity Linking एकीकरण
v2.2.0 में नया
Span एनोटेशन को span स्कीमा में entity_linking कॉन्फ़िगरेशन ब्लॉक जोड़कर बाहरी knowledge base (Wikidata, UMLS, या कस्टम REST API) से जोड़ा जा सकता है:
- annotation_type: span
name: entities
labels:
- PERSON
- ORGANIZATION
- LOCATION
entity_linking:
enabled: true
knowledge_bases:
- name: wikidata
type: wikidata
language: enजब entity linking सक्षम होती है, तो प्रत्येक span के control bar पर एक लिंक आइकन दिखाई देता है। इसे क्लिक करने से मिलान करने वाली KB entity खोजने और लिंक करने के लिए एक search modal खुलता है। पूर्ण विवरण के लिए Entity Linking दस्तावेज़ीकरण देखें।
सर्वोत्तम प्रथाएँ
- आसान दृश्य अंतर के लिए विशिष्ट रंग का उपयोग करें
- प्रत्येक entity प्रकार के लिए उदाहरण के साथ स्पष्ट tooltip प्रदान करें
- तेज़ एनोटेशन के लिए कीबोर्ड शॉर्टकट सक्षम करें
- जब तक character सटीकता की आवश्यकता न हो, word-level selection का उपयोग करें
- तेज़ सुधार कार्यप्रवाह के लिए पूर्व-एनोटेशन पर विचार करें
- अपने एनोटेशन दिशानिर्देशों के आधार पर ओवरलैपिंग सेटिंग्स का परीक्षण करें
अधिक पढ़ें
- Entity Linking - Span को knowledge base से जोड़ें
- Coreference Chains - सह-संदर्भित उल्लेखों को समूहित करें
- Event Annotation - Span argument के साथ N-ary event संरचनाएँ
- Span Linking - Span के बीच संबंध बनाएँ
- Instance Display - Span लक्ष्य के साथ multi-field सामग्री प्रदर्शन
- UI Configuration - Span रंग कस्टमाइज़ करें
- Productivity Features - कीबोर्ड शॉर्टकट
कार्यान्वयन विवरण के लिए, स्रोत दस्तावेज़ीकरण देखें।