jeyroik/extas-alice

View on GitHub
src/interfaces/yandex/calls/requests/IRequestNLU.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
namespace extas\interfaces\yandex\calls\requests;

use extas\interfaces\IItem;
use extas\interfaces\yandex\calls\requests\nlu\INLUEntity;

/**
 * Interface IRequestNLU
 *
 * @package extas\interfaces\yandex\calls\requests
 * @author jeyroik@gmail.com
 */
interface IRequestNLU extends IItem
{
    public const SUBJECT = 'alice.call.request.nlu';

    public const FIELD__TOKENS = 'tokens';
    public const FIELD__ENTITIES = 'entities';

    public const INDEX__LAST = 'last';

    /**
     * @param int $startIndex
     * @param string|int $endIndex
     *
     * @return string[]
     */
    public function getTokens(int $startIndex = 0, $endIndex = self::INDEX__LAST): array;

    /**
     * @param int $index
     *
     * @return string
     */
    public function getToken(int $index): string;

    /**
     * @param string $type entity type
     *
     * @return INLUEntity[]
     */
    public function getEntities($type = '');

    /**
     * @param string[] $tokens
     *
     * @return $this
     */
    public function setTokens(array $tokens);

    /**
     * @param string $token
     *
     * @return $this
     */
    public function addToken(string $token);

    /**
     * @param string $token
     *
     * @return bool
     */
    public function hasToken(string $token): bool;

    /**
     * @param INLUEntity[] $entities
     *
     * @return $this
     */
    public function setEntities(array $entities);

    /**
     * @param INLUEntity $entity
     *
     * @return $this
     */
    public function addEntity(INLUEntity $entity);
}