NlpTools API
Class

NlpTools\Documents\TokensDocument

class TokensDocument implements DocumentInterface

Represents a bag of words (tokens) document.

Methods

__construct(array $tokens)

array getDocumentData()

Return the data of what is being represented.

applyTransformation(TransformationInterface $transform)

Apply the transformation to the data of this document.

Details

at line 13
public __construct(array $tokens)

Parameters

array $tokens

at line 21
public array getDocumentData()

Return the data of what is being represented.

If it were a word
we could return a word. If it were a blog post we could return
an array(Title,Body,array(Comments)).

Return Value

array The tokens array

at line 31
public applyTransformation(TransformationInterface $transform)

Apply the transformation to the data of this document.

How the transformation is applied (per token, per token sequence, etc)
is decided by the implementing classes.

Parameters

TransformationInterface $transform The transformation to be applied