/**
  * Gets the PartsOfSpeech for the entries that start with the given word.
  *
  * @param string $word
  * @return array of parts of speech
  */
 public static function GetPartsOfSpeech($word)
 {
     //get the thesaurus
     $pos_array = file(dirname(__FILE__) . "/thesaurus_files/moby_part_of_speech.txt");
     $poss = array();
     foreach ($pos_array as $entry) {
         if (MobyThesaurus::StartsWith($word, $entry)) {
             //split the word from it's parts of speech
             $line_arr = split("[\\]", $entry);
             $poss[$line_arr[0]] = array();
             $line_arr[1] = trim($line_arr[1]);
             //go through each part of speech item
             for ($i = 0; $i < strlen($line_arr[1]); $i++) {
                 $symbol = trim($line_arr[1][$i]);
                 array_push($poss[$line_arr[0]], $symbol);
             }
         }
     }
     return $poss;
 }
<?php

require_once 'MobyThesaurus.php';
echo "<h1>Demonstrating MobyThesaurus Class</h1>";
echo "<h3>Getting Synonyms for 'medications' (MobyThesaurus::GetSynonyms)</h3>";
$start_time = microtime(true);
$synonyms = MobyThesaurus::GetSynonyms("medication");
var_dump($synonyms);
echo "<br><br>Processing Time: " . (microtime(true) - $start_time) . "<br>";
echo "<br><h3>Getting Part of Speech for 'feel' (MobyThesaurus::GetPartsOfSpeech)</h3>";
$start_time = microtime(true);
$pos = MobyThesaurus::GetPartsOfSpeech("cat");
var_dump($pos);
echo "<br><br>Processing Time: " . (microtime(true) - $start_time) . "<br>";