التوثيق / مرجع الواجهة
كشف الألفاظ المسيئة
تفحص النصوص التي ينشئها المستخدمون بحثًا عن الألفاظ المسيئة وتُرجع درجة خطورة وحكمًا بالسلامة.
نظرة عامة#
تحلل scoring/profanity السلسلة الممرَّرة في text وتُرجع isSafe وriskScore وtotalBadWords والنص الأصلي text وisML الذي يخبرك هل شارك نموذج التعلم الآلي في القرار. يوجد خياران اختياريان يغيّران الإخراج: scoreOnly=yes يُرجع الدرجة والحكم فقط، وlistBadWords=yes يضيف قائمة الكلمات المخالفة.
متى تستخدمها#
- لمراجعة التعليقات والتقييمات ورسائل الدردشة وتذاكر الدعم قبل نشرها.
- لفرز أسماء المستخدمين وأسماء العرض والنبذات عند التسجيل.
- لجمع إشارة إشراف تحدد بين النشر التلقائي والاحتجاز للمراجعة والرفض.
قراءة النتيجة#
isSafeهي الإجابة السريعة. حين تكون false احتجز المحتوى أو ارفضه.riskScoreمقياس متصل. القيم القريبة من 0 سليمة، وكلما ارتفعت زادت ثقة الاكتشاف. تُطلق Gurdx حدثًا عند 0.5 فأكثر، وهي عتبة افتراضية جيدة لـ"يحتاج مراجعة". ارفعها لمعالجة أكثر تشددًا، وخفضها للمجتمعات ذات القواعد الصارمة مثل تطبيقات الأطفال.totalBadWordsتعد المصطلحات المطابقة، وقائمةlistBadWordsمفيدة لإبرازها للمشرفين. لا تعرض القائمة على كاتب النص لأنها تساعد في الالتفاف على المرشح.- للسياق أثر: كلمات مسيئة في موضع قد تكون بريئة في آخر، فاستخدم الدرجة مدخلًا في مسار الإشراف لا المسار كله.
ملاحظات#
- تُحتسب طلبًا واحدًا. وضع الاختبار يُرجع بيانات وهمية مجانًا دون أحداث.
- مشمولة في كل الباقات بما فيها القياسية.
- لا توجد قواعد مخصصة لهذه الدالة، ولا تُدرج النصوص في قوائم سوداء، وتُحفظ بالقدر اللازم لطلبات حذف البيانات فقط (راجع حذف بيانات مستخدم).
- يُطلَق حدث
profanityعند بلوغ الخطورة 0.5 ويُرسل إلى الويب هوك. - النص الفارغ أو الأطول من 10,000 حرف يُرجع الخطأ 129 (
invalid_text) مع HTTP 200.
الطلب#
GET
https://gurdx.cretip.com/api/scoring/profanity
- صادِق بمعامل key أو بترويسة Authorization: Bearer.
- تُحتسب طلباً واحداً.
- متاحة في: تجربة مجانية القياسية المميّزة الدفع حسب الاستخدام
المعاملات#
| الاسم | النوع | الوصف |
|---|---|---|
text
مطلوب
استعلام |
string |
The text you want to filter Sample value: This is a sample text without profanity!
|
scoreOnly
اختياري
استعلام |
stringالافتراضي: no |
Returns only the score of the text and whether it's safe or not. Expected values: yes, or no.
|
listBadWords
اختياري
استعلام |
stringالافتراضي: no |
Used to list the bad words in an array. Expected values: yes, or no.
|
تقبل كل خدمة أيضاً format, lang, mode, userID, callback. راجع الخيارات.
أمثلة برمجية#
curl -G "https://gurdx.cretip.com/api/scoring/profanity" \
--data-urlencode "key=YOUR_API_KEY" \
--data-urlencode "text=Hello world"
<?php
$response = file_get_contents('https://gurdx.cretip.com/api/scoring/profanity?'.http_build_query(['key' => 'YOUR_API_KEY', 'text' => 'Hello world']));
$result = json_decode($response, true);
if ($result['status'] === 'success') {
print_r($result['data']);
} else {
echo $result['code'].': '.$result['description'];
}
const params = new URLSearchParams({"key":"YOUR_API_KEY","text":"Hello world"});
const res = await fetch(`https://gurdx.cretip.com/api/scoring/profanity?${params}`);
const result = await res.json();
if (result.status === 'success') {
console.log(result.data);
} else {
console.error(result.code, result.description);
}
import requests
res = requests.get("https://gurdx.cretip.com/api/scoring/profanity", params={"key": "YOUR_API_KEY", "text": "Hello world"})
result = res.json()
if result["status"] == "success":
print(result["data"])
else:
print(result["code"], result["description"])
الاستجابة#
نجاح#
{
"data": {
"isML": true,
"text": "This is just a normal text",
"totalBadWords": null,
"riskScore": 0,
"isSafe": true,
"status": "success",
"executionTime": 120
}
}خطأ#
تُسلَّم الأخطاء بحالة HTTP 200 — افحص دائماً حقل status.
{
"status": "error",
"code": 101,
"type": "invalid_key",
"description": "The API Key is missing or invalid."
}حقول الاستجابة#
| الاسم | النوع | الوصف |
|---|---|---|
data.isML |
boolean |
A boolean value that indicates whether the detection is done by Machine Learning or not. |
data.text |
string |
The text you passed to the API. |
data.totalBadWords |
number |
The total number of profane words found in the text. Note: This field is only available when isML is true, otherwise you'll get null.
|
data.riskScore |
number |
The risk score of the text you passed. |
data.isSafe |
boolean |
A boolean value that indicates whether the text is safe or not. |
data.status |
string |
The response status. Expected values: success, or error.
|
data.executionTime |
integer |
Time spent in milliseconds to process the data. |
data |
object |
— |
وجدت خطأ؟ أخبرنا عبر صفحة التواصل. تواصل معنا