File size: 10,043 Bytes
1852c9c
 
 
 
 
 
9f8a129
 
 
 
 
1852c9c
 
 
 
 
 
 
 
 
9f8a129
1852c9c
 
9f8a129
1852c9c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>هوش مصنوعی فارسی - راهنمای جامع</title>
    <!-- Google Fonts - Vazirmatn -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
<!-- Tailwind -->
    <script src="https://cdn.tailwindcss.com"></script>
    
    <!-- Custom Styles -->
    <link rel="stylesheet" href="style.css">
    <style>
        body {
            font-family: 'Vazirmatn', sans-serif;
        }
        .samim {
            font-family: 'Vazirmatn', sans-serif;
        }
        .tanha {
            font-family: 'Vazirmatn', sans-serif;
        }
    </style>
</head>
<body class="bg-gradient-to-br from-amber-50 to-orange-50 bg-fixed">
    <div class="max-w-4xl mx-auto p-8">
        <header class="text-center mb-16">
            <h1 class="samim text-5xl md:text-6xl font-bold text-amber-800 mb-4">
                هوش مصنوعی فارسی
            </h1>
            <p class="text-xl text-gray-600 leading-relaxed">
                راهنمای جامع پیاده‌سازی و توسعه هوش مصنوعی برای زبان فارسی
            </p>
        </header>

        <main class="space-y-12">
            <section class="bg-white/80 backdrop-blur-sm rounded-2xl p-8 shadow-lg">
                <h2 class="samim text-3xl font-bold text-amber-700 mb-6">مقدمه</h2>
                <p class="text-gray-700 leading-loose mb-4">
                    هوش مصنوعی فارسی به دلیل ساختار خاص زبان فارسی و استفاده از الفبای عربی، چالش‌های منحصربه‌فردی دارد. 
                    از جمله این چالش‌ها می‌توان به نوشتار راست‌به‌چپ، حروف متصل، حذف برخی حروف در کلمات و تنوع در تلفظ اشاره کرد.
                </p>
                <p class="text-gray-700 leading-loose">
                    این راهنما به شما کمک می‌کند تا بهترین روش‌ها را برای توسعه سیستم‌های هوش مصنوعی که به‌درستی با زبان فارسی کار می‌کنند، بیاموزید.
                </p>
            </section>

            <section class="bg-white/80 backdrop-blur-sm rounded-2xl p-8 shadow-lg">
                <h2 class="samim text-3xl font-bold text-amber-700 mb-6">پیش‌نیازها</h2>
                <ul class="space-y-3 text-gray-700">
                    <li class="flex items-center gap-3">
                        <span class="w-2 h-2 bg-amber-500 rounded-full"></span>
                        آشنایی مقدماتی با زبان برنامه‌نویسی پایتون
                    </li>
                    <li class="flex items-center gap-3">
                        <span class="w-2 h-2 bg-amber-500 rounded-full"></span>
                        دانش پایه درباره پردازش زبان طبیعی (NLP)
                    </li>
                    <li class="flex items-center gap-3">
                        <span class="w-2 h-2 bg-amm500 rounded-full"></span>
                        نصب کتابخانه‌های مورد نیاز: transformers, torch, hazm
                    </li>
                </ul>
            </section>

            <section class="bg-white/80 backdrop-blur-sm rounded-2xl p-8 shadow-lg">
                <h2 class="samim text-3xl font-bold text-amber-700 mb-6">مراحل اجرا</h2>
                
                <div class="space-y-6">
                    <div class="border-r-4 border-amber-500 pr-4">
                        <h3 class="tanha text-xl font-semibold text-amber-800 mb-2">۱. پیش‌پردازش متن</h3>
                        <p class="text-gray-700 leading-relaxed">
                            متن فارسی را به‌درستی نرمال‌سازی کنید. این شامل حذف علائم نگارشی، تبدیل اعداد فارسی به انگلیسی، 
                            و یکنواخت‌سازی نویسه‌ها است.
                        </p>
                    </div>
                    
                    <div class="border-r-4 border-orange-500 pr-4">
                        <h3 class="tanha text-xl font-semibold text-orange-800 mb-2">۲. توکن‌سازی</h3>
                        <p class="text-gray-700 leading-relaxed">
                            از توکنایزرهای مخصوص زبان فارسی استفاده کنید. توکن‌های Subword برای زبان فارسی به‌خوبی کار می‌کنند
                            چون می‌توانند ریشه‌های کلمات را شناسایی کنند.
                        </p>
                    </div>
                    
                    <div class="border-r-4 border-red-500 pr-4">
                        <h3 class="tanha text-xl font-semibold text-red-800 mb-2">۳. آموزش مدل</h3>
                        <p class="text-gray-700 leading-relaxed">
                            از معماری‌های Transformer استفاده کنید که برای زبان‌های راست‌به‌چپ بهینه‌سازی شده‌اند.
                            مدل‌های چندزبانه مانند mBERT یا XLM-R گزینه‌های خوبی هستند.
                        </p>
                    </div>
                </div>
            </section>

            <section class="bg-white/80 backdrop-blur-sm rounded-2xl p-8 shadow-lg">
                <h2 class="samim text-3xl font-bold text-amber-700 mb-6">کد نمونه</h2>
                <div class="bg-gray-900 rounded-lg p-6 text-left">
                    <pre class="text-green-400 text-sm overflow-x-auto"><code># نصب کتابخانه‌ها
