How Egonex Article-Analyzer Extracts Entities and Claims from Wiki Content
The Egonex article-analyzer treats wiki content as source code, converting each Markdown page into a wiki_page node and transforming declarative sentences into claim edges using Tree-Sitter parsing.
The Egonex-AI/Understand-Anything repository unifies code and documentation analysis within a single knowledge graph. The article-analyzer component ingests wiki content as Markdown, extracting structured entities and semantic claims through a pipeline that mirrors traditional static analysis techniques.
Schema Definition for Wiki Entities
The graph schema explicitly defines how wiki content integrates with the broader knowledge base. In packages/core/src/schema.ts, the system declares a wiki_page node type that represents individual wiki articles as first-class graph citizens.
The schema includes an optional wikilinks field (lines 362–364) that stores URLs of other wiki pages referenced within the article. This field creates the structural foundation for linking related concepts across the documentation corpus. Lines 62–66 of the same file establish the core property definitions that enable the graph to distinguish between code artifacts and knowledge-base entries.
Parsing Markdown with Tree-Sitter
The core extraction logic resides in packages/core/src/plugins/parsers/markdown-parser.ts, which implements a Tree-Sitter plugin for Markdown processing. The parser transforms raw wiki text into an Abstract Syntax Tree (AST), then traverses the tree using standard Tree-Sitter patterns (node.namedChildren and node.type === "link" checks) to identify three critical elements:
- Headings → Converted into entity-type nodes representing concepts or definitions
- Links (
[text](url)) → Collected into thewikilinksarray for relationship mapping - Paragraphs and list items → Scanned for declarative sentences that mention linked concepts
When the parser encounters a sentence referencing a linked concept, it flags the content for conversion into a claim edge during the graph construction phase.
Building Nodes and Claim Edges
After parsing, the graph-builder (packages/core/src/analyzer/graph-builder.ts) constructs the semantic structure. For each wiki page, the builder creates a node with type: "wiki_page", populating it with metadata extracted during the parsing phase.
For every declarative sentence identified as mentioning a linked concept, the builder creates a claim edge with type: "claims". This edge connects the source wiki page node to the target concept node. The builder delegates text normalization to packages/core/src/analyzer/normalize-graph.ts, which strips Markdown syntax and stores the cleaned claim text in the edge's label field.
The Unified Knowledge Graph
The final output combines three distinct element types within a single graph structure:
- Code nodes – Representing files, classes, and functions from source code analysis
- Wiki nodes – The
wiki_pageentities extracted from documentation - Claim edges – Semantic statements connecting wiki pages to related concepts, optionally enhanced with confidence scores from LLM-based analysis
The dashboard visualization (packages/dashboard/src/locales/en.ts line 279) describes these elements collectively as "entities and relations," presenting code and knowledge nodes within a unified interface.
Practical Implementation Example
The following TypeScript example demonstrates the core extraction workflow:
import { parseMarkdown } from '@understand-anything/core/plugins/parsers/markdown-parser';
import { buildGraph } from '@understand-anything/core/analyzer/graph-builder';
const markdown = `
# Quantum Computing
Quantum computers use **qubits**. See more at [Qubit Wiki](https://en.wikipedia.org/wiki/Qubit).
## Claim
Qubits can exist in superposition.
`;
const parsed = parseMarkdown(markdown); // → { headings, links, sentences }
const graph = buildGraph(parsed, { source: 'wiki' });
// graph now contains a "wiki_page" node for the article,
// a "wikilinks" entry with the Wikipedia URL,
// and a "claims" edge linking the article node to the concept node.
Summary
- Schema-driven extraction: The
wiki_pagenode type andwikilinksfield inpackages/core/src/schema.tsprovide the structural foundation for wiki content. - Tree-Sitter parsing: The markdown-parser converts wiki content into an AST, extracting headings as entities and links as relationship targets.
- Claim generation: The graph-builder transforms declarative sentences into
claimsedges, normalizing text vianormalize-graph.ts. - Unified representation: The system treats documentation and code as equivalent nodes within a single knowledge graph.
Frequently Asked Questions
What is the article-analyzer in Understand-Anything?
The article-analyzer is a core pipeline component within the Egonex-AI/Understand-Anything repository that processes wiki content using the same graph-based approach applied to source code. It treats each wiki page as a node and converts declarative statements into claim edges that link concepts across the knowledge base.
How does the markdown parser identify claims?
The parser scans paragraph and list item nodes from the Tree-Sitter AST for declarative sentences that reference linked concepts. When a sentence mentions a concept linked via Markdown syntax ([text](url)), the parser flags that sentence for conversion into a claim edge during the graph building phase.
What graph schema defines wiki entities?
The schema in packages/core/src/schema.ts defines the wiki_page node type (lines 62–66) and the wikilinks property (lines 362–364). These definitions enable the graph to store wiki URLs and distinguish documentation nodes from code artifacts.
Where is the claim normalization logic implemented?
Claim normalization occurs in packages/core/src/analyzer/normalize-graph.ts, which strips Markdown syntax from extracted sentences and stores the cleaned text in the label field of claim edges. This ensures that the semantic content remains readable while removing formatting artifacts.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →