NlpTools API
Class

NlpTools\Documents\WordDocument

class WordDocument implements DocumentInterface

A Document that represents a single word but with a context of a larger document.

Useful for Named Entity Recognition

Methods

__construct(array $tokens, $index, $context)

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 16
public __construct(array $tokens, $index, $context)

Parameters

array $tokens
$index
$context

at line 39
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

at line 51
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