
تم استخدام أداة Gutentag لبناء مجموعة الشعر المطلوبة من موقع Gutenberg Project ، وهي قاعدة بيانات ضخمة عبر الإنترنت تحتوي على أكثر من 59000 كتاب إلكتروني.
Emolex هي مجموعة بيانات جماعية من الارتباطات بين الكلمات والعواطف. تم استخدامه لتصنيف مجموعة الشعر على أساس عاطفة القصائد. تم بناء نموذج لغة لكل عاطفة باستخدام القصائد المقابلة لتلك المشاعر.
Huggingface هو مجتمع الذكاء الاصطناعى يوفر نماذج مفتوحة المصادر المختلفة في معالجة اللغة الطبيعية. تم استخدام طراز GPT-2 من Openai من Huggingface Model Hub الذي تم ضبطه على مجموعة شعر كبيرة.
Flask هو إطار عمل Micro Web مكتوب في Python. تم استخدامه لإنشاء تطبيق ويب يستخدم للتفاعل مع نماذج GPT-2 التي تم ضبطها.
الخوارزمية هي أداة MLOPS التي توفر طريقة بسيطة وأسرع لنشر نموذج التعلم الآلي الخاص بك في الإنتاج. تم استخدامه لإنشاء واجهة برمجة تطبيقات الويب للتفاعل مع النموذج. يمكن للمستخدمين تقديم طلبات API إلى النموذج من خلال تطبيق Flask.
Heroku هي منصة كخدمة (PAAs) تمكن المطورين من إنشاء التطبيقات وتشغيلها وتشغيلها بالكامل في السحابة. تم استخدامه لنشر تطبيق الويب بحيث يمكن الوصول إليه من قبل المستخدمين من جميع أنحاء العالم 24x7.
تم تطوير هذا المشروع بهدف إنشاء أداة يمكنها تلقائيًا تكوين الشعر الأصلي داخل لحظة تضمين العاطفة المطلوبة. تم اختيار GPT-2 من Openai كنموذج لغوي أساسي لأنه بنية محول مع رؤساء المصاحب الذاتي المقنعة مكّنتها من أداء جيد بشكل استثنائي مع المهام ذات الصلة بالجيل.
تم الحصول على مجموعة البيانات من موقع Gutenberg Project. تم استخدام أداة Emolex لتقسيم مجموعة الشعر إلى 8 فصول عاطفية مختلفة - anger, anticipation, disgust, fear, joy, sadness, surprise and trust . تمت إضافة القصائد التي لم تتوافق مع أي من هذه الفئات في الفئة المحايدة.
في البداية ، تم تدريب نموذج GPT-2 على القصائد المحايدة. هذا أعطانا النموذج "المحايد" لتوليد أي قصيدة عامة. تم إنشاء نماذج لكل عاطفة عن طريق ضبط هذا النموذج "المحايد" على قصائد المشاعر المقابلة. يمكن العثور على عملية بناء هذه النماذج بأكملها في كولاب. يمكن العثور على هذه النماذج أيضًا في مركز Huggingface Model.
فيما يلي روابط إلى نماذج كل عاطفة:
تم استخدام الخوارزمية لبناء واجهة برمجة تطبيقات للتفاعل مع هذه النماذج. تم إنشاء تطبيق Flask للسماح للمستخدمين بإرسال طلبات API إلى الخوارزمية واستلام القصائد التي تم إنشاؤها. تم نشر التطبيق وصنعه على الهواء مباشرة باستخدام Heroku.
?AutoCompose
┣ data --> Contains entire poetry corpus as well as poem collections of each emotion stored in json format
┣ models --> Contains language models fine-tuned for each emotion
┃ ┣ anger
┃ ┣ anger2
┃ ┣ anticipation2
┃ ┣ disgust2
┃ ┣ fear
┃ ┣ fear2
┃ ┣ joy
┃ ┣ joy2
┃ ┣ neutral
┃ ┣ sadness2
┃ ┣ surprise2
┃ ┣ trust2
┣ notebooks --> Contains .ipynb files used to work with dataset and train the model
┣ outputs --> Contains 25 poems generated by the model for each emotion
┣ readme-assets --> Contains images and gifs used in readme file
┣ src --> Contains flask app and other supporting python files
┃ ┣ static
┃ ┃ ┗ images
┃ ┣ templates
أفكار غاضبة
I am not jealous; but this does vex
My heart so full of misery that I cannot stop
From angry thoughts. This brings me relief,
And a painful torment; and I
Am content to part from thee alone.
الله في الغموض
Thence down the river to the mountain-side
I travelled with my boats and my oarsmen,
To seek a haven near the southern cape
Where dwelt some mighty god in mystery,
Unknowing I wandered therefrom, so
Unconscious I lay, and rested there.
الإقحوانات والقذارة
The little pool, by the house-wall,
Is covered with daisies and filth;
The fountains are withered and dim,
And the lizards writhe in rags.
أراك في زاوية بعيدة
I see thee in a far corner,
With a stealthy stride, and a trembling soul
I know thou, Dear, who should'st not fear
That I should come near thee!
I know thee.
حلم لطيف
Thy soul has joy, and thy soul is free,
And all the things it loves can live
In thy love for me and thee!
O gentle-throat, why sing so low,
Or do thy music too loudly?
Whence are all thy numbers fit?
If that thy mind is fix'd upon one,
It joys not to hear thee speak.
قمر
He took them home, and soon set them down
In a chest at the door of his room,
And asked them if they knew
What the moon was about.
عزيزي القلب
For you, dear heart, so lone and worn and weary,
Hear me, and the silence dies,
That still I think you must come near me,
And not so be blest.
الطبيعة الخاصة
He is a wild magician,
Who takes up the air and vanishes
As though his name were Nature's own,
And that it were Nature's own prompting,
That he should leave school in such a way.
السدود في تمويه
He sees the aged damsels in disguise,
And how the princely damsels are dressed;
The queen of Sariola, as she stands,
Is clad in rich embroidery;
And every thing that she does wear
Is a royal dame in finest form,
And a queen in fairest posture too.