pip install transformers hazm torch

# پیش‌پردازش متن فارسی
from hazm import Normalizer, word_tokenize
from transformers import AutoTokenizer, AutoModel

# نرمال‌سازی متن
normalizer = Normalizer()
text = "سلام دنیا! این یک متن فارسی است."
normalized_text = normalizer.normalize(text)

# توکن‌سازی
tokenizer = AutoTokenizer.from_pretrained("HooshvareLab/bert-base-parsbert-uncased")
tokens = tokenizer(normalized_text, return_tensors="pt")

# استفاده از مدل
model = AutoModel.from_pretrained("HooshvareLab/bert-base-parsbert-uncased")
outputs = model(**tokens)</code></pre>
                </div>
            </section>

            <section class="bg-white/80 backdrop-blur-sm rounded-2xl p-8 shadow-lg">
                <h2 class="samim text-3xl font-bold text-amber-700 mb-6">منابع و پیوندهای مفید</h2>
                <div class="grid md:grid-cols-2 gap-4">
                    <a href="https://huggingface.co/models?language=fa&sort=downloads" 
                       class="block p-4 bg-amber-100 rounded-lg hover:bg-amber-200 transition-colors">
                        <h3 class="font-semibold text-amber-800">مدل‌های فارسی در Hugging Face</h3>
                        <p class="text-sm text-amber-700 mt-1">مجموعه‌ای از مدل‌های آموزش‌دیده برای زبان فارسی</p>
                    </a>
                    <a href="https://github.com/sobhe/moratab" 
                       class="block p-4 bg-orange-100 rounded-lg hover:bg-orange-200 transition-colors">
                        <h3 class="font-semibold text-orange-800">کتابخانه مراطب</h3>
                        <p class="text-sm text-orange-700 mt-1">ابزارهایی برای راست‌به‌چپ‌سازی متن</p>
                    </a>
                    <a href="https://www.sobhe.ir/hazm/" 
                       class="block p-4 bg-red-100 rounded-lg hover:bg-red-200 transition-colors">
                        <h3 class="font-semibold text-red-800">کتابخانه هضم</h3>
                        <p class="text-sm text-red-700 mt-1">پردازش زبان فارسی در پایتون</p>
                    </a>
                    <a href="https://t.me/persiannlp" 
                       class="block p-4 bg-pink-100 rounded-lg hover:bg-pink-200 transition-colors">
                        <h3 class="font-semibold text-pink-800">کانال تلگرام Persian NLP</h3>
                        <p class="text-sm text-pink-700 mt-1">اخبار و منابع پردازش زبان فارسی</p>
                    </a>
                </div>
            </section>

            <section class="bg-gradient-to-r from-amber-600 to-orange-600 rounded-2xl p-8 text-white text-center">
                <h2 class="samim text-3xl font-bold mb-4">آماده شروع هستید؟</h2>
                <p class="text-lg mb-6 opacity-90">
                    با استفاده از این منابع، می‌توانید امروز شروع به توسعه سیستم‌های هوش مصنوعی فارسی کنید
                </p>
                <button onclick="window.open('https://huggingface.co/PersianAICommunity', '_blank')" 
                        class="bg-white text-amber-600 px-8 py-3 rounded-full font-semibold hover:bg-amber-50 transition-colors">
                    مشاهده پروژه‌های جامعه
                </button>
            </section>
        </main>

        <footer class="text-center mt-16 py-8 text-gray-600">
            <p class="tanha">ساخته‌شده با ❤️ برای جامعه فارسی‌زبان هوش مصنوعی</p>
        </footer>
    </div>

    <script src="https://unpkg.com/feather-icons"></script>
    <script>
        feather.replace();
    </script>
</body>
</html>