corpusmatrix

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Copyright (c) 2026 Tarek Wasfy

Copyright (c) 2026 Tarek Wasfy

Index

Constants

View Source
const (
	ResultFull   = "UAST_FULL"
	ResultGap    = "UAST_REJECTED_GAP"
	ResultInput  = "INPUT_ERROR"
	ResultParser = "PARSER_ERROR"
	ResultInfra  = "INFRA_ERROR"
	// Result classes separate source eligibility from UAST coverage.  They are
	// analysis labels only: no source fact is promoted merely because a corpus
	// file has been classified.
	ResultForeign      = "FOREIGN_DIALECT"
	ResultPreprocessor = "PREPROCESSOR_FRAGMENT"
	ResultUnsupported  = "VALID_UNSUPPORTED_SEMANTICS"
	ResultParserLimit  = "PARSER_LIMITATION"
	ResultInvalid      = "INVALID_SOURCE"
	ResultTruncated    = "TRUNCATED_FRAGMENT"
)

Variables

This section is empty.

Functions

func NormalizeSource

func NormalizeSource(s string) string

Types

type Config

type Config struct {
	Project                  string
	Out                      string
	MinerZip                 string
	MLCPD                    string
	Folder                   string
	FolderLanguage           string
	MinOccurrences           int
	MinDistinctHashes        int
	MinDistinctRepositories  int
	MinDistinctCorpusSources int
	Workers                  int
	Iteration                int
	Checkpoint               string
}

type CorpusRecord

type CorpusRecord struct {
	CorpusSource                string   `json:"corpus_source"`
	CorpusRecordID              string   `json:"corpus_record_id"`
	LanguageID                  string   `json:"language_id"`
	SourceHash                  string   `json:"source_hash"`
	NormalizedSourceHash        string   `json:"normalized_source_hash"`
	PackageOrRepo               string   `json:"package_or_repo"`
	SourcePath                  string   `json:"source_path"`
	SourceCode                  string   `json:"source_code"`
	StructuralEvidenceAvailable bool     `json:"structural_evidence_available"`
	StructuralEvidenceKind      string   `json:"structural_evidence_kind"`
	ParserErrorCount            int      `json:"parser_error_count"`
	Provenance                  string   `json:"provenance"`
	Features                    []string `json:"features,omitempty"`
	MLCPDNodes                  []string `json:"mlcpd_nodes,omitempty"`
}

func Dedupe

func Dedupe(records []CorpusRecord) ([]CorpusRecord, int)

func LoadFolder

func LoadFolder(root, language string) ([]CorpusRecord, error)

func LoadMLCPD

func LoadMLCPD(path string) ([]CorpusRecord, error)

func LoadMiner

func LoadMiner(path string) ([]CorpusRecord, error)

LoadMiner accepts either the verified ZIP or an extracted live miner run. The extracted form's artifact_records.jsonl is preferred because it retains per-artifact feature/provenance data while the miner is still downloading.

func LoadMinerZip

func LoadMinerZip(path string) ([]CorpusRecord, error)

type FileResult

type FileResult struct {
	Record       CorpusRecord
	State        string
	InputClass   string
	Gaps         []string
	Diagnostic   string
	Capabilities []string
	UsedFeatures []string
}

type Summary

type Summary struct {
	FilesTotal                  int `json:"files_total"`
	FilesUASTFull               int `json:"files_uast_full"`
	FilesRejectedGap            int `json:"files_rejected_gap"`
	UniqueGapClasses            int `json:"unique_gap_classes"`
	CapabilitiesUsed            int `json:"capabilities_used"`
	CapabilitiesCorpusValidated int `json:"capabilities_corpus_validated"`
	NewEmpiricalCells           int `json:"new_empirical_cells"`
	BaselineConfirmedCells      int `json:"baseline_confirmed_cells"`
	DeduplicatedRecords         int `json:"deduplicated_records"`
	SourceHashDuplicates        int `json:"source_hash_duplicates"`
	MinOccurrences              int `json:"min_occurrences"`
	Iteration                   int `json:"iteration"`
	EmpiricalProofCells         int `json:"empirical_proof_cells"`
	EmpiricalContradictions     int `json:"empirical_contradictions"`
	EligiblePythonFiles         int `json:"eligible_python_files"`
	ValidUnsupported            int `json:"valid_unsupported"`
	ForeignDialect              int `json:"foreign_dialect"`
	InvalidOrTruncated          int `json:"invalid_or_truncated"`
	ParserLimitations           int `json:"parser_limitations"`
}

func Run

func Run(cfg Config, records []CorpusRecord) (Summary, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL