Input file:

Output file:

","",$word); $word = ereg_replace("[<>|{]","",$word); $commands .= " -e 'apply up $word'"; } } } $commands .= " -stop"; unset($parsable); exec($commands,$parsable); $commands = $xfst_path; foreach($parsable as $p) { $commands .= " -e 'apply down $p'"; } $commands .= " -stop"; unset($verbs); exec($commands,$verbs); sort($verbs); $verbs = array_unique($verbs); /* foreach($verbs as $v) { echo "$v
"; } */ //$in = file("Burroh.html"); $in = file($inputfile); $s = ""; foreach($in as $line) { $s .= $line; } $newLink = ""; $other=""; foreach($verbs as $v) { $v = utf8_decode($v); //$s = ereg_replace($v,"$v",$s); //$newLink = " $v"; //$other = getVerbSenses($v); $s = ereg_replace($v,$newLink,$s); } //" " and $ //$out = fopen("Burroh_with_links_lg.html","w"); $out = fopen($outputfile,"w"); fwrite($out,$s); fclose($out); //echo "; function GetSenses($word){ global $verbStem; $urltoSenses = "http://hyperlex2.ldc.upenn.edu/nahuatl/search_results.php4?user_lang=english&condition=word_search&word=".$verbStem."&entry_template=englishwordsense.html&bg_template=english%senses_template.html"; $strIframe = htmlentities ("
"); return $strIframe; } function GetVerbSenses($word){ { global $verbStem; $table = ""; $word = strtolower($word); //$word = utf8_encode($word); $utfConverter = new utf8(); $word = $utfConverter->strToUtf8($word); $xfst_path = "/spd25/htdocs/hyperlex2/nahuatl/xfst_dir/xfst -utf8 -e 'loadd SurfaceForms.fsm' -e 'regex GlSR;'"; $command = $xfst_path." -e 'apply up $word' -stop"; unset($parse); exec($command,$parse); //$result = utf8_decode(trim($parse[3])); $result = $utfConverter->utf8ToStr(trim($parse[3])); if($result != "") { $command = "/spd25/htdocs/hyperlex2/nahuatl/xfst_dir/xfst -utf8 -e 'loadd SurfaceForms.fsm'"; //$command = "xfst -utf8 -e 'loadd SurfaceForms.fsm'"; $command .= " -e 'regex GlUR;' -e 'apply down $result' -stop"; unset($parse); $foo = exec($command,$parse); $temp = $parse[3]; /* foreach($parse2 as $p) { echo utf8_decode($p)."
"; } */ if($temp != "") { $table = ""; } $table = $table . "
"; $table = $table . "Parse: $temp "; $table = $table . "
"; $parts = explode("-",$result); $index = count($parts)-2; $results[0] = $parts[$index]; $verbStem = $results[0]; $table = $table . ""; if($index == 1) { $table = $table . ""; } else if($index == 2) { $table = $table . "
"; $table = $table . "Gloss: $result "; $table = $table . "
"; $table = $table . "Verb stem:"; $table = $table . "".$results[0].""; $table = $table . "
"; $results[1] = "intrans"; $table = $table . "Part of speech: Intransitive Oapan verb"; $table = $table . "
"; $results[1] = "trans"; $table = $table . "Part of speech: Transitive Oapan verb"; //$table = $table . "
"; $table = $table . ""; } return $table; } return ""; } } ?>