From: Sarah Hoffmann Date: Fri, 13 Oct 2017 19:23:45 +0000 (+0200) Subject: add documentation for Phrase X-Git-Tag: v3.1.0~43^2~5 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/c700421aa7a5509d096d6064379b2793ed191d69 add documentation for Phrase --- diff --git a/lib/Phrase.php b/lib/Phrase.php index 23b9e3ca..0fe1d313 100644 --- a/lib/Phrase.php +++ b/lib/Phrase.php @@ -29,16 +29,35 @@ class Phrase $this->aWordSets = $this->createWordSets($this->aWords, 0); } + /** + * Return the element type of the phrase. + * + * @return string Pharse type if the phrase comes from a structured query + * or empty string otherwise. + */ public function getPhraseType() { return $this->sPhraseType; } + /** + * Return the array of possible segmentations of the phrase. + * + * @return string[][] Array of segmentations, each consisting of an + * array of terms. + */ public function getWordSets() { return $this->aWordSets; } + /** + * Add the tokens from this phrase to the given list of tokens. + * + * @param string[] $aTokens List of tokens to append. + * + * @return void + */ public function addTokens(&$aTokens) { foreach ($this->aWordSets as $aSet) { @@ -49,6 +68,11 @@ class Phrase } } + /** + * Invert the set of possible segmentations. + * + * @return void + */ public function invertWordSets() { $this->aWordSets = $this->createInverseWordSets($this->aWords, 0); @@ -72,7 +96,7 @@ class Phrase return $aResult; } - public function createInverseWordSets($aWords, $iDepth) + private function createInverseWordSets($aWords, $iDepth) { $aResult = array(array(join(' ', $aWords))); $sFirstToken = '';