6 * Segment of a query string.
8 * The parts of a query strings are usually separated by commas.
12 // Complete phrase as a string.
14 // Element type for structured searches.
16 // Possible segmentations of the phrase.
19 public function __construct($sPhrase, $sPhraseType)
21 $this->sPhrase = trim($sPhrase);
22 $this->sPhraseType = $sPhraseType;
26 * Get the orginal phrase of the string.
28 public function getPhrase()
30 return $this->sPhrase;
34 * Return the element type of the phrase.
36 * @return string Pharse type if the phrase comes from a structured query
37 * or empty string otherwise.
39 public function getPhraseType()
41 return $this->sPhraseType;
44 public function setWordSets($aWordSets)
46 $this->aWordSets = $aWordSets;
50 * Return the array of possible segmentations of the phrase.
52 * @return string[][] Array of segmentations, each consisting of an
55 public function getWordSets()
57 return $this->aWordSets;
61 * Invert the set of possible segmentations.
65 public function invertWordSets()
67 foreach ($this->aWordSets as $i => $aSet) {
68 $this->aWordSets[$i] = array_reverse($aSet);
72 public function debugInfo()
75 'Type' => $this->sPhraseType,
76 'Phrase' => $this->sPhrase,
77 'WordSets' => $this->aWordSets