Semantic MediaWiki and related extensions
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
Lingo\Tree Class Reference

Public Member Functions

 addTerm (&$term, $definition)
 
 getMinTermLength ()
 
 getTermList ()
 
 findNextTerm (&$lexemes, $index, $countLexemes)
 
 findNextTermNoSkip (array &$tree, &$lexemes, $index, $countLexemes)
 

Public Attributes

const TREE_VERSION = 2
 

Protected Member Functions

addElement (array &$path, &$term, &$definition)
 

Detailed Description

The Lingo class.

Vocabulary: Term - The term as a normal string Definition - Its definition (any object) Element - An element (leaf) in the glossary tree Path - The path in the tree to the leaf representing a term

The glossary is organized as a tree (nested arrays) where the path to the definition of a term is the lexemes of the term followed by -1 as the end marker.

Example: The path to the definition of the term "foo bar baz" would be 'foo'.' '.'bar'.' '.'baz'.'-1'. It could thus be accessed as $mTree['foo'][' ']['bar'][' ']['baz'][-1]

Member Function Documentation

◆ addElement()

& Lingo\Tree::addElement ( array &  $path,
$term,
$definition 
)
protected

Adds an element to the Lingo Tree

Parameters
array$pathAn array containing the constituing lexemes of the term
String$term
array$definition
Returns
array the tree node the element was stored in

◆ addTerm()

Lingo\Tree::addTerm ( $term,
  $definition 
)

Adds a string to the Lingo Tree

Parameters
string$term
array$definition

◆ findNextTerm()

Lingo\Tree::findNextTerm ( $lexemes,
  $index,
  $countLexemes 
)
Parameters
$lexemes
int$index
int$countLexemes
Returns
array

◆ findNextTermNoSkip()

Lingo\Tree::findNextTermNoSkip ( array &  $tree,
$lexemes,
  $index,
  $countLexemes 
)
Parameters
array$tree
$lexemes
$index
$countLexemes
Returns
array

◆ getMinTermLength()

Lingo\Tree::getMinTermLength ( )
Returns
int

◆ getTermList()

Lingo\Tree::getTermList ( )
Returns
array

The documentation for this class was generated from the following file:

About | General disclaimer | Privacy policy