X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/ccaf7fa47fc7b02927ca4fe0f717e9e5b725ab9d..a727823ae20c61a7d2287bfe47ba3dc49c89bf58:/lib/lib.php diff --git a/lib/lib.php b/lib/lib.php index 4b68b4a3..25282756 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -193,6 +193,26 @@ return $aResult; } + function getInverseWordSets($aWords, $iDepth) + { + $aResult = array(array(join(' ',$aWords))); + $sFirstToken = ''; + if ($iDepth < 8) + { + while(sizeof($aWords) > 1) + { + $sWord = array_pop($aWords); + $sFirstToken = $sWord.($sFirstToken?' ':'').$sFirstToken; + $aRest = getInverseWordSets($aWords, $iDepth+1); + foreach($aRest as $aSet) + { + $aResult[] = array_merge(array($sFirstToken),$aSet); + } + } + } + return $aResult; + } + function getTokensFromSets($aSets) {