0Pricing
NLP Academy · درس

أول برنامج نصي لك في Python

اقرأ سلسلة نصية واحسب كلماتها

أول برنامج نصي لك في Python درس مجاني في NLP Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في NLP Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة NLP Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Time to Write Code

Enough theory, let us write real Python. Your first NLP program will read a sentence and count its words. 🐍

Text Lives in Strings

In Python, a piece of text is a string, written inside quotes. It is the basic container for every word you process.

text = "NLP turns words into meaning"

Print to See It

Use print to show a value on screen. It is the simplest way to check that your text loaded correctly.

text = "NLP turns words into meaning"
print(text)

Splitting Into Words

The split method breaks a string at the spaces, handing you back a clean list of individual words.

words = text.split()
print(words)

A List of Tokens

That result is a list, your very first set of tokens. Each item is one word, ready to be counted or examined.

Counting With len

Wrap the list in len to count its items. This single function tells you how many words the sentence holds.

count = len(words)
print(count)

Putting It Together

A few lines do real NLP: store text, split it, and count the words. You just built a tiny word counter.

text = "NLP turns words into meaning"
words = text.split()
print(len(words))

Try Your Own Sentence

Swap in any sentence you like and run it again. The same three lines work on a tweet, a review, or a poem.

Words vs Characters

Call len on the string itself, not the list, and you count characters instead, spaces included.

print(len(text))

Why This Matters

Counting words feels small, but it is the foundation. Every advanced model still begins by splitting text into pieces.

You Did It

You wrote and understood a working NLP program. From here you only add steps, never start from scratch again. 🎉

Quick Check

You have a string in words after calling split. How do you count the words?

Recap

You stored text in a string, split it into a list, and counted with len: your first real NLP program in Python. 🏆

الأسئلة الشائعة

هل درس «أول برنامج نصي لك في Python» مجاني؟

نعم — نص درس «أول برنامج نصي لك في Python» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة NLP Academy، انتقل إلى CoddyKit PRO. تتضمن دورة NLP Academy 4 دروس في المجموع.

ماذا ستتعلم في «أول برنامج نصي لك في Python»؟

اقرأ سلسلة نصية واحسب كلماتها تتمرن على NLP Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ NLP Academy؟

لا تُشترط خبرة سابقة. NLP Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «أول برنامج نصي لك في Python»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس NLP Academy هذا؟

نعم. كل درس في NLP Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. من الكلمات إلى المعنى: فكرة NLP
  2. تطبيقات NLP التي تستخدمها يوميًا
  3. نظرة عامة على مسار NLP
  4. أول برنامج نصي لك في Python
← العودة إلى NLP Academy