UNPKG

geneea-nlp-client

Version:

The TypeScript Client for Geneea Interpretor G3 API.

73 lines (72 loc) 3.6 kB
import { HasId } from "../../common/id"; import { GkbProperty, HasGkbProperties } from "./gkb-propert"; import { Sentence } from "./sentence"; import { HasSentiment, Sentiment } from "./sentiment"; import { TokenSupport, Token } from "./token"; import { HasVectors, Vector } from "./vector"; /** A data class encapsulating an Entity. */ declare class Entity implements HasId, HasSentiment, HasVectors, HasGkbProperties { readonly id: string; gkbId: string | null; stdForm: string; type: string; mentions: EntityMention[]; feats: Map<string, string>; sentiment: Sentiment | null; vectors: Vector[] | null; gkbProperties: GkbProperty[]; /** * * @param id ID of the entity used to refer to it from other objects. * @param gkbId Unique identifier of this entity in Geneea knowladge base. * @param stdForm Standard form of the entity, abstracting from alternative names. * @param type Basic type of this entity (e.g. person, location, ...). * @param mentions Actual occurences of this entity in the text. Empty if not requested/supported. * @param feats Custom features/properties. * @param sentiment Sentiment of this entity. null if not requested. * @param vectors Optional vectors for this entity. * @param gkbProperties GKB properties. Since 3.3.0. */ private constructor(); /** Entity factory method, public constructor. */ static of(id: string, gkbId: string | null | undefined, stdForm: string, type: string, mentions?: EntityMention[] | null, feats?: Map<string, string> | null, sentiment?: Sentiment | null, vectors?: Vector[] | null, gkbProperties?: GkbProperty[] | null): Entity; toString(): string; } /** A single occurrence of an entity in the text. */ declare class EntityMention implements HasId, HasSentiment, HasVectors { readonly id: string; text: string; mwl: string; tokens: TokenSupport; feats: Map<string, string>; derivedFrom: Entity | null; sentiment: Sentiment | null; vectors: Vector[] | null; /** Entity this mention belongs to. Set from outside. */ mentionOf: Entity; /** * * @param id ID of the mention used to refer to it from other objects. * @param text The form of this entity mention, as it occurs in the text. * @param mwl Lemma of this mention (potentially multiword lemma), i.e. base form of the entity expression. * @param tokens Tokens of this entity mention. * @param feats Custom features/properties. * @param derivedFrom Entity from which this mention can be derived (e.g. mention `salmon` for entity `fish`), if applicable. * @param sentiment Sentiment of this mention. Note: Not supported yet. * @param vectors Optional vectors for this mention. */ private constructor(); /** EntityMention factory method, public constructor. */ static of(id: string, text: string, mwl: string, tokens: Token[], feats?: Map<string, string> | null, derivedFrom?: Entity | null, sentiment?: Sentiment | null, vectors?: Vector[] | null): EntityMention; /** * Sentence containing this entity mention. * Entity mention belongs to maximally one sentence; artificial mentions without tokens belong to no sentence. */ sentence(): Sentence; /** Checks whether the entity mention is continuous (most are). */ isContinuous(): boolean; /** True iff this entity mention is derived from some other entity (e.g. mention `salmon` for entity `fish`). */ isDerived(): boolean; toString(): string; } export { Entity, EntityMention };