تتيح لك مهمة "أداة رصد اللغة" من MediaPipe تحديد لغة مقطع نصي. تعمل هذه ال tâche على بيانات النص باستخدام نموذج تعلُّم الآلة (ML) وتُخرج قائمة
بالتوقعات، حيث يتألّف كلّ توقّع من رمز لغة
ISO 639-1 ومقدار احتمالية.
ابدأ استخدام هذه المهمة باتّباع أحد أدلة التنفيذ هذه ل منصّتك المستهدفة. ترشدك هذه الأدلة الخاصة بالنظام الأساسي إلى تنفيذ أساسي
لهذه المهمة، بما في ذلك نموذج مقترَح ومثال على الرمز المبرمَج
مع خيارات الإعداد المقترَحة:
يصف هذا القسم ميزات هذه المهمة ومدخلاتها ومخرجاتها وخيارات الضبط.
الميزات
الحدّ الأدنى للنتيجة: فلترة النتائج استنادًا إلى نتائج التوقّعات
القائمة المسموح بها والقائمة المحظورة للتصنيف: حدِّد الفئات التي تم رصدها.
مدخلات المهام
نتائج المهام
يقبل "أداة رصد اللغة" نوع بيانات الإدخال التالي:
سلسلة
يعرض "أداة رصد اللغة" قائمة بالتوقّعات التي تتضمّن ما يلي:
رمز اللغة: رمز لغة أو لغة وفقًا لمعيار ISO 639-1 (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (مثل "en" للغة الإنجليزية و"uz" للغة الأوزبكية و"ja-Latn" للغة اليابانية (روماجي)) في شكل سلسلة.
الاحتمالية: هي تقييم الثقة بهذا التوقّع، ويتم التعبير عنها كقيمة احتمالية تتراوح بين 0 و1 كقيمة نقطة عائمة.
خيارات الإعدادات
تتضمّن هذه المهمة خيارات الضبط التالية:
اسم الخيار
الوصف
نطاق القيمة
القيمة التلقائية
max_results
تُستخدَم لضبط الحد الأقصى الاختياري لعدد اقتراحات اللغات التي تحقّق أعلى الدرجات والتي تريد
عرضها. إذا كانت هذه القيمة أقل من الصفر، يتم عرض جميع النتائج المتاحة.
أي أرقام موجبة
-1
score_threshold
تُستخدَم لضبط الحدّ الأدنى لنتيجة التوقّع الذي يتجاوز الحدّ الأدنى المقدَّم في
البيانات الوصفية للنموذج (إن توفّرت). ويتم رفض النتائج التي تقلّ عن هذه القيمة.
أيّ عائمة
لم يتم الضبط
category_allowlist
لضبط القائمة الاختيارية لرموز اللغات المسموح بها. إذا لم تكن فارغة، سيتمّ ترشيح توقّعات اللغة التي لا يتضمّن رمز لغتها هذه المجموعة. هذا الخيار غير متوافق مع
category_denylist، ويؤدي استخدام كليهما إلى ظهور خطأ.
أي سلاسل
لم يتم الضبط
category_denylist
لضبط القائمة الاختيارية لرموز اللغات غير المسموح بها. إذا كانت هذه المجموعة غير فارغة، سيتم فلترة اقتراحات اللغة التي يحتوي رمز لغتها على هذه المجموعة. هذا الخيار غير متوافق مع الخيار category_allowlist، ويؤدي استخدام كليهما إلى حدوث خطأ.
أي سلاسل
لم يتم الضبط
النماذج
نقدّم نموذجًا تلقائيًا مقترَحًا عند بدء التطوير باستخدام هذه المهمة.
نموذج أداة رصد اللغة (إجراء مقترَح)
تم تصميم هذا النموذج ليكون خفيفًا (315 كيلوبايت) ويستخدم بنية تصنيف الشبكات العصبية
المستندة إلى التضمين. يحدِّد النموذج اللغة باستخدام رمز
ISO 639-1 للّغة، ويمكنه التعرّف على 110 لغة. للحصول على قائمة باللغات المتوافقة مع
النموذج، اطّلِع على
ملف التصنيف،
الذي يسرد اللغات حسب رمزها ISO 639-1.
في ما يلي مقاييس أداء المهام لعملية المعالجة بأكملها استنادًا إلى نماذج pretrained
المدرَّبة مسبقًا أعلاه. نتيجة وقت الاستجابة هي متوسط وقت الاستجابة على هاتف Pixel 6 باستخدام
وحدة المعالجة المركزية / وحدة معالجة الرسومات.
تاريخ التعديل الأخير: 2025-01-13 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-01-13 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Language detection guide\n\nThe MediaPipe Language Detector task lets you identify the language of a piece of text. This\ntask operates on text data with a machine learning (ML) model and outputs a list\nof predictions, where each prediction consists of an\n[ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code\nand a probability.\n\n[Try it!arrow_forward](https://mediapipe-studio.webapps.google.com/demo/language_detector)\n\nGet Started\n-----------\n\nStart using this task by following one of these implementation guides for your\ntarget platform. These platform-specific guides walk you through a basic\nimplementation of this task, including a recommended model, and code example\nwith recommended configuration options:\n\n- **Android** - [Code example](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/language_detector/android) - [Guide](./android)\n- **Python** - [Code example](https://colab.research.google.com/github/googlesamples/mediapipe/blob/main/examples/language_detector/python/%5BMediaPipe_Python_Tasks%5D_Language_Detector.ipynb) - [Guide](./python)\n- **Web** - [Code example](https://codepen.io/mediapipe-preview/pen/RweLdpK) - [Guide](./web_js)\n\nTask details\n------------\n\nThis section describes the capabilities, inputs, outputs, and configuration\noptions of this task.\n\n### Features\n\n- **Score threshold** - Filter results based on prediction scores\n- **Label allowlist and denylist** - Specify the categories detected\n\n| Task inputs | Task outputs |\n|-------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Language Detector accepts the following input data type: - String | Language Detector outputs a list of predictions containing: - Language code: An ISO 639-1 (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language / locale code (e.g. \"en\" for English, \"uz\" for Uzbek, \"ja-Latn\" for Japanese (romaji)) as a string. \u003c!-- --\u003e - Probability: the confidence score for this prediction, expressed as a probability between zero and one as floating point value. |\n\n### Configurations options\n\nThis task has the following configuration options:\n\n| Option Name | Description | Value Range | Default Value |\n|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------|---------------|\n| `max_results` | Sets the optional maximum number of top-scored language predictions to return. If this value is less than zero, all available results are returned. | Any positive numbers | `-1` |\n| `score_threshold` | Sets the prediction score threshold that overrides the one provided in the model metadata (if any). Results below this value are rejected. | Any float | Not set |\n| `category_allowlist` | Sets the optional list of allowed language codes. If non-empty, language predictions whose language code is not in this set will be filtered out. This option is mutually exclusive with `category_denylist` and using both results in an error. | Any strings | Not set |\n| `category_denylist` | Sets the optional list of language codes that are not allowed. If non-empty, language predictions whose language code is in this set will be filtered out. This option is mutually exclusive with `category_allowlist` and using both results in an error. | Any strings | Not set |\n\nModels\n------\n\nWe offer a default, recommended model when you start developing with this task.\n| **Attention:** This MediaPipe Solutions Preview is an early release. [Learn more](/edge/mediapipe/solutions/about#notice).\n\n### Language detector model (recommended)\n\nThis model is built to be lightweight (315 KB) and uses embedding-based, neural\nnetwork classification architecture. The model identifies language using an\n[ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language\ncode, and can identify 110 languages. For a list of languages supported by the\nmodel, see the\n[label file](https://storage.googleapis.com/mediapipe-tasks/language_detector/labels.txt),\nwhich lists languages by their ISO 639-1 code.\n\n| Model name | Input shape | Quantization type | Model card | Versions |\n|---------------------------------------------------------------------------------------------------------------------------------------------|--------------|-------------------|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|\n| [Language Detector](https://storage.googleapis.com/mediapipe-models/language_detector/language_detector/float32/1/language_detector.tflite) | string UTF-8 | none (float32) | [info](https://storage.googleapis.com/mediapipe-assets/LanguageDetector%20Model%20Card.pdf) | [Latest](https://storage.googleapis.com/mediapipe-models/language_detector/language_detector/float32/1/language_detector.tflite) |\n\nTask benchmarks\n---------------\n\nHere's the task benchmarks for the whole pipeline based on the above\npre-trained models. The latency result is the average latency on Pixel 6 using\nCPU / GPU.\n\n| Model Name | CPU Latency | GPU Latency |\n|-------------------|-------------|-------------|\n| Language Detector | 0.31ms | - |"]]