Example #1
0
 public function parseQuery($query)
 {
     switch ($query) {
         /***********************************************************************************/
         // Include defparse class and create new object with 3 variables.
         /***********************************************************************************/
         case "def":
             if (isset($this->langParameters) and isset($this->word) and isset($this->source) and isset($this->count)) {
                 $DefParse = new DefParse($this->langParameters);
                 $wikitext = $this->get_wiki_text($this->langParameters, $this->source, $this->word);
                 if (isset($DefParse)) {
                     $parsedDefinition = $DefParse->getDef($wikitext, $this->count);
                 }
             }
             break;
             /***********************************************************************************/
             // Include posparse class and create new object with 3 variables.
             /***********************************************************************************/
         /***********************************************************************************/
         // Include posparse class and create new object with 3 variables.
         /***********************************************************************************/
         case "pos":
             include 'lib/class.posparse.php';
             if (isset($this->langParameters) and isset($this->word) and isset($this->source) and isset($this->count)) {
                 $posparse = new PosParse($this->langParameters);
                 $wikitext = $this->get_wiki_text($this->langParameters, $this->source, $this->word);
                 if (isset($DefParse)) {
                     $parsedDefinition = $posparse->get_pos($wikitext, $this->count);
                 }
             }
             break;
             /***********************************************************************************/
             // Include synparse class and create new object with 3 variables.
             /***********************************************************************************/
         /***********************************************************************************/
         // Include synparse class and create new object with 3 variables.
         /***********************************************************************************/
         case "syn":
             include 'lib/class.synparse.php';
             if (isset($this->langParameters) and isset($this->word) and isset($this->source) and isset($this->count)) {
                 $SynParse = new SynParse($this->langParameters);
                 $wikitext = $this->get_wiki_text($this->langParameters, $this->source, $this->word);
                 if (isset($DefParse)) {
                     $parsedDefinition = $SynParse->get_syn($wikitext, $this->count);
                 }
             }
             break;
             /***********************************************************************************/
             // Include hyperparse class and create new object with 3 variables. (Hypernyms)
             /***********************************************************************************/
         /***********************************************************************************/
         // Include hyperparse class and create new object with 3 variables. (Hypernyms)
         /***********************************************************************************/
         case "hyper":
             include 'lib/class.hyperparse.php';
             if (isset($this->langParameters) and isset($this->word) and isset($this->source) and isset($this->count)) {
                 $HyperParse = new HyperParse($this->langParameters);
                 $wikitext = $this->get_wiki_text($this->langParameters, $this->source, $this->word);
                 if (isset($DefParse)) {
                     $parsedDefinition = $HyperParse->get_hyper($wikitext, $this->count);
                 }
             }
             break;
             /***********************************************************************************/
             // Include genderparse class and create new object with 3 variables. (Gender)
             /***********************************************************************************/
         /***********************************************************************************/
         // Include genderparse class and create new object with 3 variables. (Gender)
         /***********************************************************************************/
         case "gender":
             include 'lib/class.genderparse.php';
             if (isset($this->langParameters) and isset($this->word) and isset($this->source) and isset($this->count)) {
                 $GenderParse = new GenderParse($this->langParameters);
                 $wikitext = $this->get_wiki_text($this->langParameters, $this->source, $this->word);
                 if (isset($DefParse)) {
                     $parsedDefinition = $GenderParse->get_gender($wikitext, $this->count);
                 }
             }
             break;
             /***********************************************************************************/
         /***********************************************************************************/
         default:
             echo "You must specify a valid query type ('pos', 'def', 'syn', 'hyper', or 'gender').";
             break;
     }
     if (isset($parsedDefinition)) {
         return $parsedDefinition;
     } else {
         return [];
     }
 }
Example #2
0
 case "pos":
     include 'classes/class.posparse.php';
     $posparse = new PosParse($langParameters);
     $wikitext = get_wiki_text($langParameters, $wikiSource, $word);
     $posArray = $posparse->get_pos($wikitext, $count);
     printResults($posArray);
     break;
     /***********************************************************************************/
     // Include synparse class and create new object with 3 variables.
     /***********************************************************************************/
 /***********************************************************************************/
 // Include synparse class and create new object with 3 variables.
 /***********************************************************************************/
 case "syn":
     include 'classes/class.synparse.php';
     $SynParse = new SynParse($langParameters);
     $wikitext = get_wiki_text($langParameters, $wikiSource, $word);
     $synArray = $SynParse->get_syn($wikitext, $count);
     printResults($synArray);
     break;
     /***********************************************************************************/
     // Include hyperparse class and create new object with 3 variables. (Hypernyms)
     /***********************************************************************************/
 /***********************************************************************************/
 // Include hyperparse class and create new object with 3 variables. (Hypernyms)
 /***********************************************************************************/
 case "hyper":
     include 'classes/class.hyperparse.php';
     $HyperParse = new HyperParse($langParameters);
     $wikitext = get_wiki_text($langParameters, $wikiSource, $word);
     $hyperArray = $HyperParse->get_hyper($wikitext, $count);