Skip to content
Questa pagina non è ancora disponibile nella tua lingua. Viene mostrata la versione in inglese.

Span Annotation

Named entity recognition और अन्य कार्यों के लिए text span हाइलाइट और लेबल करें।

Span Annotation

Span annotation एनोटेटर्स को टेक्स्ट के हिस्सों को चुनने और लेबल करने की अनुमति देता है, जो आमतौर पर named entity recognition (NER), part-of-speech tagging, और text highlighting कार्यों के लिए उपयोग किया जाता है।

बुनियादी कॉन्फ़िगरेशन

yaml
annotation_schemes:
  - annotation_type: span
    name: entities
    description: "Highlight named entities in the text"
    labels:
      - PERSON
      - ORGANIZATION
      - LOCATION

कॉन्फ़िगरेशन विकल्प

Entity लेबल

एनोटेटर्स जो span प्रकार बना सकते हैं उन्हें परिभाषित करें:

yaml
labels:
  - PERSON
  - ORGANIZATION
  - LOCATION
  - DATE
  - EVENT

लेबल रंग

दृश्य अंतर के लिए रंग कस्टमाइज़ करें:

yaml
label_colors:
  PERSON: "#3b82f6"
  ORGANIZATION: "#10b981"
  LOCATION: "#f59e0b"
  DATE: "#8b5cf6"
  EVENT: "#ec4899"

रंग hex (#ff0000) या RGB (rgb(255, 0, 0)) हो सकते हैं।

कीबोर्ड शॉर्टकट

कीबोर्ड बाइंडिंग के साथ एनोटेशन तेज़ करें:

yaml
keyboard_shortcuts:
  PERSON: "1"
  ORGANIZATION: "2"
  LOCATION: "3"
  DATE: "4"

Tooltip

प्रत्येक लेबल के लिए मार्गदर्शन प्रदान करें:

yaml
tooltips:
  PERSON: "Names of people, characters, or personas"
  ORGANIZATION: "Companies, agencies, institutions"
  LOCATION: "Physical locations, addresses, geographic regions"

ओवरलैपिंग Span

ओवरलैपिंग की अनुमति दें

ओवरलैप करने वाले span सक्षम करें:

yaml
- annotation_type: span
  name: entities
  labels:
    - PERSON
    - ROLE
  allow_overlapping: true

यह उपयोगी है जब एक ही टेक्स्ट के कई लेबल हो सकते हैं (जैसे, "Dr. Smith" PERSON और ROLE दोनों है)।

ओवरलैपिंग अक्षम करें (डिफ़ॉल्ट)

yaml
- annotation_type: span
  name: entities
  labels:
    - PERSON
    - ORGANIZATION
  allow_overlapping: false  # Default behavior

Span चयन मोड

शब्द-स्तरीय चयन

केवल पूर्ण शब्द चुनें:

yaml
- annotation_type: span
  name: entities
  selection_mode: word
  labels:
    - ENTITY

वर्ण-स्तरीय चयन

आंशिक शब्दों के चयन की अनुमति दें:

yaml
- annotation_type: span
  name: entities
  selection_mode: character
  labels:
    - ENTITY

पूर्व-एनोटेट Span

समीक्षा या सुधार के लिए मौजूदा एनोटेशन लोड करें:

json
{
  "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"}
  ]
}

पूर्व-एनोटेशन लोड करने के लिए कॉन्फ़िगर करें:

yaml
- annotation_type: span
  name: entities
  load_pre_annotations: true
  pre_annotation_field: spans

सामान्य NER कॉन्फ़िगरेशन

मानक NER (4 प्रकार)

yaml
- 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 शैली)

yaml
- 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

yaml
- 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

yaml
- annotation_type: span
  name: social_ner
  labels:
    - PERSON
    - ORGANIZATION
    - LOCATION
    - PRODUCT
    - CREATIVE_WORK
    - GROUP

गुण के साथ Span

समृद्ध एनोटेशन के लिए span में गुण जोड़ें:

yaml
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 स्कीमा

अलग-अलग पहलुओं को अलग-अलग एनोटेट करें:

yaml
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 एनोटेट करना चाहते हों।

कॉन्फ़िगरेशन

yaml
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
      - ORGANIZATION

Multi-Field डेटा फॉर्मेट

आपके डेटा में अलग-अलग टेक्स्ट फ़ील्ड शामिल होने चाहिए:

json
{
  "id": "doc1",
  "source_text": "John Smith works at Microsoft in Seattle.",
  "summary": "Smith is employed by Microsoft."
}

आउटपुट फॉर्मेट

target_field का उपयोग करते समय, एनोटेशन फ़ील्ड के अनुसार कुंजीबद्ध होते हैं:

json
{
  "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 के भीतर लेबल टेक्स्ट प्रदर्शित करें:

yaml
- annotation_type: span
  name: entities
  show_label_in_span: true

रेखांकन शैली

पृष्ठभूमि हाइलाइटिंग के बजाय रेखांकन का उपयोग करें:

yaml
- annotation_type: span
  name: entities
  display_style: underline

आउटपुट फॉर्मेट

Span एनोटेशन character offset के साथ सहेजे जाते हैं:

json
{
  "id": "doc1",
  "entities": [
    {
      "start": 0,
      "end": 10,
      "text": "John Smith",
      "label": "PERSON"
    },
    {
      "start": 20,
      "end": 29,
      "text": "Microsoft",
      "label": "ORGANIZATION"
    }
  ]
}

पूर्ण उदाहरण: NER कार्य

yaml
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 या विभाजित अभिव्यक्तियों के लिए उपयोगी है।

yaml
- 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) से जोड़ा जा सकता है:

yaml
- 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 दस्तावेज़ीकरण देखें।

सर्वोत्तम प्रथाएँ

  1. आसान दृश्य अंतर के लिए विशिष्ट रंग का उपयोग करें
  2. प्रत्येक entity प्रकार के लिए उदाहरण के साथ स्पष्ट tooltip प्रदान करें
  3. तेज़ एनोटेशन के लिए कीबोर्ड शॉर्टकट सक्षम करें
  4. जब तक character सटीकता की आवश्यकता न हो, word-level selection का उपयोग करें
  5. तेज़ सुधार कार्यप्रवाह के लिए पूर्व-एनोटेशन पर विचार करें
  6. अपने एनोटेशन दिशानिर्देशों के आधार पर ओवरलैपिंग सेटिंग्स का परीक्षण करें

अधिक पढ़ें

  • 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 - कीबोर्ड शॉर्टकट

कार्यान्वयन विवरण के लिए, स्रोत दस्तावेज़ीकरण देखें।