برمجة وظيفة تحويل النص إلى كلام - كتاب هندسة البرمجيات - الصف 12 - الفصل 1 - المملكة العربية السعودية

الكتاب: كتاب هندسة البرمجيات - الصف 12 - الفصل 1 | المادة: هندسة البرمجيات | المرحلة: الصف 12 | الفصل الدراسي: 1

الدولة: المملكة العربية السعودية | المنهج: المنهج السعودي - وزارة التعليم

الدرس: برمجة وظيفة تحويل النص إلى كلام

📚 معلومات الصفحة

الكتاب: كتاب هندسة البرمجيات - الصف 12 - الفصل 1 | المادة: هندسة البرمجيات | المرحلة: الصف 12 | الفصل الدراسي: 1

الدولة: المملكة العربية السعودية | المنهج: المنهج السعودي - وزارة التعليم

نوع المحتوى: درس تعليمي

مستوى الصعوبة: متوسط

📝 ملخص الصفحة

تقدم هذه الصفحة شرحًا تفصيليًا لبرمجة وظيفة تحويل النص إلى كلام باستخدام MIT App Inventor، مع التركيز على معالجة النصوص وواجهة المستخدم. تبدأ بتوضيح كتل النصوص المتاحة في المحرر، مثل 'join' و'length' و'compare texts'، مما يساعد في بناء تطبيقات تفاعلية.

يتم عرض أمثلة عملية لكيفية تكوين كتل تحويل النص إلى كلام، بدءًا من استخدام حدث النقر على زر لتنشيط الوظيفة، ودمج سلاسل نصية متعددة لتكوين رسالة منطوقة. تتطور الأمثلة لاستخدام نصوص من مكونات واجهة المستخدم مثل 'discover_label'، مما يوضح كيفية ديناميكية المحتوى.

تتضمن الصفحة أيضًا شرحًا لكيفية الوصول إلى خصائص مكونات واجهة المستخدم وتعديلها، مثل 'Height' و'TextColor'، مما يعزز فهم البرمجة المرئية. أخيرًا، تُظهر أمثلة متقدمة لدمج نصوص من عدة تسميات لإنشاء رسائل معقدة، مما يعزز مهارات البرمجة التطبيقية.

📄 النص الكامل للصفحة

--- SECTION: شكل 4.12 --- شكل 4.12: برمجة وظيفة تحويل النص إلى كلام --- SECTION: Footer Information --- وزارة التعليم Ministry of Education 213 2023 - 1447 --- VISUAL CONTEXT --- **DIAGRAM**: MIT App Inventor Blocks Editor - Text Blocks Description: A screenshot of the MIT App Inventor blocks editor. The left sidebar shows categories like 'Built-in' (Control, Logic, Math, Text, Lists, Dictionaries, Colors, Variables, Procedures) and specific component blocks (discover_label, VerticalArrangement1, title_label, image, description_label, HorizontalArrangement1). The main workspace displays various text manipulation blocks: 'join', 'length', 'is empty', 'compare texts' (with operators '<', '=', '>'), 'trim', 'upcase', and 'starts at text'. The project name is 'Visit_SA_App'. Table Structure: Headers: N/A X-axis: EMPTY Y-axis: EMPTY Data: EMPTY Key Values: MIT APP INVENTOR, Projects, Connect, Build, Settings, Help, Visit_SA_App, Blocks, Viewer, Built-in, Control, Logic, Math, Text, Lists, Dictionaries, Colors, Variables, Procedures, discover_label, VerticalArrangement1, title_label, image, description_label, HorizontalArrangement1, Rename, Delete, join, length, is empty, compare texts, trim, upcase, starts at text Context: Illustrates the range of text processing blocks available in MIT App Inventor for app development. **DIAGRAM**: Text-to-Speech Block Configuration 3 Description: A code snippet from MIT App Inventor, labeled with the number 3. It shows a 'when text_to_speech_button .Click' event block. Inside the 'do' section, a 'call text_to_speech .Speak' block is present. The 'message' input of the 'Speak' block is connected to a 'join' block. A separate pink box visually explains the 'join' block, showing it can accept multiple 'string' inputs (three are depicted). Table Structure: Headers: N/A X-axis: EMPTY Y-axis: EMPTY Data: EMPTY Key Values: when text_to_speech_button .Click, do call text_to_speech .Speak, message, join, string, 3 Context: Demonstrates how to initiate text-to-speech functionality upon a button click and construct a message by joining multiple string components. **DIAGRAM**: MIT App Inventor Blocks Editor - Component Properties Description: A screenshot of the MIT App Inventor blocks editor, similar to the first, but focusing on the properties of a 'discover_label' component. The main workspace displays various getter and setter blocks for 'discover_label' properties: 'discover_label .Height', 'set discover_label .Height to', 'set discover_label .HeightPercent to', 'discover_label .Text', 'set discover_label .Text to', 'discover_label .TextColor', 'set discover_label .TextColor to', and 'discover_label .Visible'. The project name is 'Visit_SA_App'. Table Structure: Headers: N/A X-axis: EMPTY Y-axis: EMPTY Data: EMPTY Key Values: MIT APP INVENTOR, Projects, Connect, Build, Settings, Help, Visit_SA_App, Blocks, Viewer, Built-in, discover_label, VerticalArrangement1, title_label, image, description_label, HorizontalArrangement1, Rename, Delete, discover_label .Height, set discover_label .Height to, set discover_label .HeightPercent to, discover_label .Text, set discover_label .Text to, discover_label .TextColor, set discover_label .TextColor to, discover_label .Visible Context: Illustrates how to access and modify various properties of a user interface label component in MIT App Inventor. **DIAGRAM**: Text-to-Speech Block Configuration 4 Description: A code snippet from MIT App Inventor, labeled with the number 4. It shows a 'when text_to_speech_button .Click' event block. Inside the 'do' section, a 'call text_to_speech .Speak' block is present. The 'message' input of the 'Speak' block is connected to a 'join' block, which in turn is connected to a 'discover_label .Text' block, indicating that the text from 'discover_label' will be spoken. Table Structure: Headers: N/A X-axis: EMPTY Y-axis: EMPTY Data: EMPTY Key Values: when text_to_speech_button .Click, do call text_to_speech .Speak, message, join, discover_label .Text, 4 Context: Demonstrates how to use the text content of a specific UI label component ('discover_label') as the input for the text-to-speech function. **DIAGRAM**: Text-to-Speech Block Configuration 5 Description: A code snippet from MIT App Inventor, labeled with the number 5. It shows a 'when text_to_speech_button .Click' event block. Inside the 'do' section, a 'call text_to_speech .Speak' block is present. The 'message' input of the 'Speak' block is connected to a 'join' block, which combines the text content from three different label components: 'discover_label .Text', 'title_label .Text', and 'description_label .Text'. This indicates that the combined text from these three labels will be spoken. Table Structure: Headers: N/A X-axis: EMPTY Y-axis: EMPTY Data: EMPTY Key Values: when text_to_speech_button .Click, do call text_to_speech .Speak, message, join, discover_label .Text, title_label .Text, description_label .Text, 5 Context: Illustrates a more complex use of the text-to-speech function, where the message is dynamically constructed by concatenating text from multiple user interface labels.

