wn-ts-node
Version:
Wordnet interface library - TypeScript port
143 lines (135 loc) • 4.65 kB
TypeScript
declare interface DatabaseAdapter {
/**
* Get all lexicons from the database
*/
getLexicons(): Promise<any[]>;
/**
* Get all words for a specific lexicon
*/
getWords(lexiconId: string): Promise<any[]>;
/**
* Get all synsets for a specific lexicon
*/
getSynsets(lexiconId: string): Promise<any[]>;
/**
* Get all senses for a specific word
*/
getSenses(wordId: string): Promise<any[]>;
/**
* Get all forms for a specific word
*/
getForms(wordId: string): Promise<any[]>;
/**
* Get all tags for a specific word
*/
getWordTags(wordId: string): Promise<any[]>;
/**
* Get all tags for a specific form
*/
getFormTags(formId: string): Promise<any[]>;
/**
* Get all sense relations for a specific sense
*/
getSenseRelations(senseId: string): Promise<any[]>;
/**
* Get all examples for a specific sense
*/
getSenseExamples(senseId: string): Promise<any[]>;
/**
* Get all counts for a specific sense
*/
getSenseCounts(senseId: string): Promise<any[]>;
/**
* Get all syntactic behaviours for a specific word
*/
getSyntacticBehaviours(wordId: string): Promise<any[]>;
/**
* Get all definitions for a specific synset
*/
getDefinitions(synsetId: string): Promise<any[]>;
/**
* Get all ILI definitions for a specific synset
*/
getILIDefinitions(synsetId: string): Promise<any[]>;
/**
* Get all synset relations for a specific synset
*/
getSynsetRelations(synsetId: string): Promise<any[]>;
/**
* Get all examples for a specific synset
*/
getSynsetExamples(synsetId: string): Promise<any[]>;
}
/**
* Node.js implementation of the DatabaseAdapter interface
* This provides access to SQLite databases using better-sqlite3
*/
export declare class NodeDatabaseAdapter implements DatabaseAdapter {
private db;
constructor(databasePath: string);
getLexicons(): Promise<any[]>;
getWords(lexiconId: string): Promise<any[]>;
getSynsets(lexiconId: string): Promise<any[]>;
getSenses(wordId: string): Promise<any[]>;
getForms(wordId: string): Promise<any[]>;
getWordTags(wordId: string): Promise<any[]>;
getFormTags(formId: string): Promise<any[]>;
getSenseRelations(senseId: string): Promise<any[]>;
getSenseExamples(senseId: string): Promise<any[]>;
getSenseCounts(_senseId: string): Promise<any[]>;
getSyntacticBehaviours(_wordId: string): Promise<any[]>;
getDefinitions(synsetId: string): Promise<any[]>;
getILIDefinitions(_synsetId: string): Promise<any[]>;
getSynsetRelations(synsetId: string): Promise<any[]>;
getSynsetExamples(synsetId: string): Promise<any[]>;
close(): void;
}
/**
* CLI function to run validation
*/
export declare function runValidationCLI(args: string[]): Promise<void>;
/**
* Convenience function to validate LMF data integrity using a SQLite database
*/
export declare function validateLMFDataIntegrityFromSQLite(databasePath: string, originalXmlPath: string, options?: ValidationOptions): Promise<ValidationResult>;
declare interface ValidationDifference {
type: 'missing_element' | 'extra_element' | 'attribute_mismatch' | 'content_mismatch' | 'structural_difference';
path: string;
original?: string;
reconstructed?: string;
details: string;
}
declare interface ValidationOptions {
outputReconstructed?: boolean;
outputPath?: string;
ignoreWhitespace?: boolean;
ignoreOrder?: boolean;
detailedDiff?: boolean;
}
/**
* LMF Data Integrity Validation System
*
* This module provides comprehensive validation by performing dry-run exports
* and comparing reconstructed XML with original source files. This is the
* "true way" to verify data integrity across the entire parsing pipeline.
*
* The validation system:
* 1. Loads data from a database (any database implementation)
* 2. Reconstructs the original LMF XML structure
* 3. Compares it with the source XML file
* 4. Reports any differences, data loss, or corruption
*/
declare interface ValidationResult {
success: boolean;
originalFile: string;
reconstructedFile: string | undefined;
differences: ValidationDifference[];
summary: {
totalElements: number;
matchingElements: number;
missingElements: number;
extraElements: number;
attributeMismatches: number;
};
}
export { }