linguistic-semantic-algorithms
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "linguistic-semantic-algorithms" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-01a8b7f79985c82118022796db1c4e39ac8858f69f2dc8b94265dd7f4ff8a5fd. Verify the upstream source and version against https://github.com/pproenca/dot-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
A toolkit for mapping unfamiliar codebases using NLP and graph algorithms, covering about 40 algorithms including topic modeling, semantic embeddings, code graphs, repository mining, clone detection, IR-based fault localization, identifier linguistics, and complexity metrics. Suitable for scenarios like tracing defects across files, planning new features, identifying domain entities, analyzing commit history, locating code, and assessing risky functions.
Introduction source: third_party · pproenca · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Mapping out an unfamiliar codebase via NLP and graph algorithms — 40 algorithms across topic modelling, semantic embeddings, code graphs, repository mining, clone detection, IR-based bug localization, identifier linguistics, and complexity metrics. Trigger when hunting bugs across many files, scoping a new feature, identifying domain entities, or analyzing commit history — even if the user doesn't explicitly mention algorithms — apply when they ask "where does X live in this codebase?", "what is this codebase about?", "find duplicated logic", "what changed recently?", "who owns this code?", or "is this function risky?".
- Testing
- Not tested
Browse files
Frontmatter
name: linguistic-semantic-algorithms
description: Mapping out an unfamiliar codebase via NLP and graph algorithms — 40 algorithms across topic modelling, semantic embeddings, code graphs, repository mining, clone detection, IR-based bug localization, identifier linguistics, and complexity metrics. Trigger when hunting bugs across many files, scoping a new feature, identifying domain entities, or analyzing commit history — even if the user doesn't explicitly mention algorithms — apply when they ask "where does X live in this codebase?", "what is this codebase about?", "find duplicated logic", "what changed recently?", "who owns this code?", or "is this function risky?".pproenca Linguistic and Semantic Algorithms Best Practices
Reference of 40 algorithms an agent should reach for when extracting structure, meaning, history, or risk signals from source code and commit data. Categories are ordered by insight-per-effort — how much non-obvious truth the technique exposes relative to how easy it is to apply. The first two categories target the highest-leverage questions: what business entities live in this code? and where else does this concept already exist? — questions that grep and intuition cannot answer.
When to Apply
Reach for these algorithms when:
- Orienting in an unfamiliar codebase: PageRank the import graph to find the core, run LDA over identifier tokens to discover business themes, mine change coupling to surface hidden architectural couplings.
- Hunting a bug from a description: BM25 + history prior + embedding re-rank produces a ranked file shortlist far better than grep.
- Scoping a feature: find prior PRs that did similar work via embedding similarity; map the feature's vocabulary against the codebase's domain via TF-IDF and noun-phrase mining.
- Reviewing a refactor: AST-level GumTree diff reveals semantic impact text diff hides; PDG isomorphism finds the "same logic, different code" twin you should also update.
- Auditing risk: hotspots (churn × complexity), bus factor, defect-magnet density, dead-code candidates — together they direct attention to the parts of the codebase that pay back attention.
- Identifying domain entities and bounded contexts: noun-phrase mining + TF-IDF rare-term extraction + Louvain communities + Jensen-Shannon divergence on per-cluster vocabulary.
Rule Categories by Priority
| Priority | Category | Impact | Prefix | Question answered |
|---|---|---|---|---|
| 1 | Concept & Domain Extraction | CRITICAL | concept- |
What business entities live in this code? |
| 2 | Semantic Similarity & Feature Mapping | CRITICAL | sim- |
Where else does this concept already exist? |
| 3 | Architectural Topology | HIGH | graph- |
What is the shape of this codebase? |
| 4 | Co-Change & Temporal Mining | HIGH | mine- |
What hidden couplings does history reveal? |
| 5 | Clone & Duplication Detection | MEDIUM-HIGH | clone- |
Where are we repeating ourselves? |
| 6 | Bug & Feature Localization | MEDIUM-HIGH | local- |
Given a description, where in code? |
| 7 | Identifier Linguistics | MEDIUM | ling- |
How to prepare tokens so the other algorithms work? |
| 8 | Complexity & Risk Metrics | MEDIUM | risk- |
Where is the danger concentrated? |
Quick Reference
1. Concept & Domain Extraction (CRITICAL)
concept-lda-topic-modeling— LDA over identifier tokens surfaces latent business themesconcept-noun-phrase-mining— POS-tag + chunk identifiers to extract entity candidatesconcept-tfidf-rare-terms— IDF against a generic corpus isolates domain vocabulary from framework noiseconcept-identifier-cooccurrence-network— PMI-weighted co-occurrence graph reveals conceptual neighborhoodsconcept-entity-name-resolution— Cluster name variants (user/usr/u/userAccount) via embedding + edit distanceconcept-bounded-context-detection— Louvain + Jensen-Shannon divergence detects DDD bounded contexts
2. Semantic Similarity & Feature Mapping (CRITICAL)
sim-codebert-embeddings— CodeBERT + cosine for semantic code search across renamessim-pdg-semantic-clones— Program Dependence Graph isomorphism finds Type-4 clonessim-cross-pr-feature-mapping— Embed merged PRs once, retrieve precedent at feature-design timesim-cosine-vsm-files— TF-IDF VSM file similarity when no GPU is availablesim-call-pattern-similarity— N-grams on call-sequence find behavioral twinssim-doc-code-alignment— Joint code-doc embedding flags drift between docs and code
3. Architectural Topology (HIGH)
graph-pagerank-core— PageRank the import graph to find the codebase coregraph-betweenness-bottlenecks— Betweenness centrality surfaces bottleneck modulesgraph-louvain-modules— Louvain community detection reveals natural module boundariesgraph-scc-cycle-tangles— Tarjan's SCC algorithm exposes circular-dependency tanglesgraph-feedback-arcs— Eades-Lin-Smyth FAS chooses the smallest cycle-breaking cut
4. Co-Change & Temporal Mining (HIGH)
mine-change-coupling— Conditional probability over commit history exposes hidden couplingmine-hotspots-churn-complexity— Churn × complexity = canonical hotspot score (Tornhill)mine-bus-factor— Per-file authorship Gini coefficient surfaces knowledge concentrationmine-commit-topic-modeling— LDA on commit messages reveals quarterly themesmine-bug-fix-density— Classify commits, rank files by fix-density to find defect magnetsmine-codebase-aging— Last-modified age + reachability splits stable code from dead code
5. Clone & Duplication Detection (MEDIUM-HIGH)
clone-minhash-lsh— MinHash + LSH for sub-linear near-duplicate retrievalclone-simhash— SimHash 64-bit fingerprints for O(1) Hamming-distance lookupsclone-suffix-array-cpd— Token-level suffix array (PMD CPD) for precise clone boundariesclone-ast-gumtree— GumTree algorithm for fine-grained AST differencingclone-zhang-shasha-ted— Zhang-Shasha tree edit distance for exact subtree similarity
6. Bug & Feature Localization (MEDIUM-HIGH)
local-tfidf-bug-reports— TF-IDF rank source files against bug report tokenslocal-bm25-saturation— BM25 handles length normalization and TF saturationlocal-history-prior-localization— Bayesian fusion of IR score with bug-history priorlocal-embedding-bug-text— Two-stage BM25 + embedding re-rank for semantic localization
7. Identifier Linguistics (MEDIUM)
ling-camel-snake-split— Split camelCase, snake_case, digit-boundaries before any analysisling-abbreviation-expansion— Expandidx→index,mgr→managervia dictionary + miningling-porter-stemming— Apply Porter stemmer to unify singular/plural formsling-pos-tagging-identifiers— POS-tag identifier heads to flag misnamed functions/classes
8. Complexity & Risk Metrics (MEDIUM)
risk-cyclomatic-mccabe— McCabe cyclomatic complexity for branch-test surfacerisk-cognitive-complexity— SonarSource Cognitive Complexity for readability gatesrisk-halstead-volume— Halstead volume for language-agnostic size and effortrisk-shannon-entropy-naming— Per-token entropy flags overloaded names
How to Use
Pick the category that matches the user's question, then read one or two specific rules from that category. Most rules cite combinable partners ("Combine with mine-change-coupling...") that compound the signal — read the partner rule when you need higher precision.
For unfamiliar repos, the highest-ROI starting sequence is:
graph-pagerank-core→ read the top-20 most central filesconcept-lda-topic-modeling+concept-tfidf-rare-terms→ identify the business themesmine-hotspots-churn-complexity→ find where the bugs concentratemine-change-coupling→ uncover hidden architectural couplings
For a single-task bug or feature, the pipeline is:
local-bm25-saturation(broad candidates) →local-embedding-bug-text(semantic re-rank) →local-history-prior-localization(fix-history boost)sim-cross-pr-feature-mappingfor prior precedent on new featuresmine-change-couplingto surface partner files that historically move together
Always preprocess identifier tokens via ling-camel-snake-split → ling-abbreviation-expansion → ling-porter-stemming before any vocabulary-based algorithm. Skipping this step silently degrades every downstream signal.
Cross-language parsing. Most rule code examples use Python's built-in ast module for brevity. For real cross-language work (Go, Rust, Java, TS, C++ in the same repo), use tree-sitter — it provides robust parsers for 40+ languages with a uniform API. Every AST-based rule in this skill (PDG clones, GumTree, Zhang-Shasha, POS-tag heads, identifier co-occurrence) maps cleanly onto tree-sitter ASTs.
Reference Files
| File | Description |
|---|---|
| references/_sections.md | Category definitions and impact ordering |
| assets/templates/_template.md | Template for adding new algorithm rules |
| metadata.json | Version and reference information |
Current listing version
0.0.1
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 覆盖代码库语义分析、缺陷定位、架构拓扑、克隆检测等开发者高频刚需场景
- 提供40种算法并按洞察效率排序,显著提升跨文件排查与功能规划效率
Highlights
- 触发词覆盖多种自然语言查询变体(如'where does X live'、'find duplicated logic')
- 边界清晰,无歧义或与其他Skill重叠风险
Highlights
- 结构清晰:含应用场景、算法分类、快速参考、使用指南等完整章节
- 提供端到端示例(如四步启动序列)和预处理最佳实践
Areas to improve
-
引用文件完整性未验证 Reported severity: Minor
Skill 引用了 references/ 目录下多个 .md 文件(如 concept-lda-topic-modeling.md),但未确认这些文件是否真实存在于 ZIP 包中
Recommendation: 请确保所有被引用的参考文件(references/*.md、assets/templates/_template.md、metadata.json)均完整打包,避免用户执行时出现缺失依赖
Highlights
- 算法工具来源明确(CodeBERT、tree-sitter、GumTree等)
- 强调标识符预处理流程(ling-*系列)以提升下游信号质量
- 提供跨语言解析方案(tree-sitter)支持多语言代码库
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- tree-sitter.github.io
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.