PHP Class TextAnalysis\Indexes\InvertedIndex

Author: yooper (yooper)
Afficher le fichier Open project: yooper/php-text-analysis Class Usage Examples

Protected Properties

Свойство Type Description
$index array The index

Méthodes publiques

Méthode Description
__construct ( TextAnalysis\Interfaces\IDataReader $reader ) Pass in the pre-built indexes for doing lookups
__destruct ( ) clean up
addDocument ( TokensDocument $document ) : void Add a document
getDocumentIdsByTerm ( string $term ) : array
getIndex ( ) : array Return the internal index data structure
getTermsByDocumentId ( mixed $docId ) : array Returns the key value array with the terms found in the document for the given doc id
query ( string $queryStr ) : array Accepts a string a query and returns the set of documents relevant to the query
removeDocument ( mixed $docId ) : boolean True if the doc was removed

Method Details

__construct() public méthode

Pass in the pre-built indexes for doing lookups
public __construct ( TextAnalysis\Interfaces\IDataReader $reader )
$reader TextAnalysis\Interfaces\IDataReader

__destruct() public méthode

clean up
public __destruct ( )

addDocument() public méthode

Add a document
public addDocument ( TokensDocument $document ) : void
$document TextAnalysis\Documents\TokensDocument
Résultat void

getDocumentIdsByTerm() public méthode

public getDocumentIdsByTerm ( string $term ) : array
$term string
Résultat array

getIndex() public méthode

Return the internal index data structure
public getIndex ( ) : array
Résultat array

getTermsByDocumentId() public méthode

Returns the key value array with the terms found in the document for the given doc id
public getTermsByDocumentId ( mixed $docId ) : array
$docId mixed
Résultat array

query() public méthode

Accepts a string a query and returns the set of documents relevant to the query
public query ( string $queryStr ) : array
$queryStr string
Résultat array

removeDocument() public méthode

True if the doc was removed
public removeDocument ( mixed $docId ) : boolean
$docId mixed
Résultat boolean

Property Details

$index protected_oe property

The index
protected array $index
Résultat array