PHP Class TextAnalysis\Documents\TokensDocument

Author: yooper (yooper)
Inheritance: extends TextAnalysis\Documents\DocumentAbstract
ファイルを表示 Open project: yooper/php-text-analysis Class Usage Examples

Protected Properties

Property Type Description
$counter
$createdOn time doc was created defaults to now
$id mixed
$metadata array Stores an array of metadata about the document
$tokens type An array of tokens that all Documents have

Public Methods

Method Description
__construct ( array $tokens, mixed $id = null, DateTim\DateTime $createdOn = null, array $metadata = [] )
applyExtract ( TextAnalysis\Interfaces\IExtractStrategy $extract ) : array Apply an extract filter and return the results after filter all the documents in the collection
applyStemmer ( TextAnalysis\Interfaces\IStemmer $stemmer, boolean $removeNulls = true ) : TokensDocument Apply a stemmer
applyTransformation ( TextAnalysis\Interfaces\ITokenTransformation $transformer, $removeNulls = true ) : TokensDocument Apply the transformation
getCreatedOn ( ) : DateTim\DateTime
getDocumentData ( ) : array Return an array of tokens
getId ( ) : mixed
getMetadata ( ) : array
setCreatedOn ( DateTim\DateTime $createdOn ) : TokensDocument
setMetadata ( array $metadata ) : TokensDocument
toArray ( ) : array Return the tokens

Method Details

__construct() public method

public __construct ( array $tokens, mixed $id = null, DateTim\DateTime $createdOn = null, array $metadata = [] )
$tokens array
$id mixed
$createdOn DateTim\DateTime
$metadata array

applyExtract() public method

Apply an extract filter and return the results after filter all the documents in the collection
public applyExtract ( TextAnalysis\Interfaces\IExtractStrategy $extract ) : array
$extract TextAnalysis\Interfaces\IExtractStrategy
return array

applyStemmer() public method

Apply a stemmer
public applyStemmer ( TextAnalysis\Interfaces\IStemmer $stemmer, boolean $removeNulls = true ) : TokensDocument
$stemmer TextAnalysis\Interfaces\IStemmer
$removeNulls boolean
return TokensDocument

applyTransformation() public method

Apply the transformation
public applyTransformation ( TextAnalysis\Interfaces\ITokenTransformation $transformer, $removeNulls = true ) : TokensDocument
$transformer TextAnalysis\Interfaces\ITokenTransformation
return TokensDocument

getCreatedOn() public method

public getCreatedOn ( ) : DateTim\DateTime
return DateTim\DateTime

getDocumentData() public method

Return an array of tokens
public getDocumentData ( ) : array
return array

getId() public method

public getId ( ) : mixed
return mixed

getMetadata() public method

public getMetadata ( ) : array
return array

setCreatedOn() public method

public setCreatedOn ( DateTim\DateTime $createdOn ) : TokensDocument
$createdOn DateTim\DateTime
return TokensDocument

setMetadata() public method

public setMetadata ( array $metadata ) : TokensDocument
$metadata array
return TokensDocument

toArray() public method

Return the tokens
public toArray ( ) : array
return array

Property Details

$counter protected_oe static_oe property

protected static $counter

$createdOn protected_oe property

time doc was created defaults to now
protected $createdOn

$id protected_oe property

protected mixed $id
return mixed

$metadata protected_oe property

Stores an array of metadata about the document
protected array $metadata
return array

$tokens protected_oe property

An array of tokens that all Documents have
protected type $tokens
return type