semantic-analysis
Version:
Extensible semantic Structured Data analysis library for Microdata and JSON-LD
30 lines (29 loc) • 692 B
TypeScript
import { IItem, ILog, Spec } from '../item';
import { IDocumentHandler } from '../..';
/**
* An interface to implement structured data extractor
* most likely from HTML documents
*/
export interface IExtractor<T extends Spec.IItem = IItem> {
/**
* Get extracted top-level items
*/
extract(): IExtractionResult<T>;
}
/**
* An extraction result object interface
*/
export interface IExtractionResult<T extends Spec.IItem = IItem> {
/**
* Construable structured data found in the document
*/
items: T[];
/**
* Source document reference
*/
document?: IDocumentHandler;
/**
* Log entries, errors etc.
*/
logs: ILog[];
}