poplar-annotation
Version:
web-based annotation tool for natural language processing (NLP) needs, inspired by brat rapid annotation tool.
46 lines (45 loc) • 1.74 kB
TypeScript
import { Base } from "../Infrastructure/Repository";
import { Store } from "./Store";
import { Connection } from "./Connection";
import { LabelCategory } from "./LabelCategory";
export declare namespace Label {
interface JSON {
readonly id: number;
readonly categoryId: number;
readonly startIndex: number;
readonly endIndex: number;
}
class Entity {
readonly id: number | null;
readonly categoryId: number;
private _startIndex;
private _endIndex;
private readonly root;
constructor(id: number | null, categoryId: number, _startIndex: number, _endIndex: number, root: Store);
get startIndex(): number;
get endIndex(): number;
move(offset: number): void;
get category(): LabelCategory.Entity;
get json(): JSON;
get sameLineConnections(): Array<Connection.Entity>;
get connectionsFrom(): Set<Connection.Entity>;
get connectionsTo(): Set<Connection.Entity>;
get allConnections(): Set<Connection.Entity>;
}
interface Config {
readonly allowMultipleLabel: "notAllowed" | "differentCategory" | "allowed";
}
class Repository extends Base.Repository<Entity> {
private config;
constructor(config: Config);
set(key: number, value: Entity): this;
add(value: Label.Entity): number;
private againstMultipleLabelWith;
getEntitiesInRange(startIndex: number, endIndex: number): Array<Entity>;
getEntitiesCross(index: number): Array<Entity>;
}
namespace Factory {
function create(json: JSON, root: Store): Entity;
function createAll(json: Array<JSON>, root: Store): Array<Entity>;
}
}