Skip to content
Guides3 min read

فهم صيغ بيانات Potato

نظرة معمقة في صيغ بيانات JSON و JSONL، مع أمثلة للتوسيم النصي والصوري والصوتي ومتعدد الوسائط.

Potato Team·

فهم صيغ بيانات Potato

يستخدم Potato صيغتي JSON و JSONL لبيانات الإدخال وتوسيمات الإخراج. يغطي هذا الدليل مواصفات الصيغ والأمثلة وأفضل الممارسات لجميع أنواع البيانات.

صيغ بيانات الإدخال

JSON Lines (JSONL) - الصيغة الموصى بها

كائن JSON واحد لكل سطر:

json
{"id": "001", "text": "First document text here."}
{"id": "002", "text": "Second document text here."}
{"id": "003", "text": "Third document text here."}

المزايا:

  • معالجة تدفقية (كفاءة في الذاكرة)
  • سهولة الإضافة
  • سطر تالف لا يكسر الملف

مصفوفة JSON

مصفوفة JSON قياسية:

json
[
  {"id": "001", "text": "First document."},
  {"id": "002", "text": "Second document."},
  {"id": "003", "text": "Third document."}
]

التكوين:

yaml
data_files:
  - data/items.json

بيانات توسيم النص

نص أساسي

json
{"id": "doc_001", "text": "The product quality exceeded my expectations."}

مع البيانات الوصفية

json
{
  "id": "review_001",
  "text": "Great product, fast shipping!",
  "metadata": {
    "source": "amazon",
    "date": "2024-01-15",
    "author": "user123",
    "rating": 5
  }
}

مع التوسيمات المسبقة

json
{
  "id": "ner_001",
  "text": "Apple announced new products in Cupertino.",
  "pre_annotations": {
    "entities": [
      {"start": 0, "end": 5, "label": "ORG", "text": "Apple"},
      {"start": 31, "end": 40, "label": "LOC", "text": "Cupertino"}
    ]
  }
}

التكوين:

yaml
data_files:
  - data/texts.json
 
item_properties:
  id_key: id
  text_key: text

بيانات توسيم الصور

صور محلية

json
{
  "id": "img_001",
  "image_path": "/data/images/photo_001.jpg",
  "caption": "Street scene in Paris"
}

صور عن بُعد

json
{
  "id": "img_002",
  "image_url": "https://example.com/images/photo.jpg"
}

مع مربعات الإحاطة

json
{
  "id": "detection_001",
  "image_path": "/images/street.jpg",
  "pre_annotations": {
    "objects": [
      {"bbox": [100, 150, 200, 300], "label": "person"},
      {"bbox": [350, 200, 450, 280], "label": "car"}
    ]
  }
}

التكوين:

yaml
data_files:
  - data/images.json
 
item_properties:
  id_key: id
  image_key: image_path  # or image_url

بيانات توسيم الصوت

صوت محلي

json
{
  "id": "audio_001",
  "audio_path": "/data/audio/recording.wav",
  "duration": 45.5,
  "transcript": "Hello, how are you today?"
}

مع المقاطع

json
{
  "id": "audio_002",
  "audio_path": "/audio/meeting.mp3",
  "segments": [
    {"start": 0.0, "end": 5.5, "speaker": "Speaker1"},
    {"start": 5.5, "end": 12.0, "speaker": "Speaker2"}
  ]
}

التكوين:

yaml
data_files:
  - data/audio.json
 
item_properties:
  audio_key: audio_path
  text_key: transcript

بيانات متعددة الوسائط

نص + صورة

json
{
  "id": "mm_001",
  "text": "What is shown in this image?",
  "image_path": "/images/scene.jpg"
}

نص + صوت

json
{
  "id": "mm_002",
  "text": "Transcribe this audio:",
  "audio_path": "/audio/clip.wav",
  "reference_transcript": "Expected transcription here"
}

صيغة توسيمات الإخراج

إخراج أساسي

json
{
  "id": "doc_001",
  "text": "Great product!",
  "annotations": {
    "sentiment": "Positive",
    "confidence": 5
  },
  "annotator": "user123",
  "timestamp": "2024-11-05T10:30:00Z"
}

توسيمات النطاق

json
{
  "id": "ner_001",
  "text": "Apple CEO Tim Cook visited Paris.",
  "annotations": {
    "entities": [
      {"start": 0, "end": 5, "label": "ORG", "text": "Apple"},
      {"start": 10, "end": 18, "label": "PERSON", "text": "Tim Cook"},
      {"start": 27, "end": 32, "label": "LOC", "text": "Paris"}
    ]
  }
}

مُوسِّمون متعددون

json
{
  "id": "item_001",
  "text": "Sample text",
  "annotations": [
    {
      "annotator": "ann1",
      "labels": {"sentiment": "Positive"},
      "timestamp": "2024-11-05T10:00:00Z"
    },
    {
      "annotator": "ann2",
      "labels": {"sentiment": "Positive"},
      "timestamp": "2024-11-05T11:00:00Z"
    }
  ],
  "aggregated": {
    "sentiment": "Positive",
    "agreement": 1.0
  }
}

مرجع التكوين

yaml
data_files:
  - data/items.json
 
item_properties:
  id_key: id
  text_key: text
  image_key: image_path
  audio_key: audio_path

أفضل الممارسات

  1. ضمّن دائماً المعرفات: معرفات فريدة للتتبع
  2. استخدم JSONL لمجموعات البيانات الكبيرة: كفاءة أفضل في الذاكرة
  3. تحقق قبل التحميل: افحص صحة صيغة JSON
  4. ضمّن البيانات الوصفية: المصدر والتاريخ والمؤلف يساعدون في تصحيح الأخطاء
  5. أسماء حقول متسقة: معالجة أسهل في المراحل اللاحقة

وثائق صيغة البيانات الكاملة في /docs/core-concepts/data-formats.