@wanshi-kg/wanshi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +458 -0
- package/dist/__tests__/helpers.js +27 -0
- package/dist/__tests__/helpers.js.map +1 -0
- package/dist/cli/commands/export.command.js +99 -0
- package/dist/cli/commands/export.command.js.map +1 -0
- package/dist/cli/commands/index.js +22 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/inspectMerges.command.js +84 -0
- package/dist/cli/commands/inspectMerges.command.js.map +1 -0
- package/dist/cli/commands/metrics.command.js +196 -0
- package/dist/cli/commands/metrics.command.js.map +1 -0
- package/dist/cli/commands/process.command.js +82 -0
- package/dist/cli/commands/process.command.js.map +1 -0
- package/dist/cli/commands/watch.command.js +91 -0
- package/dist/cli/commands/watch.command.js.map +1 -0
- package/dist/cli/index.js +269 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/optionsToConfig.js +160 -0
- package/dist/cli/optionsToConfig.js.map +1 -0
- package/dist/config/index.js +59 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/legacyHints.js +113 -0
- package/dist/config/legacyHints.js.map +1 -0
- package/dist/config/schema.js +803 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/ui.js +221 -0
- package/dist/config/ui.js.map +1 -0
- package/dist/core/DirectoryProcessor.js +725 -0
- package/dist/core/DirectoryProcessor.js.map +1 -0
- package/dist/core/adapters/IStructuredAdapter.js +3 -0
- package/dist/core/adapters/IStructuredAdapter.js.map +1 -0
- package/dist/core/adapters/SqliteAdapter.js +267 -0
- package/dist/core/adapters/SqliteAdapter.js.map +1 -0
- package/dist/core/adapters/StructuredAdapterRegistry.js +31 -0
- package/dist/core/adapters/StructuredAdapterRegistry.js.map +1 -0
- package/dist/core/adapters/index.js +20 -0
- package/dist/core/adapters/index.js.map +1 -0
- package/dist/core/checkpoint/CheckpointService.js +188 -0
- package/dist/core/checkpoint/CheckpointService.js.map +1 -0
- package/dist/core/checkpoint/index.js +18 -0
- package/dist/core/checkpoint/index.js.map +1 -0
- package/dist/core/corpus/CorpusAnalyzer.js +266 -0
- package/dist/core/corpus/CorpusAnalyzer.js.map +1 -0
- package/dist/core/corpus/CorpusProfileStore.js +92 -0
- package/dist/core/corpus/CorpusProfileStore.js.map +1 -0
- package/dist/core/corpus/index.js +21 -0
- package/dist/core/corpus/index.js.map +1 -0
- package/dist/core/corpus/normalizeGlossary.js +60 -0
- package/dist/core/corpus/normalizeGlossary.js.map +1 -0
- package/dist/core/corpus/relPath.js +52 -0
- package/dist/core/corpus/relPath.js.map +1 -0
- package/dist/core/corpus/termFrequency.js +86 -0
- package/dist/core/corpus/termFrequency.js.map +1 -0
- package/dist/core/cost/CostMeter.js +235 -0
- package/dist/core/cost/CostMeter.js.map +1 -0
- package/dist/core/cost/index.js +19 -0
- package/dist/core/cost/index.js.map +1 -0
- package/dist/core/cost/prices.js +38 -0
- package/dist/core/cost/prices.js.map +1 -0
- package/dist/core/cv/ObjectDetectionService.js +119 -0
- package/dist/core/cv/ObjectDetectionService.js.map +1 -0
- package/dist/core/di/ContainerFactory.js +670 -0
- package/dist/core/di/ContainerFactory.js.map +1 -0
- package/dist/core/di/DIContainer.js +103 -0
- package/dist/core/di/DIContainer.js.map +1 -0
- package/dist/core/di/index.js +19 -0
- package/dist/core/di/index.js.map +1 -0
- package/dist/core/errors/CustomErrors.js +342 -0
- package/dist/core/errors/CustomErrors.js.map +1 -0
- package/dist/core/errors/index.js +18 -0
- package/dist/core/errors/index.js.map +1 -0
- package/dist/core/export/KnowledgeGraphExportService.js +56 -0
- package/dist/core/export/KnowledgeGraphExportService.js.map +1 -0
- package/dist/core/export/index.js +19 -0
- package/dist/core/export/index.js.map +1 -0
- package/dist/core/export/strategies/GraphitiExportStrategy.js +115 -0
- package/dist/core/export/strategies/GraphitiExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/GraphvizDotExportStrategy.js +331 -0
- package/dist/core/export/strategies/GraphvizDotExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/IExportStrategy.js +3 -0
- package/dist/core/export/strategies/IExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/JsonExportStrategy.js +19 -0
- package/dist/core/export/strategies/JsonExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/JsonlExportStrategy.js +69 -0
- package/dist/core/export/strategies/JsonlExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/KblamExportStrategy.js +36 -0
- package/dist/core/export/strategies/KblamExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/LoraExportStrategy.js +46 -0
- package/dist/core/export/strategies/LoraExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/McpExportStrategy.js +67 -0
- package/dist/core/export/strategies/McpExportStrategy.js.map +1 -0
- package/dist/core/export/strategies/index.js +25 -0
- package/dist/core/export/strategies/index.js.map +1 -0
- package/dist/core/export/strategies/kbTriples.js +60 -0
- package/dist/core/export/strategies/kbTriples.js.map +1 -0
- package/dist/core/index.js +22 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/knowledge/KnowledgeGraphBuilder.js +627 -0
- package/dist/core/knowledge/KnowledgeGraphBuilder.js.map +1 -0
- package/dist/core/knowledge/MergeRecord.js +3 -0
- package/dist/core/knowledge/MergeRecord.js.map +1 -0
- package/dist/core/knowledge/canon/Canonicalizer.js +414 -0
- package/dist/core/knowledge/canon/Canonicalizer.js.map +1 -0
- package/dist/core/knowledge/canon/index.js +18 -0
- package/dist/core/knowledge/canon/index.js.map +1 -0
- package/dist/core/knowledge/contradiction/HeuristicContradictionChecker.js +92 -0
- package/dist/core/knowledge/contradiction/HeuristicContradictionChecker.js.map +1 -0
- package/dist/core/knowledge/contradiction/LlmContradictionChecker.js +52 -0
- package/dist/core/knowledge/contradiction/LlmContradictionChecker.js.map +1 -0
- package/dist/core/knowledge/contradiction/index.js +19 -0
- package/dist/core/knowledge/contradiction/index.js.map +1 -0
- package/dist/core/knowledge/grounding/KeywordGroundingChecker.js +33 -0
- package/dist/core/knowledge/grounding/KeywordGroundingChecker.js.map +1 -0
- package/dist/core/knowledge/grounding/MiniCheckGroundingChecker.js +82 -0
- package/dist/core/knowledge/grounding/MiniCheckGroundingChecker.js.map +1 -0
- package/dist/core/knowledge/grounding/index.js +20 -0
- package/dist/core/knowledge/grounding/index.js.map +1 -0
- package/dist/core/knowledge/grounding/verbalize.js +38 -0
- package/dist/core/knowledge/grounding/verbalize.js.map +1 -0
- package/dist/core/knowledge/images/imageMetaGraph.js +136 -0
- package/dist/core/knowledge/images/imageMetaGraph.js.map +1 -0
- package/dist/core/knowledge/index.js +20 -0
- package/dist/core/knowledge/index.js.map +1 -0
- package/dist/core/knowledge/merging/KnowledgeMerger.js +624 -0
- package/dist/core/knowledge/merging/KnowledgeMerger.js.map +1 -0
- package/dist/core/knowledge/references/ReferenceResolver.js +184 -0
- package/dist/core/knowledge/references/ReferenceResolver.js.map +1 -0
- package/dist/core/knowledge/references/citations/CitationEvidenceProcessor.js +401 -0
- package/dist/core/knowledge/references/citations/CitationEvidenceProcessor.js.map +1 -0
- package/dist/core/knowledge/references/citations/CitationResolver.js +95 -0
- package/dist/core/knowledge/references/citations/CitationResolver.js.map +1 -0
- package/dist/core/knowledge/references/citations/GrobidClient.js +143 -0
- package/dist/core/knowledge/references/citations/GrobidClient.js.map +1 -0
- package/dist/core/knowledge/references/citations/TitleIdResolver.js +101 -0
- package/dist/core/knowledge/references/citations/TitleIdResolver.js.map +1 -0
- package/dist/core/knowledge/references/web/FetchCacheService.js +114 -0
- package/dist/core/knowledge/references/web/FetchCacheService.js.map +1 -0
- package/dist/core/knowledge/references/web/GatedFetcher.js +228 -0
- package/dist/core/knowledge/references/web/GatedFetcher.js.map +1 -0
- package/dist/core/knowledge/references/web/WebReferenceProcessor.js +164 -0
- package/dist/core/knowledge/references/web/WebReferenceProcessor.js.map +1 -0
- package/dist/core/knowledge/search/KnowledgeGraphSearch.js +261 -0
- package/dist/core/knowledge/search/KnowledgeGraphSearch.js.map +1 -0
- package/dist/core/knowledge/vocabulary.js +162 -0
- package/dist/core/knowledge/vocabulary.js.map +1 -0
- package/dist/core/llm/EmbeddingService.js +113 -0
- package/dist/core/llm/EmbeddingService.js.map +1 -0
- package/dist/core/llm/OllamaService.js +146 -0
- package/dist/core/llm/OllamaService.js.map +1 -0
- package/dist/core/llm/OpenAICompatibleService.js +190 -0
- package/dist/core/llm/OpenAICompatibleService.js.map +1 -0
- package/dist/core/llm/OpenAIEmbeddingService.js +129 -0
- package/dist/core/llm/OpenAIEmbeddingService.js.map +1 -0
- package/dist/core/llm/embeddingUtils.js +25 -0
- package/dist/core/llm/embeddingUtils.js.map +1 -0
- package/dist/core/llm/index.js +23 -0
- package/dist/core/llm/index.js.map +1 -0
- package/dist/core/llm/prompts/PromptManager.js +388 -0
- package/dist/core/llm/prompts/PromptManager.js.map +1 -0
- package/dist/core/llm/prompts/PromptTemplateEngine.js +257 -0
- package/dist/core/llm/prompts/PromptTemplateEngine.js.map +1 -0
- package/dist/core/llm/prompts/templates/partials/examples/EXAMPLE_STYLE_GUIDE.md +84 -0
- package/dist/core/llm/prompts/templates/partials/examples/article.md +187 -0
- package/dist/core/llm/prompts/templates/partials/examples/code.md +229 -0
- package/dist/core/llm/prompts/templates/partials/examples/communication.md +205 -0
- package/dist/core/llm/prompts/templates/partials/examples/documentation.md +262 -0
- package/dist/core/llm/prompts/templates/partials/examples/financial.md +157 -0
- package/dist/core/llm/prompts/templates/partials/examples/legal.md +153 -0
- package/dist/core/llm/prompts/templates/partials/examples/logs.md +127 -0
- package/dist/core/llm/prompts/templates/partials/examples/medical.md +218 -0
- package/dist/core/llm/prompts/templates/partials/examples/notes.md +201 -0
- package/dist/core/llm/prompts/templates/partials/examples/research.md +208 -0
- package/dist/core/llm/prompts/templates/partials/examples/tabular.md +178 -0
- package/dist/core/llm/prompts/templates/partials/examples/transcript.md +204 -0
- package/dist/core/llm/prompts/templates/partials/retrieved-context.hbs +18 -0
- package/dist/core/llm/prompts/templates/v1/system.hbs +371 -0
- package/dist/core/llm/prompts/templates/v1/user.hbs +20 -0
- package/dist/core/llm/prompts/templates/v2/system.hbs +573 -0
- package/dist/core/llm/prompts/templates/v2/user.hbs +20 -0
- package/dist/core/llm/prompts/templates/v3/system.hbs +861 -0
- package/dist/core/llm/prompts/templates/v3/user.hbs +16 -0
- package/dist/core/llm/prompts/templates/v4/system.hbs +800 -0
- package/dist/core/llm/prompts/templates/v4/user.hbs +40 -0
- package/dist/core/llm/prompts/templates/v4.5/system.hbs +71 -0
- package/dist/core/llm/prompts/templates/v4.5/user.hbs +46 -0
- package/dist/core/llm/prompts/templates/v5/glossary/system.hbs +40 -0
- package/dist/core/llm/prompts/templates/v5/glossary/user.hbs +11 -0
- package/dist/core/llm/prompts/templates/v5/system.hbs +163 -0
- package/dist/core/llm/prompts/templates/v5/user.hbs +55 -0
- package/dist/core/pipeline/GroundingTransform.js +52 -0
- package/dist/core/pipeline/GroundingTransform.js.map +1 -0
- package/dist/core/pipeline/PipelineRunner.js +51 -0
- package/dist/core/pipeline/PipelineRunner.js.map +1 -0
- package/dist/core/pipeline/RelationFilterTransform.js +72 -0
- package/dist/core/pipeline/RelationFilterTransform.js.map +1 -0
- package/dist/core/pipeline/index.js +20 -0
- package/dist/core/pipeline/index.js.map +1 -0
- package/dist/core/processor/FileProcessor.js +184 -0
- package/dist/core/processor/FileProcessor.js.map +1 -0
- package/dist/core/processor/ProcessedRegistry.js +38 -0
- package/dist/core/processor/ProcessedRegistry.js.map +1 -0
- package/dist/core/processor/ast/AstSeedService.js +0 -0
- package/dist/core/processor/ast/AstSeedService.js.map +1 -0
- package/dist/core/processor/ast/AstSymbolStore.js +110 -0
- package/dist/core/processor/ast/AstSymbolStore.js.map +1 -0
- package/dist/core/processor/ast/index.js +19 -0
- package/dist/core/processor/ast/index.js.map +1 -0
- package/dist/core/processor/chunking/TextChunker.js +98 -0
- package/dist/core/processor/chunking/TextChunker.js.map +1 -0
- package/dist/core/processor/chunking/index.js +18 -0
- package/dist/core/processor/chunking/index.js.map +1 -0
- package/dist/core/processor/classifier/CONTENT_CLASSES.js +294 -0
- package/dist/core/processor/classifier/CONTENT_CLASSES.js.map +1 -0
- package/dist/core/processor/classifier/CascadeContentClassifier.js +107 -0
- package/dist/core/processor/classifier/CascadeContentClassifier.js.map +1 -0
- package/dist/core/processor/classifier/HeuristicContentClassifier.js +113 -0
- package/dist/core/processor/classifier/HeuristicContentClassifier.js.map +1 -0
- package/dist/core/processor/classifier/IContentTypeClassifier.js +3 -0
- package/dist/core/processor/classifier/IContentTypeClassifier.js.map +1 -0
- package/dist/core/processor/classifier/LlmContentClassifier.js +107 -0
- package/dist/core/processor/classifier/LlmContentClassifier.js.map +1 -0
- package/dist/core/processor/classifier/NER_DOMAIN_EXAMPLES.js +498 -0
- package/dist/core/processor/classifier/NER_DOMAIN_EXAMPLES.js.map +1 -0
- package/dist/core/processor/classifier/index.js +21 -0
- package/dist/core/processor/classifier/index.js.map +1 -0
- package/dist/core/processor/classifier/mergeClassifications.js +32 -0
- package/dist/core/processor/classifier/mergeClassifications.js.map +1 -0
- package/dist/core/processor/index.js +20 -0
- package/dist/core/processor/index.js.map +1 -0
- package/dist/core/processor/readers/AudioReader.js +462 -0
- package/dist/core/processor/readers/AudioReader.js.map +1 -0
- package/dist/core/processor/readers/BinaryReader.js +90 -0
- package/dist/core/processor/readers/BinaryReader.js.map +1 -0
- package/dist/core/processor/readers/ChandraPdfReader.js +187 -0
- package/dist/core/processor/readers/ChandraPdfReader.js.map +1 -0
- package/dist/core/processor/readers/ChatExportReader.js +365 -0
- package/dist/core/processor/readers/ChatExportReader.js.map +1 -0
- package/dist/core/processor/readers/DoclingReader.js +445 -0
- package/dist/core/processor/readers/DoclingReader.js.map +1 -0
- package/dist/core/processor/readers/EmailReader.js +259 -0
- package/dist/core/processor/readers/EmailReader.js.map +1 -0
- package/dist/core/processor/readers/EpubReader.js +175 -0
- package/dist/core/processor/readers/EpubReader.js.map +1 -0
- package/dist/core/processor/readers/FileReader.js +90 -0
- package/dist/core/processor/readers/FileReader.js.map +1 -0
- package/dist/core/processor/readers/FileReaderFactory.js +49 -0
- package/dist/core/processor/readers/FileReaderFactory.js.map +1 -0
- package/dist/core/processor/readers/HtmlReader.js +371 -0
- package/dist/core/processor/readers/HtmlReader.js.map +1 -0
- package/dist/core/processor/readers/ImageReader.js +162 -0
- package/dist/core/processor/readers/ImageReader.js.map +1 -0
- package/dist/core/processor/readers/JsonFileReader.js +232 -0
- package/dist/core/processor/readers/JsonFileReader.js.map +1 -0
- package/dist/core/processor/readers/JupyterReader.js +178 -0
- package/dist/core/processor/readers/JupyterReader.js.map +1 -0
- package/dist/core/processor/readers/LatexReader.js +176 -0
- package/dist/core/processor/readers/LatexReader.js.map +1 -0
- package/dist/core/processor/readers/MarkdownReader.js +289 -0
- package/dist/core/processor/readers/MarkdownReader.js.map +1 -0
- package/dist/core/processor/readers/MarkerPdfReader.js +193 -0
- package/dist/core/processor/readers/MarkerPdfReader.js.map +1 -0
- package/dist/core/processor/readers/MistralOcrReader.js +198 -0
- package/dist/core/processor/readers/MistralOcrReader.js.map +1 -0
- package/dist/core/processor/readers/OfficeReader.js +174 -0
- package/dist/core/processor/readers/OfficeReader.js.map +1 -0
- package/dist/core/processor/readers/PdfReader.js +116 -0
- package/dist/core/processor/readers/PdfReader.js.map +1 -0
- package/dist/core/processor/readers/RtfReader.js +107 -0
- package/dist/core/processor/readers/RtfReader.js.map +1 -0
- package/dist/core/processor/readers/SubtitleReader.js +145 -0
- package/dist/core/processor/readers/SubtitleReader.js.map +1 -0
- package/dist/core/processor/readers/TesseractPdfReader.js +183 -0
- package/dist/core/processor/readers/TesseractPdfReader.js.map +1 -0
- package/dist/core/processor/readers/TextReader.js +129 -0
- package/dist/core/processor/readers/TextReader.js.map +1 -0
- package/dist/core/processor/readers/TranscriptReader.js +234 -0
- package/dist/core/processor/readers/TranscriptReader.js.map +1 -0
- package/dist/core/processor/readers/image/imageMetadata.js +155 -0
- package/dist/core/processor/readers/image/imageMetadata.js.map +1 -0
- package/dist/core/processor/readers/index.js +41 -0
- package/dist/core/processor/readers/index.js.map +1 -0
- package/dist/core/processor/readers/referenceExtraction.js +198 -0
- package/dist/core/processor/readers/referenceExtraction.js.map +1 -0
- package/dist/core/processor/readers/stripReferences.js +59 -0
- package/dist/core/processor/readers/stripReferences.js.map +1 -0
- package/dist/core/processor/readers/transcript/turnPacking.js +81 -0
- package/dist/core/processor/readers/transcript/turnPacking.js.map +1 -0
- package/dist/core/progress/NdjsonProgressEmitter.js +30 -0
- package/dist/core/progress/NdjsonProgressEmitter.js.map +1 -0
- package/dist/core/progress/NoopProgressEmitter.js +15 -0
- package/dist/core/progress/NoopProgressEmitter.js.map +1 -0
- package/dist/core/progress/index.js +19 -0
- package/dist/core/progress/index.js.map +1 -0
- package/dist/core/trace/TraceWriter.js +100 -0
- package/dist/core/trace/TraceWriter.js.map +1 -0
- package/dist/core/trace/events.js +13 -0
- package/dist/core/trace/events.js.map +1 -0
- package/dist/core/trace/index.js +20 -0
- package/dist/core/trace/index.js.map +1 -0
- package/dist/core/trace/lineage.js +97 -0
- package/dist/core/trace/lineage.js.map +1 -0
- package/dist/evaluation/BenchmarkRunner.js +171 -0
- package/dist/evaluation/BenchmarkRunner.js.map +1 -0
- package/dist/evaluation/classifier/ClassifierAccuracy.js +185 -0
- package/dist/evaluation/classifier/ClassifierAccuracy.js.map +1 -0
- package/dist/evaluation/classifier/labeledSamples.js +379 -0
- package/dist/evaluation/classifier/labeledSamples.js.map +1 -0
- package/dist/evaluation/compare/goldCompare.js +126 -0
- package/dist/evaluation/compare/goldCompare.js.map +1 -0
- package/dist/evaluation/crossre/compareScoring.js +30 -0
- package/dist/evaluation/crossre/compareScoring.js.map +1 -0
- package/dist/evaluation/datasets/CrossREDataset.js +170 -0
- package/dist/evaluation/datasets/CrossREDataset.js.map +1 -0
- package/dist/evaluation/datasets/IDataset.js +3 -0
- package/dist/evaluation/datasets/IDataset.js.map +1 -0
- package/dist/evaluation/datasets/RebelDataset.js +117 -0
- package/dist/evaluation/datasets/RebelDataset.js.map +1 -0
- package/dist/evaluation/datasets/RedocredDataset.js +218 -0
- package/dist/evaluation/datasets/RedocredDataset.js.map +1 -0
- package/dist/evaluation/datasets/SemEval2010Dataset.js +150 -0
- package/dist/evaluation/datasets/SemEval2010Dataset.js.map +1 -0
- package/dist/evaluation/index.js +33 -0
- package/dist/evaluation/index.js.map +1 -0
- package/dist/evaluation/matching/ExactMatcher.js +75 -0
- package/dist/evaluation/matching/ExactMatcher.js.map +1 -0
- package/dist/evaluation/matching/SemanticMatcher.js +143 -0
- package/dist/evaluation/matching/SemanticMatcher.js.map +1 -0
- package/dist/evaluation/metrics/TripleMetrics.js +64 -0
- package/dist/evaluation/metrics/TripleMetrics.js.map +1 -0
- package/dist/evaluation/mine/MineCheckpoint.js +114 -0
- package/dist/evaluation/mine/MineCheckpoint.js.map +1 -0
- package/dist/evaluation/mine/MineDataset.js +208 -0
- package/dist/evaluation/mine/MineDataset.js.map +1 -0
- package/dist/evaluation/mine/MineReporter.js +98 -0
- package/dist/evaluation/mine/MineReporter.js.map +1 -0
- package/dist/evaluation/mine/MineRunner.js +148 -0
- package/dist/evaluation/mine/MineRunner.js.map +1 -0
- package/dist/evaluation/mine/MineScorer.js +127 -0
- package/dist/evaluation/mine/MineScorer.js.map +1 -0
- package/dist/evaluation/mine/types.js +12 -0
- package/dist/evaluation/mine/types.js.map +1 -0
- package/dist/evaluation/reporters/ConsoleReporter.js +55 -0
- package/dist/evaluation/reporters/ConsoleReporter.js.map +1 -0
- package/dist/evaluation/reporters/JsonReporter.js +50 -0
- package/dist/evaluation/reporters/JsonReporter.js.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/quality/CompositeScore.js +61 -0
- package/dist/quality/CompositeScore.js.map +1 -0
- package/dist/quality/ConsistencyMetrics.js +70 -0
- package/dist/quality/ConsistencyMetrics.js.map +1 -0
- package/dist/quality/FactualMetrics.js +76 -0
- package/dist/quality/FactualMetrics.js.map +1 -0
- package/dist/quality/GraphHealthMetrics.js +68 -0
- package/dist/quality/GraphHealthMetrics.js.map +1 -0
- package/dist/quality/SemanticMetrics.js +102 -0
- package/dist/quality/SemanticMetrics.js.map +1 -0
- package/dist/quality/StructuralMetrics.js +60 -0
- package/dist/quality/StructuralMetrics.js.map +1 -0
- package/dist/quality/index.js +23 -0
- package/dist/quality/index.js.map +1 -0
- package/dist/shared/index.js +20 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/logger/Logger.js +3 -0
- package/dist/shared/logger/Logger.js.map +1 -0
- package/dist/shared/logger/LoggerFactory.js +75 -0
- package/dist/shared/logger/LoggerFactory.js.map +1 -0
- package/dist/shared/logger/index.js +19 -0
- package/dist/shared/logger/index.js.map +1 -0
- package/dist/shared/shutdown.js +30 -0
- package/dist/shared/shutdown.js.map +1 -0
- package/dist/shared/utils/agglomerativeCluster.js +269 -0
- package/dist/shared/utils/agglomerativeCluster.js.map +1 -0
- package/dist/shared/utils/astSymbols.js +69 -0
- package/dist/shared/utils/astSymbols.js.map +1 -0
- package/dist/shared/utils/cosineSimilarity.js +18 -0
- package/dist/shared/utils/cosineSimilarity.js.map +1 -0
- package/dist/shared/utils/directoryTree.js +184 -0
- package/dist/shared/utils/directoryTree.js.map +1 -0
- package/dist/shared/utils/documentOutline.js +74 -0
- package/dist/shared/utils/documentOutline.js.map +1 -0
- package/dist/shared/utils/index.js +24 -0
- package/dist/shared/utils/index.js.map +1 -0
- package/dist/shared/utils/jaroWinklerSimilarity.js +60 -0
- package/dist/shared/utils/jaroWinklerSimilarity.js.map +1 -0
- package/dist/shared/utils/parseJsonLenient.js +27 -0
- package/dist/shared/utils/parseJsonLenient.js.map +1 -0
- package/dist/shared/utils/readConfig.js +42 -0
- package/dist/shared/utils/readConfig.js.map +1 -0
- package/dist/shared/utils/readRtf.js +216 -0
- package/dist/shared/utils/readRtf.js.map +1 -0
- package/dist/shared/utils/softmax.js +26 -0
- package/dist/shared/utils/softmax.js.map +1 -0
- package/dist/types/ContentClass.js +3 -0
- package/dist/types/ContentClass.js.map +1 -0
- package/dist/types/CorpusProfile.js +3 -0
- package/dist/types/CorpusProfile.js.map +1 -0
- package/dist/types/IContradictionChecker.js +3 -0
- package/dist/types/IContradictionChecker.js.map +1 -0
- package/dist/types/ICorpusAnalyzer.js +3 -0
- package/dist/types/ICorpusAnalyzer.js.map +1 -0
- package/dist/types/IDirectoryProcessor.js +3 -0
- package/dist/types/IDirectoryProcessor.js.map +1 -0
- package/dist/types/IEmbeddingProvider.js +3 -0
- package/dist/types/IEmbeddingProvider.js.map +1 -0
- package/dist/types/IEmbeddingService.js +6 -0
- package/dist/types/IEmbeddingService.js.map +1 -0
- package/dist/types/IFileProcessor.js +3 -0
- package/dist/types/IFileProcessor.js.map +1 -0
- package/dist/types/IGroundingChecker.js +3 -0
- package/dist/types/IGroundingChecker.js.map +1 -0
- package/dist/types/IKnowledgeGraphBuilder.js +3 -0
- package/dist/types/IKnowledgeGraphBuilder.js.map +1 -0
- package/dist/types/IKnowledgeGraphExporter.js +3 -0
- package/dist/types/IKnowledgeGraphExporter.js.map +1 -0
- package/dist/types/IKnowledgeGraphMerger.js +3 -0
- package/dist/types/IKnowledgeGraphMerger.js.map +1 -0
- package/dist/types/IKnowledgeGraphSearch.js +3 -0
- package/dist/types/IKnowledgeGraphSearch.js.map +1 -0
- package/dist/types/ILLMProvider.js +3 -0
- package/dist/types/ILLMProvider.js.map +1 -0
- package/dist/types/ILLMService.js +3 -0
- package/dist/types/ILLMService.js.map +1 -0
- package/dist/types/IObjectDetector.js +3 -0
- package/dist/types/IObjectDetector.js.map +1 -0
- package/dist/types/IProcessingService.js +3 -0
- package/dist/types/IProcessingService.js.map +1 -0
- package/dist/types/IProgressEmitter.js +3 -0
- package/dist/types/IProgressEmitter.js.map +1 -0
- package/dist/types/IPromptManager.js +3 -0
- package/dist/types/IPromptManager.js.map +1 -0
- package/dist/types/KnowledgeGraph.js +3 -0
- package/dist/types/KnowledgeGraph.js.map +1 -0
- package/dist/types/MCPKnowledgeGraph.js +3 -0
- package/dist/types/MCPKnowledgeGraph.js.map +1 -0
- package/dist/types/Observation.js +21 -0
- package/dist/types/Observation.js.map +1 -0
- package/dist/types/ProcessingOptions.js +3 -0
- package/dist/types/ProcessingOptions.js.map +1 -0
- package/dist/types/index.js +40 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +122 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
### Example 1: Email with cc + attachment
|
|
2
|
+
|
|
3
|
+
Input:
|
|
4
|
+
|
|
5
|
+
## File information
|
|
6
|
+
|
|
7
|
+
Path: `mail/q4-budget.eml`
|
|
8
|
+
|
|
9
|
+
## Content to analyze
|
|
10
|
+
```
|
|
11
|
+
From: John Park <john@acme.com>
|
|
12
|
+
To: Sarah Lee <sarah@acme.com>
|
|
13
|
+
Cc: Mike Ross <mike@acme.com>
|
|
14
|
+
Subject: Q4 budget draft — Apollo
|
|
15
|
+
Date: 2022-11-03
|
|
16
|
+
|
|
17
|
+
Hi Sarah, attached is the Q4 budget draft for the Apollo project. I'll finalize the
|
|
18
|
+
headcount numbers by Friday — can you review the travel section before then?
|
|
19
|
+
Thanks, John
|
|
20
|
+
|
|
21
|
+
[attachment: q4-budget.xlsx]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Output:
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"entities": [
|
|
29
|
+
{
|
|
30
|
+
"name": "John Park",
|
|
31
|
+
"entityType": "person",
|
|
32
|
+
"observations": [
|
|
33
|
+
"Sent the Q4 budget draft email on 2022-11-03",
|
|
34
|
+
"Committed to finalize the headcount numbers by Friday"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "Sarah Lee",
|
|
39
|
+
"entityType": "person",
|
|
40
|
+
"observations": ["Asked to review the travel section before Friday"]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "Mike Ross",
|
|
44
|
+
"entityType": "person",
|
|
45
|
+
"observations": ["Cc'd on the Q4 budget draft email"]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "Q4 budget draft — Apollo",
|
|
49
|
+
"entityType": "thread",
|
|
50
|
+
"observations": ["Email about the Apollo project budget, dated 2022-11-03"]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "Apollo project",
|
|
54
|
+
"entityType": "project",
|
|
55
|
+
"observations": ["Initiative the Q4 budget covers"]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "q4-budget.xlsx",
|
|
59
|
+
"entityType": "attachment",
|
|
60
|
+
"observations": ["Spreadsheet holding the Q4 budget draft"]
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"relations": [
|
|
64
|
+
{ "from": "John Park", "to": "Sarah Lee", "relationType": ["sends_to"] },
|
|
65
|
+
{ "from": "John Park", "to": "Mike Ross", "relationType": ["cc"] },
|
|
66
|
+
{ "from": "Q4 budget draft — Apollo", "to": "Apollo project", "relationType": ["references"] },
|
|
67
|
+
{ "from": "q4-budget.xlsx", "to": "Q4 budget draft — Apollo", "relationType": ["part_of"] }
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Note: the deadline ("by Friday") and the review request are observations on the
|
|
73
|
+
people, not nodes. `sends_to` is sender → recipient; `cc` is its own predicate, not
|
|
74
|
+
stacked onto `sends_to`. The attachment is `part_of` the thread that carried it.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### Example 2: Reply in the thread (with prior context — extend)
|
|
79
|
+
|
|
80
|
+
Input:
|
|
81
|
+
|
|
82
|
+
## File information
|
|
83
|
+
|
|
84
|
+
Path: `mail/q4-budget.eml`
|
|
85
|
+
Chunk 2 of 3
|
|
86
|
+
|
|
87
|
+
## Already extracted (do not re-emit)
|
|
88
|
+
|
|
89
|
+
- **John Park** (person): Sent the Q4 budget draft email on 2022-11-03
|
|
90
|
+
- **Sarah Lee** (person): Asked to review the travel section before Friday
|
|
91
|
+
|
|
92
|
+
## Content to analyze
|
|
93
|
+
```
|
|
94
|
+
From: Sarah Lee <sarah@acme.com>
|
|
95
|
+
To: John Park <john@acme.com>
|
|
96
|
+
Subject: Re: Q4 budget draft — Apollo
|
|
97
|
+
Date: 2022-11-04
|
|
98
|
+
|
|
99
|
+
Reviewed — travel looks fine. Looping in my manager, Dana, who owns the Apollo
|
|
100
|
+
budget sign-off.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Output:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"entities": [
|
|
108
|
+
{
|
|
109
|
+
"name": "Sarah Lee",
|
|
110
|
+
"entityType": "person",
|
|
111
|
+
"observations": ["Reviewed the travel section and approved it (2022-11-04)"]
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "Dana",
|
|
115
|
+
"entityType": "person",
|
|
116
|
+
"observations": ["Sarah Lee's manager; owns the Apollo budget sign-off"]
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"relations": [
|
|
120
|
+
{ "from": "Sarah Lee", "to": "John Park", "relationType": ["replies_to"] },
|
|
121
|
+
{ "from": "Sarah Lee", "to": "Dana", "relationType": ["reports_to"] }
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Note: the reply is `replies_to`, not another `sends_to`; `reports_to` captures the
|
|
127
|
+
org hierarchy. `Sarah Lee` is re-emitted under her exact name carrying a *new*
|
|
128
|
+
observation (the approval), which extends the existing node on merge.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### Example 3: Group chat (hand-off + scheduling)
|
|
133
|
+
|
|
134
|
+
Input:
|
|
135
|
+
|
|
136
|
+
## File information
|
|
137
|
+
|
|
138
|
+
Path: `chat/apollo-standup.txt`
|
|
139
|
+
|
|
140
|
+
## Content to analyze
|
|
141
|
+
```
|
|
142
|
+
[09:02] Mike Ross: I'll forward the vendor quote to Sarah for the budget.
|
|
143
|
+
[09:03] Sarah Lee: thanks. Let's set up a sync Thursday to close the numbers.
|
|
144
|
+
[09:03] John Park: works for me, I'll book the room.
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Output:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"entities": [
|
|
152
|
+
{
|
|
153
|
+
"name": "Mike Ross",
|
|
154
|
+
"entityType": "person",
|
|
155
|
+
"observations": ["Forwarded the vendor quote to Sarah for the Apollo budget"]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "Sarah Lee",
|
|
159
|
+
"entityType": "person",
|
|
160
|
+
"observations": ["Proposed a Thursday sync to finalize the numbers"]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "John Park",
|
|
164
|
+
"entityType": "person",
|
|
165
|
+
"observations": ["Agreed to book a room for the Thursday sync"]
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"relations": [
|
|
169
|
+
{ "from": "Mike Ross", "to": "Sarah Lee", "relationType": ["forwards_to"] },
|
|
170
|
+
{ "from": "Sarah Lee", "to": "John Park", "relationType": ["schedules_with"] },
|
|
171
|
+
{ "from": "John Park", "to": "Mike Ross", "relationType": ["collaborates_with"] }
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Note: each predicate names the one real interaction — `forwards_to` for the hand-off,
|
|
177
|
+
`schedules_with` for the proposed sync, `collaborates_with` for joint work. No
|
|
178
|
+
`["sends_to", "forwards_to"]` synonym stacking; the timestamps stay out of the graph.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
### Example 4: Encrypted body → empty graph
|
|
183
|
+
|
|
184
|
+
Input:
|
|
185
|
+
|
|
186
|
+
## File information
|
|
187
|
+
|
|
188
|
+
Path: `mail/secure-thread.eml`
|
|
189
|
+
Chunk 2 of 2
|
|
190
|
+
|
|
191
|
+
## Content to analyze
|
|
192
|
+
```
|
|
193
|
+
-----BEGIN PGP MESSAGE-----
|
|
194
|
+
hQEMA4l3xK2vQp9rAQf/Wd7yK0c1nT8mLpQ2... (encrypted body) ...=Xy7Q
|
|
195
|
+
-----END PGP MESSAGE-----
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Output:
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{ "entities": [], "relations": [] }
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Note: an encrypted or otherwise undecodable body carries no extractable facts —
|
|
205
|
+
empty graph, not a node minted from the armor headers.
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
### Example 1: README install + usage
|
|
2
|
+
|
|
3
|
+
Input:
|
|
4
|
+
|
|
5
|
+
## File information
|
|
6
|
+
|
|
7
|
+
Path: `README.md`
|
|
8
|
+
|
|
9
|
+
## Content to analyze
|
|
10
|
+
```
|
|
11
|
+
# Wanshi
|
|
12
|
+
Wanshi turns files into knowledge graphs. Requires Node.js 18+.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
npm install -g wanshi
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
Run `wanshi --config config.yaml`. Set `output` to choose the destination file.
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Output:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"entities": [
|
|
26
|
+
{
|
|
27
|
+
"name": "Wanshi README",
|
|
28
|
+
"entityType": "guide",
|
|
29
|
+
"observations": ["Install and usage documentation for the Wanshi CLI"]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "Wanshi",
|
|
33
|
+
"entityType": "product",
|
|
34
|
+
"observations": ["CLI that turns files into knowledge graphs"]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "Node.js 18+",
|
|
38
|
+
"entityType": "requirement",
|
|
39
|
+
"observations": ["Minimum runtime needed to install Wanshi"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "install wanshi",
|
|
43
|
+
"entityType": "procedure",
|
|
44
|
+
"observations": ["Run `npm install -g wanshi`"]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "output",
|
|
48
|
+
"entityType": "configuration_option",
|
|
49
|
+
"observations": ["Sets the destination file for the generated graph; configured in config.yaml"]
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"relations": [
|
|
53
|
+
{ "from": "Wanshi README", "to": "Wanshi", "relationType": ["documents"] },
|
|
54
|
+
{ "from": "Wanshi README", "to": "install wanshi","relationType": ["guides_through"] },
|
|
55
|
+
{ "from": "install wanshi", "to": "Node.js 18+", "relationType": ["requires"] },
|
|
56
|
+
{ "from": "output", "to": "Wanshi", "relationType": ["configures"] }
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Note: the named option `output` is a `configuration_option` node, but its concrete
|
|
62
|
+
value lives in the observation — a raw value like `graph.jsonl` would not be its own
|
|
63
|
+
node. The install command is the procedure's observation, not a separate entity.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### Example 2: API reference (method + parameters)
|
|
68
|
+
|
|
69
|
+
Input:
|
|
70
|
+
|
|
71
|
+
## File information
|
|
72
|
+
|
|
73
|
+
Path: `docs/api.md`
|
|
74
|
+
|
|
75
|
+
## Content to analyze
|
|
76
|
+
```
|
|
77
|
+
### `createGraph(files, options)`
|
|
78
|
+
Builds a knowledge graph from the given files.
|
|
79
|
+
- `files` (string[]) — paths to ingest. Required.
|
|
80
|
+
- `options.format` — output format, one of json|jsonl. Defaults to json.
|
|
81
|
+
Returns a `KnowledgeGraph`.
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Output:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"entities": [
|
|
89
|
+
{
|
|
90
|
+
"name": "createGraph",
|
|
91
|
+
"entityType": "api_method",
|
|
92
|
+
"observations": [
|
|
93
|
+
"Builds a knowledge graph from the given files",
|
|
94
|
+
"Returns a KnowledgeGraph"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "files",
|
|
99
|
+
"entityType": "parameter",
|
|
100
|
+
"observations": ["string[] of paths to ingest; required"]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "options.format",
|
|
104
|
+
"entityType": "parameter",
|
|
105
|
+
"observations": ["Output format, one of json|jsonl; defaults to json"]
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"relations": [
|
|
109
|
+
{ "from": "files", "to": "createGraph", "relationType": ["part_of"] },
|
|
110
|
+
{ "from": "options.format", "to": "createGraph", "relationType": ["part_of"] }
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Note: `Required` and the default value are observations on the parameter, not nodes.
|
|
116
|
+
Parameters are `part_of` their method; the return type stays an observation rather
|
|
117
|
+
than becoming a dangling `KnowledgeGraph` node with no facts of its own here.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### Example 3: Tutorial with ordered steps
|
|
122
|
+
|
|
123
|
+
Input:
|
|
124
|
+
|
|
125
|
+
## File information
|
|
126
|
+
|
|
127
|
+
Path: `docs/tutorial.md`
|
|
128
|
+
|
|
129
|
+
## Content to analyze
|
|
130
|
+
```
|
|
131
|
+
## Your first graph
|
|
132
|
+
1. Create a `config.yaml` pointing `input` at your project.
|
|
133
|
+
2. Run `wanshi --config config.yaml`.
|
|
134
|
+
3. Open the generated `graph.jsonl`.
|
|
135
|
+
|
|
136
|
+
Example: the snippet below ingests a TypeScript repo and writes JSONL.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Output:
|
|
140
|
+
|
|
141
|
+
```json
|
|
142
|
+
{
|
|
143
|
+
"entities": [
|
|
144
|
+
{
|
|
145
|
+
"name": "first graph tutorial",
|
|
146
|
+
"entityType": "guide",
|
|
147
|
+
"observations": ["Walks a new user through producing their first knowledge graph"]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "create config.yaml",
|
|
151
|
+
"entityType": "tutorial_step",
|
|
152
|
+
"observations": ["Point `input` at the project to ingest"]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"name": "run wanshi",
|
|
156
|
+
"entityType": "tutorial_step",
|
|
157
|
+
"observations": ["Run `wanshi --config config.yaml`"]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "open the output graph",
|
|
161
|
+
"entityType": "tutorial_step",
|
|
162
|
+
"observations": ["Inspect the generated `graph.jsonl`"]
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "TypeScript repo walkthrough",
|
|
166
|
+
"entityType": "example",
|
|
167
|
+
"observations": ["Ingests a TypeScript repo and writes JSONL"]
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"relations": [
|
|
171
|
+
{ "from": "first graph tutorial", "to": "create config.yaml", "relationType": ["guides_through"] },
|
|
172
|
+
{ "from": "first graph tutorial", "to": "run wanshi", "relationType": ["guides_through"] },
|
|
173
|
+
{ "from": "first graph tutorial", "to": "open the output graph", "relationType": ["guides_through"] },
|
|
174
|
+
{ "from": "first graph tutorial", "to": "TypeScript repo walkthrough", "relationType": ["demonstrates"] },
|
|
175
|
+
{ "from": "create config.yaml", "to": "run wanshi", "relationType": ["precedes"] },
|
|
176
|
+
{ "from": "run wanshi", "to": "open the output graph", "relationType": ["precedes"] }
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Note: `guides_through` links the tutorial to each step; `precedes` records step order
|
|
182
|
+
without restating it as a synonym; `demonstrates` links the tutorial to the worked
|
|
183
|
+
example. Direction stays consistent (guide → step, earlier step → later step).
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### Example 4: Feature explanation
|
|
188
|
+
|
|
189
|
+
Input:
|
|
190
|
+
|
|
191
|
+
## File information
|
|
192
|
+
|
|
193
|
+
Path: `docs/features.md`
|
|
194
|
+
|
|
195
|
+
## Content to analyze
|
|
196
|
+
```
|
|
197
|
+
## Resume
|
|
198
|
+
The `--resume` flag checkpoints every chunk so an interrupted run can continue
|
|
199
|
+
without re-billing. It requires a writable output directory.
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Output:
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"entities": [
|
|
207
|
+
{
|
|
208
|
+
"name": "Resume documentation",
|
|
209
|
+
"entityType": "guide",
|
|
210
|
+
"observations": ["Explains how the resume feature works"]
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "Resume",
|
|
214
|
+
"entityType": "feature",
|
|
215
|
+
"observations": [
|
|
216
|
+
"Checkpoints every chunk so an interrupted run can continue without re-billing",
|
|
217
|
+
"Enabled with the `--resume` flag"
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "writable output directory",
|
|
222
|
+
"entityType": "requirement",
|
|
223
|
+
"observations": ["Needed so resume can persist checkpoints"]
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
"relations": [
|
|
227
|
+
{ "from": "Resume documentation", "to": "Resume", "relationType": ["explains"] },
|
|
228
|
+
{ "from": "Resume", "to": "writable output directory", "relationType": ["requires"] }
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Note: `explains` links the doc section to the feature it describes; `requires`
|
|
234
|
+
captures the precondition. The `--resume` flag is an observation on the feature, not
|
|
235
|
+
a separate node.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### Example 5: Badges / scaffolding → empty graph
|
|
240
|
+
|
|
241
|
+
Input:
|
|
242
|
+
|
|
243
|
+
## File information
|
|
244
|
+
|
|
245
|
+
Path: `README.md`
|
|
246
|
+
Chunk 1 of 4
|
|
247
|
+
|
|
248
|
+
## Content to analyze
|
|
249
|
+
```
|
|
250
|
+

|
|
251
|
+

|
|
252
|
+
<!-- TOC generated, do not edit -->
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Output:
|
|
256
|
+
|
|
257
|
+
```json
|
|
258
|
+
{ "entities": [], "relations": [] }
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Note: status badges and generated table-of-contents markup carry no durable facts —
|
|
262
|
+
empty graph, not a node scraped from a shields.io URL.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
### Example 1: Service contract
|
|
2
|
+
|
|
3
|
+
Input:
|
|
4
|
+
|
|
5
|
+
## File information
|
|
6
|
+
|
|
7
|
+
Path: `contracts/abc-xyz-services.pdf`
|
|
8
|
+
|
|
9
|
+
## Content to analyze
|
|
10
|
+
```
|
|
11
|
+
This contract is made between ABC Corporation ("the Company") and XYZ Inc.
|
|
12
|
+
("the Contractor") on January 10, 2022. The Company agrees to pay the Contractor
|
|
13
|
+
a total amount of $100,000 for the services rendered.
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Output:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"entities": [
|
|
21
|
+
{
|
|
22
|
+
"name": "ABC Corporation",
|
|
23
|
+
"entityType": "organization",
|
|
24
|
+
"observations": ["Client in the services contract", "Pays $100,000 for services rendered"]
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "XYZ Inc.",
|
|
28
|
+
"entityType": "organization",
|
|
29
|
+
"observations": ["Contractor in the services contract", "Receives $100,000 for services rendered"]
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"relations": [
|
|
33
|
+
{ "from": "ABC Corporation", "to": "XYZ Inc.", "relationType": ["pays"] }
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Note: `$100,000` is a value, not an entity. It lives in the observations of the
|
|
39
|
+
parties it concerns. The two companies are the real nodes; the payment is the edge.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### Example 2: Invoice
|
|
44
|
+
|
|
45
|
+
Input:
|
|
46
|
+
|
|
47
|
+
## File information
|
|
48
|
+
|
|
49
|
+
Path: `invoices/inv-1234.pdf`
|
|
50
|
+
|
|
51
|
+
## Content to analyze
|
|
52
|
+
```
|
|
53
|
+
Invoice #1234
|
|
54
|
+
Date: January 20, 2022
|
|
55
|
+
Bill To: ABC Corporation
|
|
56
|
+
Amount: $2,000
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Output:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"entities": [
|
|
64
|
+
{
|
|
65
|
+
"name": "Invoice #1234",
|
|
66
|
+
"entityType": "document",
|
|
67
|
+
"observations": ["Issued 2022-01-20", "Billed amount $2,000"]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "ABC Corporation",
|
|
71
|
+
"entityType": "organization",
|
|
72
|
+
"observations": ["Billed party on Invoice #1234"]
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"relations": [
|
|
76
|
+
{ "from": "Invoice #1234", "to": "ABC Corporation", "relationType": ["targets"] }
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### Example 3: Loan agreement
|
|
84
|
+
|
|
85
|
+
Input:
|
|
86
|
+
|
|
87
|
+
## File information
|
|
88
|
+
|
|
89
|
+
Path: `loans/abc-term-loan.docx`
|
|
90
|
+
|
|
91
|
+
## Content to analyze
|
|
92
|
+
```
|
|
93
|
+
Loan Agreement between ABC Corporation (Borrower) and XYZ Bank (Lender) with a
|
|
94
|
+
loan amount of $500,000 and an interest rate of 5%.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Output:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"entities": [
|
|
102
|
+
{
|
|
103
|
+
"name": "ABC Corporation",
|
|
104
|
+
"entityType": "organization",
|
|
105
|
+
"observations": ["Borrower under the loan agreement", "Principal $500,000 at 5% interest"]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "XYZ Bank",
|
|
109
|
+
"entityType": "organization",
|
|
110
|
+
"observations": ["Lender under the loan agreement"]
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"relations": [
|
|
114
|
+
{ "from": "ABC Corporation", "to": "XYZ Bank", "relationType": ["owes"] }
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### Example 4: Financial statement
|
|
122
|
+
|
|
123
|
+
Input:
|
|
124
|
+
|
|
125
|
+
## File information
|
|
126
|
+
|
|
127
|
+
Path: `reports/fy2022-revenue.docx`
|
|
128
|
+
|
|
129
|
+
## Content to analyze
|
|
130
|
+
```
|
|
131
|
+
The company's total revenue for the year 2022 is $1,000,000, comprised of
|
|
132
|
+
sales ($800,000) and interest income ($200,000).
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Output:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"entities": [
|
|
140
|
+
{
|
|
141
|
+
"name": "FY2022 revenue",
|
|
142
|
+
"entityType": "metric",
|
|
143
|
+
"observations": [
|
|
144
|
+
"Total revenue of $1,000,000 for fiscal year 2022",
|
|
145
|
+
"Composed of $800,000 sales and $200,000 interest income"
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
],
|
|
149
|
+
"relations": []
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Note: a single reported figure with its breakdown is one `metric` entity, not four
|
|
154
|
+
dollar-amount nodes wired together. Splitting `$1,000,000`, `$800,000`, and
|
|
155
|
+
`$200,000` into separate entities produces meaningless value-nodes and a fan of
|
|
156
|
+
edges that say nothing. When there is only one real entity, an empty `relations`
|
|
157
|
+
array is correct.
|