Properties

$classifiers

$classifiers : array

Holds classifier instances

Type

array

$models

$models : array

Holds model instances

Type

array

$config

$config : array

Holds the config from the config.json files

Type

array

$cache

$cache : \CacheCache\Cache

Holds the CacheCache\Cache instance

Type

\CacheCache\Cache

$container

$container : \Camspiers\StatisticalClassifier\Console\Command\Symfony\Component\DependencyInjection\ContainerInterface

Holds the container instance for caching

Type

\Camspiers\StatisticalClassifier\Console\Command\Symfony\Component\DependencyInjection\ContainerInterface

Methods

serve()

serve(\React\Http\Request $request, \React\Http\Response $response) : null

Serve a request

Parameters

\React\Http\Request $request

The request object

\React\Http\Response $response

The response object

Returns

null

setCache()

setCache(\CacheCache\Cache $cache)

Allow for cache to be stored on command for setter injection

Parameters

\CacheCache\Cache $cache

The cache to store

configure()

configure() : null

Configure the commands options

Returns

null

execute()

execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) : null

Start a classifier server

Parameters

\Symfony\Component\Console\Input\InputInterface $input

The input object

\Symfony\Component\Console\Output\OutputInterface $output

The output object

Returns

null

classify()

classify(\React\Http\Request $request, \React\Http\Response $response) : null

Respond to a classify request

Parameters

\React\Http\Request $request

The request object

\React\Http\Response $response

The response object

Returns

null

train()

train(\React\Http\Request $request, \React\Http\Response $response)

Train an model with a document

Parameters

\React\Http\Request $request
\React\Http\Response $response

getClassifierByType()

getClassifierByType(string $classifierType) : \Camspiers\StatisticalClassifier\Classifier\Classifier

Get a classifier from the container using a service name

Parameters

string $classifierType

The service name

Returns

\Camspiers\StatisticalClassifier\Classifier\Classifier

The classifier

getModel()

getModel(string $name, bool $svm) : \Camspiers\StatisticalClassifier\Model\CachedModel

Get an CachedModel based off a model name and the Cache instance

Parameters

string $name

The name of the model

bool $svm

Returns

\Camspiers\StatisticalClassifier\Model\CachedModel

The cached model

cacheDataSource()

cacheDataSource(mixed $name)

Parameters

mixed $name

getContainer()

getContainer() : \Camspiers\StatisticalClassifier\Console\Command\Symfony\Component\DependencyInjection\ContainerInterface

Return the dependency injection container fetching it off the app if it doesn't exist

Returns

\Camspiers\StatisticalClassifier\Console\Command\Symfony\Component\DependencyInjection\ContainerInterface —

The container

getClassifier()

getClassifier(\Symfony\Component\Console\Input\InputInterface $input) : \Camspiers\StatisticalClassifier\Classifier\Classifier

Returns a classifier based of the commands input and the specified model (if exists)

Parameters

\Symfony\Component\Console\Input\InputInterface $input

The commands input

Throws

\RuntimeException

Returns

\Camspiers\StatisticalClassifier\Classifier\Classifier

The built classifier