NlpTools API
Class

NlpTools\Documents\TrainingSet

class TrainingSet implements Iterator, ArrayAccess, Countable

A collection of TrainingDocument objects.

It implements many built
in php interfaces for ease of use.

Constants

CLASS_AS_KEY

OFFSET_AS_KEY

Methods

__construct()

void addDocument($class $class, DocumentInterface $d)

Add a document to the set.

getClassSet()

setAsKey($what)

Decide what should be returned as key when iterated upon

applyTransformations(array $transforms)

Apply an array of transformations to all documents in this container.

rewind()

next()

valid()

current()

key()

offsetSet($key, $value)

offsetUnset($key)

offsetGet($key)

offsetExists($key)

count()

Details

at line 23
public __construct()

at line 37
public void addDocument($class $class, DocumentInterface $d)

Add a document to the set.

Parameters

$class $class The documents actual class
DocumentInterface $d The Document

Return Value

void

at line 43
public getClassSet()

at line 51
public setAsKey($what)

Decide what should be returned as key when iterated upon

Parameters

$what

at line 69
public applyTransformations(array $transforms)

Apply an array of transformations to all documents in this container.

Parameters

array $transforms An array of TransformationInterface instances

at line 79
public rewind()

at line 84
public next()

at line 88
public valid()

at line 92
public current()

at line 96
public key()

at line 111
public offsetSet($key, $value)

Parameters

$key
$value

at line 115
public offsetUnset($key)

Parameters

$key

at line 119
public offsetGet($key)

Parameters

$key

at line 123
public offsetExists($key)

Parameters

$key

at line 130
public count()