@openfloor/protocol - v0.0.4
    Preparing search index...

    Class Token

    Represents a single token in a dialog event feature with optional metadata. Tokens are the fundamental units of information within features.

    // Simple text token
    const token1 = new Token({ value: "Hello world" });

    // Token with confidence and span
    const token2 = new Token({
    value: "Hello",
    confidence: 0.95,
    span: { startOffset: 0, endOffset: 1000 }
    });

    // Token with links to other features
    const token3 = new Token({
    value: { intent: "greeting" },
    links: ["$.textFeature.tokens[0].value"]
    });

    Implements

    Index

    Constructors

    • Creates a new Token instance

      Parameters

      • options: TokenOptions = {}

        Token configuration options

      Returns Token

      Error if invalid configuration is provided

    Properties

    confidence?: number
    links: readonly string[]
    span?: Span
    value?: unknown
    valueUrl?: string

    Methods

    • Resolves JSON Path links within a dialog event to find linked values

      Parameters

      • dialogEvent: DialogEvent

        The parent dialog event to search within

      Returns [string, unknown][]

      Array of [path, value] pairs for matched links

    • Creates a Token instance from a dictionary with nested object conversion

      Parameters

      • data: Record<string, unknown>

      Returns Token