PHP Класс TextAnalysis\Indexes\InvertedIndex

Автор: yooper (yooper)
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$index array The index

Открытые методы

Метод Описание
__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

Описание методов

__construct() публичный метод

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

__destruct() публичный метод

clean up
public __destruct ( )

addDocument() публичный метод

Add a document
public addDocument ( TokensDocument $document ) : void
$document TextAnalysis\Documents\TokensDocument
Результат void

getDocumentIdsByTerm() публичный метод

public getDocumentIdsByTerm ( string $term ) : array
$term string
Результат array

getIndex() публичный метод

Return the internal index data structure
public getIndex ( ) : array
Результат array

getTermsByDocumentId() публичный метод

Returns the key value array with the terms found in the document for the given doc id
public getTermsByDocumentId ( mixed $docId ) : array
$docId mixed
Результат array

query() публичный метод

Accepts a string a query and returns the set of documents relevant to the query
public query ( string $queryStr ) : array
$queryStr string
Результат array

removeDocument() публичный метод

True if the doc was removed
public removeDocument ( mixed $docId ) : boolean
$docId mixed
Результат boolean

Описание свойств

$index защищенное свойство

The index
protected array $index
Результат array