compromise
ما الذي تفعله
يشرح كيفية استخدام صيغة المطابقة والتحديدات والإضافات في compromise للعمل على الجمل الإنجليزية. وهي مناسبة للمطورين الذين يستخدمون شيفرة compromise أو يصلحونها.
متى تستخدمها
- ✓عندما تستخدم مكتبة compromise وتحتاج إلى الطريقة المناسبة لمهمة ما.
- ✓عندما تكتب أنماط مطابقة لإيجاد كلمات أو عبارات في نص.
- ✓عندما تحتاج إلى اختيار إصدار استيراد لـ compromise أو إضافة إضافة.
رابط المهارة
https://github.com/spencermountain/compromise/blob/master/skills/compromise/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“أي طريقة compromise يجب أن أستخدم لاستخراج كل التواريخ والأرقام من هذا النص؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يفحص الوكيل الإصدار المثبت ونوع البناء، ثم يختار الطريقة أو النمط المناسب ويشرح ما ستحتويه النتيجة.
المحتوى التقني (ملف SKILL.md الأصلي)
النص الأصلي من المؤلف، مباشرة من GitHub.
Using compromise
Compromise is a rule-based English NLP library that runs locally in Node.js and browsers. Its tagging and transformations are heuristic; it does not provide a dependency parse tree, semantic understanding, or an LLM service.
Choose the API for the installed version
Inspect the project's compromise version, import, and registered plugins before choosing APIs.
Prefer the full import nlp from 'compromise' for ordinary use:
| Import | Available features |
|---|---|
compromise or compromise/three |
Tokenization, tagging, named selections and transforms |
compromise/two |
Tokenization and tagging; no .people(), .verbs(), or .numbers() |
compromise/one or compromise/tokenize |
Tokenization; no automatic part-of-speech tagging |
Use the existing module system; CommonJS can use const nlp = require('compromise').
If a method is missing, check the build tier, version, and plugins before inventing a replacement API.
Specialized transforms belong on specialized selections: use .verbs().toPastTense(),
not .match('#Verb').toPastTense().
Read only the detailed docs needed for the task. These paths resolve inside this repository
and packages that ship this skill alongside docs/:
- API: method names, arguments, and specialized selection methods.
- Match syntax: pattern operators and capture groups.
- Tag definitions: valid tags and their hierarchy.
- Concepts: document, View, Term, and mutation semantics.
- Recipes: task-specific starting points.
- Tagging differences: conventions when comparing other taggers.
If this skill was installed separately, look for these files in the consuming project's
node_modules/compromise/docs/ or its resolved package directory. If unavailable, consult the
upstream repository at the installed version's
tag when available. Do not assume the latest docs describe an older installed version.
When docs and behavior disagree, reproduce against that version and inspect its source/types.
Keep the document and selection distinct
nlp(text) returns a View of the whole document. Selections return Views sharing that document.
Transforms mutate the shared document; reading .text() from a selection gives only that fragment.
Keep the whole-document variable when the requested output is the rewritten input:
import nlp from 'compromise'
const original = nlp('She walks home.')
const past = original.clone()
past.verbs().toPastTense()
past.text() // 'She walked home.'
original.text() // 'She walks home.'
Clone before transforming when the original must be preserved. Cloning a selection does not
turn it into a whole-document selection. .all() returns a View of the whole underlying document.
.match(pattern)extracts matching terms;.has(pattern)returns a boolean..if(pattern)filters the current phrases, retaining each whole phrase containing a match. Use.sentences().if(pattern)to retain matching sentences..foundis a boolean property, not a method. An empty View is still a truthy JavaScript object..replace(from, to)finds a pattern and replaces it;.replaceWith(to)replaces the selection..text()returns a string;.out('array')returns strings per match;.json()returns structured records. These are outputs, not chainable Views.- Text outputs can preserve case and punctuation.
.text('normal')is not a universal punctuation stripper. Choose and verify normalization for the requested output rather than stripping blindly.
Write term patterns, not character regexes
Patterns operate on tokenized terms within each sentence. Literal words match case-insensitively;
use {walk} to include inflections such as walked. Use real tag names: #Person, #Place,
#Organization, #Noun, #Verb, #Adjective, #Value, and #Date are useful starting points.
Tags form a hierarchy, so #FirstName also matches #Person and #Noun.
Unknown tags silently match nothing unless explicitly defined by an extension.
Do not invent tags such as #Name, #Location, #Subject, #Object, or #Adj.
| Pattern | Meaning |
|---|---|
#Adjective+ #Noun |
One or more adjective terms followed by a noun |
the big? cat |
Optional big term |
(cat|dog) |
Alternatives |
| `the . |
الأسئلة الشائعة
أي إصدار من compromise أحتاج؟
تقول المهارة إن عليك التحقق من الإصدار المثبت في المشروع ونمط الاستيراد قبل اختيار الطرق.
ماذا لو كانت طريقة غير موجودة؟
تنصح بفحص مستوى البناء والإصدار والإضافات قبل تجربة طريقة أخرى.
هل تقوم بتحليل الاعتماديات؟
لا. تنبه إلى أن compromise لا توفر أشجار تحليل الاعتماديات ولا الفهم الدلالي.
التفاصيل
الوصف الأصلي من المؤلف
Write and debug JavaScript or TypeScript that uses the compromise English NLP library to match text, extract entities or numbers, customize tagging, and transform sentences. Use when the user requests compromise or the project already uses it, especially for its match syntax, selection semantics, build tiers, and plugins.
الشعبية
- نجوم GitHub
- 12k
- الترتيب
- #11472
- الترخيص
- MIT
- آخر تحديث
- 30/10/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
مهارات مشابهة
diffs
394kيتيح لوكيلك إنتاج فرق تعديلات حقيقي يمكن مشاركته، كرابط عرض أو ملف صورة، بدلاً من ملخص مكتوب يدوياً.
coding-agent
394kيساعد وكيلك على تسليم مهمة برمجة كبيرة إلى Codex أو Claude Code أو OpenCode كعامل في الخلفية، ثم متابعة تقدمها.
gh-issues
394kيساعد وكيلك على إيجاد مشكلات GitHub واختيار ما ستعمل عليه، وفتح طلبات سحب بالإصلاحات، ومتابعة تعليقات المراجعة.