public function adverbFitsSlot($word, $keyslot) { $CI =& get_instance(); $CI->load->library('Mymatching'); $matching = new Mymatching(); $numclasses = count($word->classes); $matchscore = 1000; $matchindexclass = -1; $output = 0; for ($i = 0; $i < $numclasses; $i++) { // comprovem que la classe d'adverbi existeixi i que el type de l'slot accepti adverbis if ($matching->isSetKeyAdv($word->classes[$i]) && $matching->isSetKeyAdv($this->type)) { $tipusx = $matching->advQuantFitKeys[$this->type]; // agafem l'index del tipus d'adverbi de l'slot $tipusy = $matching->advQuantFitKeys[$word->classes[$i]]; if ($matching->advQuantFit[$tipusx][$tipusy] < $matchscore) { $matchscore = $matching->advQuantFit[$tipusx][$tipusy]; $matchindexclass = $i; } } } // Fins aquí hem vist si la paraula podia anar a un slot // Si podia anar a un slot, l'slot està buit i l'slot no és de lloc fem un fill temporal normal if ($matchscore != 1000 && !$this->full && $this->type != "lloc") { $this->fillSlotTemp($word, $matchscore, $matchindexclass, $keyslot); $output = 1; } else { if ($matchscore == 0 && $this->type == "lloc") { // només poden anar els adverbis com a complement del nom que està omplint l'slot // per tant l'slot ha d'estar ple if ($this->full) { $numcomplements = count($this->cmpAdvs); $newslot = new Myslot(); $word->slotstemps[] = $keyslot . " ADV " . $numcomplements; // per dir que està de compl. de nom $newslot->category = $this->category . " ADV"; $newslot->grade = "opt"; $newslot->prep = "de"; $newslot->full = true; $newslot->paraulafinal = $word; $newslot->level = $this->level + 1; $newslot->parent = $keyslot; $newslot->puntsfinal = $matchscore; // Són els punts del fit amb l'slot de lloc // deixarien un slot opt buit $newslot->indexclassfinalword = 0; $this->cmpAdvs[$keyslot . " ADV " . $numcomplements] = $newslot; $output = 1; } } } return $output; }