관리-도구
편집 파일: ar_sentiment.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- Related discussion thread with ARBML team at GitHub: https://github.com/ARBML/Research/issues/1 Arabic mobileBERT example by ARBML team: https://arbml.github.io/ARBML/Interfaces/Website/ArabicSentimentClassificationBert/index.html --> <head> <title>Arabic Sentiment Analysis Demo</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Amiri" /> <style> body { font-family: 'Amiri', Tahoma; font-size: 150%; background: #f2f2f2; margin: 10; padding: 0; text-align: center; } .Paragraph { text-align: right; background: #fff; border: 1px solid #ccc; clear: both; padding: .5em 1em; } .Logo { float: left; margin: 0 15px 0 0; } h2 { border-bottom: 2px solid #69c; color: #333; margin: 20px 5px 20px 250px; } h3 { padding: 0px; margin: 0px; } input { font-family: inherit; font-size: inherit; } </style> <script src="./ar_sentiment.js"></script> <script> function checkSentiment() { var review = document.getElementById("review").value; var result = document.getElementById("result"); var [type, p] = arSentiment(review); p = Math.round(p * 1000) / 10; p = p.toFixed(1); if (type) { result.innerHTML = "إيجابي بنسبة %" + p; result.style.backgroundColor = '#ded'; } else { result.innerHTML = "سلبي بنسبة %" + p; result.style.backgroundColor = '#fca'; } return false; } </script> </head> <body> <div class="Paragraph" dir="rtl"> <img src="./images/ar-php_256.png" class ="Logo"> <h2>تحليل المشاعر</h2> <h3>الفكرة:</h3> <p> يقوم هذا النموذج بتحليل المشاعر باستخدام خوارزمية إحصائية تعتمد على حساب لوغاريتمات نسبة الأرجحية القائمة على نظرية <a href="https://repositories.lib.utexas.edu/handle/2152/13246" target="_blank">الأصل الثنائي للجذور العربية</a>. </p> <h3>البيانات:</h3> <p> تم تدريب النموذج باستخدام مئة ألف من المراجعات والتقييمات العربية لفنادق وأفلام وكتب ومنتجات <a href="https://www.kaggle.com/abedkhooli/arabic-100k-reviews" target="_blank">منشورة على Kaggle</a> </p> <h3>التجربة:</h3> <p> أدخل جملة معينة (تقييم على سبيل المثال): <form onsubmit="return checkSentiment();"> <input id="review" type="text" dir="rtl" placeholder="اكتب جملتك هنا، مثلا: ضعيف، التكييف سيء جدا!" /> <input type="submit" value="صنّف!" /> <span id="result" dir="rtl" style="padding: .1em .5em;"></span> </form> </p> <h3>الأداء:</h3> <p> بحجم لا يتجاوز 18 كيلوبايت للنموذج (الشيفرة البرمجية متاحة <a href="https://github.com/khaled-alshamaa/ar-php/blob/master/examples/ar_sentiment.js" target="_blank">هنا</a>)، استطعنا تحقيق نسبة إجابات صحيحة تبلغ %75 على بيانات التدريب، وكذلك %84 على <a href="https://github.com/elnagara/HARD-Arabic-Dataset" target="_blank">مجموعة بيانات التقييمات العربية للفنادق</a> (87% Precision و 80% Recall) بإجمالي 105698 تقييما لم يرها النموذج من قبل! لمزيد من المعلومات التقنية يمكنكم الإطلاع على <a href="https://github.com/ARBML/Research/issues/1" target="_blank">النقاش التالي</a> مع فريق <a href="https://github.com/ARBML/ARBML" target="_blank">ARBML</a> والمشاركة فيه. </p> <center> <a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-size="large" data-via="arphp" data-hashtags="Arabic,NLP,Sentiment" data-related="arphp" data-show-count="true">Tweet</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> </center> </div> <footer> <a href="https://github.com/khaled-alshamaa/ar-php">Ar-PHP</a>, an open-source library for website developers to process Arabic content <br />Copyright © 2022 Khaled Al-Sham'aa </footer> </body> </html>