1. Data vs Information vs Knowledge
Data is raw facts with no interpretation. Information is organized data that has meaning. Knowledge is what we conclude after interpreting information. NLP systems gradually transform raw text (data) into useful knowledge through multiple processing steps.
Create a text file
quran.txt
بسم الله الرحمن الرحيم
الحمد لله رب العالمين
Read the raw data
with open("quran.txt", encoding="utf-8") as f:
data = f.read()
print(data)
Output
بسم الله الرحمن الرحيم
الحمد لله رب العالمين
Turn data into information
words = data.split()
print(words)
print(len(words))
Output
['بسم', 'الله', 'الرحمن', 'الرحيم', 'الحمد', 'لله', 'رب', 'العالمين']
8
Turn information into knowledge
from collections import Counter
counts = Counter(words)
print(counts.most_common(3))
Output
[('الله', 1), ('بسم', 1), ('الرحمن', 1)]