Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Instruções da origem · Visualização somente leitura
name
arabic-nlp-pipeline
name_ar
خط معالجة اللغة الطبيعية
description
Build Arabic NLP preprocessing pipelines with comprehensive documentation
description_ar
بناء خطوط معالجة اللغة الطبيعية العربية مع توثيق شامل
category
developer
language
ar
dialect
msa
rtl
true
platform_claude
true
platform_gpt
true
platform_qwen
true
platform_jais
true
platform_falcon
true
platform_allam
true
compliance
[]
version
1.0.0
author
salman-shaikh
contributor_volunteer
true
الهدف (Purpose)
يساعد هذه المهارة في بناء خطوط معالجة اللغة الطبيعية (NLP Pipelines) للغة العربية مع توثيق شامل، يتضمن التطبيع، التجزئة (Tokenization)، إزالة stopwords، والتشكيل، مع دعم اللهجات العربية المختلفة.
defremove_stopwords(tokens, custom_stopwords=None):
stopwords = set(ARABIC_STOPWORDS)
if custom_stopwords:
stopwords.update(custom_stopwords)
return [t for t in tokens if t notin stopwords]
٦. التجذيع (Stemming/Lemmatization)
٦.١ الجذاعة vs اللممة
النوع
الوصف
مثال
Stemming
إزالة اللواحق والزوائد
"ويكتبون" → "كتب"
Lemmatization
إرجاع للأصل المعجمي
"ويكتبون" → "كتب" (فعل)
٦.٢ الكود
from camel_tools.morphology import analyzer
deflemmatize_arabic(tokens):
lemmas = []
for token in tokens:
# استخدام CAMeL Tools لللممة
analysis = analyzer.analyze(token)
if analysis:
lemmas.append(analysis[0].lemma)
else:
lemmas.append(token)
return lemmas
٧. خط المعالجة الكامل
٧.١ الكود الكامل
classArabicNLPipeline:
def__init__(self, config=None):
self.config = config or {
'normalize': True,
'clean': True,
'remove_tashkeel': True,
'remove_stopwords': True,
'lemmatize': False,
'dialect': 'all'
}
defprocess(self, text):
ifself.config['clean']:
text = clean_arabic_text(text)
ifself.config['normalize']:
text = normalize_arabic(text)
ifself.config['remove_tashkeel']:
text = remove_tashkeel(text)
tokens = tokenize_arabic(text)
ifself.config['remove_stopwords']:
tokens = remove_stopwords(tokens)
ifself.config['lemmatize']:
tokens = lemmatize_arabic(tokens)
return tokens
defprocess_batch(self, texts):
return [self.process(t) for t in texts]