Yioop_V9.5_Source_Code_Documentation

executables

Interfaces, Classes, Traits and Enums

ArcTool
Command line program that allows one to examine the content of the WebArchiveBundles and IndexArchiveBundles of Yioop crawls.
ClassifierTool
Class used to encapsulate all the activities of the ClassifierTool.php command line script. This script allows one to automate the building and testing of classifiers, providing an alternative to the web interface when
PageIterator
This class provides the same interface as an iterator over crawl mixes, but simply iterates over an array.
ClassifierTrainer
This class is used to finalize a classifier via the web interface.
DictionaryUpdater
Fetcher
This class is responsible for fetching web pages for the SeekQuarry/Yioop search engine
MediaUpdater
Separate process/command-line script which can be used to update news sources for Yioop and also handle other kinds of activities such as video conversion. This is as an alternative to using the web app for updating. Makes use of the web-apps code.
Mirror
This class is responsible for syncing crawl archives between machines using the SeekQuarry/Yioop search engine
QueueServer
Command line program responsible for managing Yioop crawls.

Table of Contents

clean()  : bool
Used to clean trailing whitespace from files in a folder or just from a file given in the command line. If also removes final ?> characters to make php files conform with suggested coding guidelines. Similarly, adds a space between if, for, foreach, etc and ( if not present to make match PHP coding guidelines
copyright()  : bool
Updates the copyright info (assuming in Yioop docs format) on files in supplied sub-folder/file. That is, it changes strings matching /2009 - \d\d\d\d/ to 2009 - current_year in those files/file.
longlines()  : bool
Search and echos line numbers and lines for lines of length greater than 80 characters in files in supplied sub-folder/file,
needsdocs()  : bool
Search and echos line numbers and lines for lines of length greater than 80 characters in files in supplied sub-folder/file,
replace()  : bool
Performs a search and replace for given pattern in files in supplied sub-folder/file
search()  : bool
Performs a search for given pattern in files in supplied sub-folder/file
unit()  : bool
Used to run or list Yioop unit tests given in $args
changeCopyrightFile()  : mixed
Callback function applied to each file in the directory being traversed by @see copyright(). It checks if the files is of the extension of a code file and if so trims whitespace from its lines and then updates the lines of the form 2009 - \d\d\d\d to the supplied copyright year
cleanLinesFile()  : mixed
Callback function applied to each file in the directory being traversed by @see clean().
searchFile()  : mixed
Callback function applied to each file in the directory being traversed by @see search(). Searches $filename matching $pattern and outputs line numbers and lines
replaceFile()  : mixed
Callback function applied to each file in the directory being traversed by @see replace(). Searches $filename matching $pattern. Depending on $mode ($arg[2] as described in replace()), it outputs and replaces with $replace
mapPath()  : mixed
Applies the function $callback to each file in $path
excludedPath()  : bool
Checks if $path is amongst a list of paths which should be ignored

Functions

clean()

Used to clean trailing whitespace from files in a folder or just from a file given in the command line. If also removes final ?> characters to make php files conform with suggested coding guidelines. Similarly, adds a space between if, for, foreach, etc and ( if not present to make match PHP coding guidelines

clean(array<string|int, mixed> $args) : bool
Parameters
$args : array<string|int, mixed>

$args[0] contains path to sub-folder/file

Return values
bool

$no_instructions false if should output CodeTool.php instructions

Updates the copyright info (assuming in Yioop docs format) on files in supplied sub-folder/file. That is, it changes strings matching /2009 - \d\d\d\d/ to 2009 - current_year in those files/file.

copyright(array<string|int, mixed> $args) : bool
Parameters
$args : array<string|int, mixed>

$args[0] contains path to sub-folder/file

Return values
bool

$no_instructions false if should output CodeTool.php instructions

longlines()

Search and echos line numbers and lines for lines of length greater than 80 characters in files in supplied sub-folder/file,

longlines(array<string|int, mixed> $args) : bool
Parameters
$args : array<string|int, mixed>

$args[0] contains path to sub-folder/file

Return values
bool

$no_instructions false if should output CodeTool.php instructions

needsdocs()

Search and echos line numbers and lines for lines of length greater than 80 characters in files in supplied sub-folder/file,

needsdocs(array<string|int, mixed> $args) : bool
Parameters
$args : array<string|int, mixed>

$args[0] contains path to sub-folder/file

Return values
bool

$no_instructions false if should output CodeTool.php instructions

replace()

Performs a search and replace for given pattern in files in supplied sub-folder/file

replace(array<string|int, mixed> $args) : bool
Parameters
$args : array<string|int, mixed>

$args[0] contains path to sub-folder/file, $args[1] contains the regex searching for, $args[2] contains what it should be replaced with, $args[3] (defaults to effect) controls the mode of operation. One of "effect", "change", or "interactive". effect shows line number and lines matching pattern, but commits no changes; interactive for each match, prompts user if should do the change, change does a global search and replace without output

Return values
bool

$no_instructions false if should output CodeTool.php instructions

Performs a search for given pattern in files in supplied sub-folder/file

search(array<string|int, mixed> $args) : bool
Parameters
$args : array<string|int, mixed>

$args[0] contains path to sub-folder/file, $args[1] contains the regex searching for

Return values
bool

$no_instructions false if should output CodeTool.php instructions

unit()

Used to run or list Yioop unit tests given in $args

unit(array<string|int, mixed> $args) : bool
Parameters
$args : array<string|int, mixed>
  • if empty run all tests, if $args[0] == 'list' then list available test. If $args[0] == name_of_particular then run just that test. If $args[1] == name_of_particular case, then just run that test case of the particular test.
Return values
bool

whether $args made sense so could process

changeCopyrightFile()

Callback function applied to each file in the directory being traversed by @see copyright(). It checks if the files is of the extension of a code file and if so trims whitespace from its lines and then updates the lines of the form 2009 - \d\d\d\d to the supplied copyright year

changeCopyrightFile(string $filename[, mixed $set_year = false ]) : mixed
Parameters
$filename : string

name of file to check for copyright lines and updated

$set_year : mixed = false

if false then set the end of the copyright period to the current year, otherwise, if an int sets it to the value of the int

Return values
mixed

cleanLinesFile()

Callback function applied to each file in the directory being traversed by @see clean().

cleanLinesFile(string $filename) : mixed
Parameters
$filename : string

name of file to clean lines for

Return values
mixed

searchFile()

Callback function applied to each file in the directory being traversed by @see search(). Searches $filename matching $pattern and outputs line numbers and lines

searchFile(string $filename[, mixed $set_pattern = false ]) : mixed
Parameters
$filename : string

name of file to search in

$set_pattern : mixed = false

if not false, then sets $set_pattern in $pattern to initialize the callback on subsequent calls. $pattern here is the search pattern

Return values
mixed

replaceFile()

Callback function applied to each file in the directory being traversed by @see replace(). Searches $filename matching $pattern. Depending on $mode ($arg[2] as described in replace()), it outputs and replaces with $replace

replaceFile(string $filename[, mixed $set_pattern = false ][, mixed $set_replace = false ][, mixed $set_mode = false ]) : mixed
Parameters
$filename : string

name of file to search and replace in

$set_pattern : mixed = false

if not false, then sets $set_pattern in $pattern to initialize the callback on subsequent calls. $pattern here is the search pattern

$set_replace : mixed = false

if not false, then sets $set_replace in $replace to initialize the callback on subsequent calls.

$set_mode : mixed = false

if not false, then sets $set_mode in $mode to initialize the callback on subsequent calls.

Return values
mixed

mapPath()

Applies the function $callback to each file in $path

mapPath(string $path, string $callback) : mixed
Parameters
$path : string

to apply map $callback to

$callback : string

function name to call with filename of each file in path

Return values
mixed

excludedPath()

Checks if $path is amongst a list of paths which should be ignored

excludedPath( $path) : bool
Parameters
$path :

a directory path

Return values
bool

whether or not it should be ignored (true == ignore)

Search results