🎴 بطاقات تعليمية للمراجعة

عدد البطاقات: 3 بطاقة لهذه الصفحة

ما هي الخطوات الأساسية لبرمجة وظيفة تحويل النص إلى كلام (Text-to-Speech) في MIT App Inventor؟

الإجابة: 1. استخدام كتلة حدث 'when button .Click' لتنشيط الوظيفة. 2. استخدام كتلة 'call text_to_speech .Speak' داخل الحدث. 3. توصيل مصدر النص (مثل كتلة 'join' أو '.Text' لمكون واجهة) بمدخل 'message' في كتلة 'Speak'.

الشرح: يتبع تنفيذ وظيفة تحويل النص إلى كلام نمطاً قياسياً في البرمجة المرئية: حدث → إجراء → إدخال البيانات.

تلميح: تذكر أن العملية تبدأ بحدث (مثل النقر) وتنتهي باستدعاء وظيفة النطق.

التصنيف: صيغة/خطوات | المستوى: متوسط

كيف يمكن استخدام النص من مكون واجهة مستخدم (مثل التسمية 'label') كمدخل لوظيفة تحويل النص إلى كلام؟

الإجابة: يتم ذلك عن طريق توصيل كتلة الخاصية '.Text' الخاصة بالمكون (مثل 'discover_label .Text') بمدخل 'message' في كتلة 'call text_to_speech .Speak'، إما مباشرة أو عبر كتلة 'join'.

الشرح: هذه الطريقة تجعل النص المعروض على واجهة التطبيق قابلاً للاستماع إليه، مما يعزز إمكانية الوصول.

تلميح: ابحث عن الكتل التي تبدأ باسم المكون ثم تنتهي بـ '.Text'.

التصنيف: مفهوم جوهري | المستوى: متوسط

ما الفرق بين استخدام كتلة 'join' لدمج نصوص ثابتة واستخدامها لدمج نصوص من مكونات واجهة مستخدم؟

الإجابة: دمج نصوص ثابتة: يتم إدخال سلاسل نصية محددة مباشرة في كتلة 'join'. دمج نصوص من مكونات: يتم توصيل كتل خصائص '.Text' الخاصة بالمكونات (مثل discover_label.Text) بكتلة 'join'، مما يجعل النص الناتج ديناميكياً ويتغير مع تغير محتوى الواجهة.

الشرح: الفرق الرئيسي هو في مصدر البيانات وقابلية التغيير. النصوص الديناميكية تجعل التطبيق أكثر تفاعلية.

تلميح: فكر في مصدر النص: هل هو قيمة ثابتة أم يأتي من عنصر في التطبيق؟

التصنيف: فرق بين مفهومين | المستوى: صعب