PHP Class TextAnalysis\Downloaders\NltkCorporaIndexDownloader

Author: dcardin
Show file Open project: yooper/php-text-analysis Class Usage Examples

Protected Properties

Property Type Description
$packages TextAnalysis\Utilities\Nltk\Download\Package[]
$url The url to the index.xml file
$useCache boolean

Public Methods

Method Description
__construct ( string $url = 'https://raw.githubusercontent.com/yooper/pta_data/gh-pages/index.xml', boolean $useCache = false )
getPackages ( ) : array Returns an array of packages available for download from the nltk project
getUrl ( ) : string Returns the URL that file_get_contents is run against
getXmlContent ( ) : SimpleXMLElement Uses file_get_contents to pull down the content from the url

Protected Methods

Method Description
getCacheFileName ( ) : string
getUseCache ( ) : boolean Get the useCache value

Method Details

__construct() public method

public __construct ( string $url = 'https://raw.githubusercontent.com/yooper/pta_data/gh-pages/index.xml', boolean $useCache = false )
$url string Default value is provided, but you can override
$useCache boolean use the cached copy if it is available, by default it is off

getCacheFileName() protected method

protected getCacheFileName ( ) : string
return string

getPackages() public method

Returns an array of packages available for download from the nltk project
public getPackages ( ) : array
return array

getUrl() public method

Returns the URL that file_get_contents is run against
public getUrl ( ) : string
return string

getUseCache() protected method

Get the useCache value
protected getUseCache ( ) : boolean
return boolean

getXmlContent() public method

Uses file_get_contents to pull down the content from the url
public getXmlContent ( ) : SimpleXMLElement
return SimpleXMLElement

Property Details

$packages protected property

protected Package[],TextAnalysis\Utilities\Nltk\Download $packages
return TextAnalysis\Utilities\Nltk\Download\Package[]

$url protected property

The url to the index.xml file
protected $url

$useCache protected property

protected bool $useCache
return boolean