[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lojban] Re: Online jbofi'e broken?



On Sun, Aug 12, 2007 at 02:11:22PM +0400, Cyril Slobin wrote:
> coi rodo
> 
> It seems like online jbofi'e at http://www.lojban.org/jboski/ is
> partially broken. When I enter a gendra sentence, it is parsed
> well, by on broken sentences it just kept silent. No error
> messages, no "Last successfully parsed tokens", no nothing. Anyone
> to fix?

Source code attached.  Be my guest.

-Robin

-- 
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
Reason #237 To Learn Lojban: "Homonyms: Their Grate!"
Proud Supporter of the Singularity Institute - http://singinst.org/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head>

<title>
  Lojbanic Translator
</title>

    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" xml:lang="en" />
    <meta name="keywords" content="lojban lojban.org www.lojban.org constructed language linguistics" />

    <!-- <body background="lalojbana2.jpg"> -->

    <link rel="stylesheet" type="text/css" media="all" href="../lojban_org.css" />

</head>

<body>

    <div class="topbar">

	<h1>
	    <img src="../venn_emboss.gif" alt="Lojban Logo" />
	    <a class="middle" href="http://www.lojban.org/";>Lojban: The Logical Language</a>
	    <img src="../venn_emboss.gif" alt="Lojban Logo" />
	</h1>

	<div class="green">
	    If you are new to Lojban or this site, please <a
	    href="../help.html">read the help
	    page</a> first.
	</div>
	
	<br />

	<div class="centeredyellow">
	    Finding Lojbanic Information:
	    [ 
	    <a class="black" href="../help.html">Help</a> |
	    <a class="black" href="../resources.html">Resources</a> |
	    <a class="black" href="../quick.html">Popular Pages</a> |
	    <a class="black" href="../sitemap.html">Site Map</a> |
	    <a class="black" href="../search.html">Search</a>
	    ]
	</div>
	<div class="centeredblue">
	    Basic Information About Lojban:
	    [ 
	    <a class="black" href="../resources/faq.html">FAQ</a> |
	    <a class="black" href="../about.html">About Lojban</a> |
	    <a class="black" href="../llg.html">General LLG Information</a> |
	    <a class="black" href="../whats_new.html">News</a>
	    ]
	</div>
	<div class="centeredyellow">
	    Learning Lojban:
	    [ 
	    <a class="black" href="../beginners.html">Just Starting Out</a> |
	    <a class="black" href="../advanced.html">Experienced</a> |
	    <a class="black" href="../publications.html">LLG Publications</a> |
	    <a class="black" href="../texts.html">Texts In Lojban</a>
	    ]
	</div>
	<div class="centeredblue">
	    Helping The Lojban Community:
	    [ 
	    <a class="black" href="../llg/projects.html">Projects</a> |
	    <a class="black" href="../llg/committees.html">LLG Committees</a> |
	    <a class="black" href="../howtohelp.html">How You Can Help</a> |
	    <a class="black" href="../feedback.html">Give Feedback</a>
	    ]
	</div>
        <div class="centeredyellow">
            Languages:
	    <a href="http://www.lojban.org/jbo/"; title="Lojban"><img class="langflag" src="http://www.lojban.org/pics/flags/loj.gif"; alt=" [Lojban] " width="32" height="20" /></a> |
	    <a href="http://www.lojban.org/eo/"; title="Esperanto"><img class="langflag" src="http://www.lojban.org/pics/flags/eo.gif"; alt=" [Esperanto] " width="26" height="20" /></a> |
	    <a href="http://www.lojban.org/fr/"; title="Français"><img class="langflag" src="http://www.lojban.org/pics/flags/fr.gif"; alt=" [Français] " width="30" height="20" /></a> |
	    <a href="http://www.lojban.org/de/"; title="Deutsch"><img class="langflag" src="http://www.lojban.org/pics/flags/de.gif"; alt=" [Deutsch] " width="33" height="20" /></a> |
	    <a href="http://www.lojban.org/he/"; title="Ivrit"><img class="langflag" src="http://www.lojban.org/pics/flags/il.gif"; alt=" [Ivrit] " width="27" height="20" /></a> |
	    <a href="http://www.lojban.org/no/"; title="Norsk"><img class="langflag" src="http://www.lojban.org/pics/flags/no.gif"; alt=" [Norsk] " width="27" height="20" /></a> |
	    <a href="http://www.lojban.org/es/"; title="Español"><img class="langflag" src="http://www.lojban.org/pics/flags/es.gif"; alt=" [Español] " width="30" height="20" /></a> |
	    <a href="http://www.lojban.org/sv/"; title="Swedish"><img class="langflag" src="http://www.lojban.org/pics/flags/se.gif"; alt=" [Swedish] " width="31" height="20" /></a> |
	    <a href="http://www.lojban.org/en/"; title="English"><img class="langflag" src="http://www.lojban.org/pics/flags/usa_uk_small.gif"; alt=" [English] " width="31" height="20" /></a>
        </div>
    </div>




<h1>Lojban-To-English Translation</h1>

<form action="../jboski/index.php" method="post">
Enter Lojban text here:
<br />
<textarea name="jbocku" cols="80" rows="10"></textarea>
<br />
Simplified Markup: <input type="checkbox" name="lunbe" />
Number of columns: <input name="nilcla" type="text" value="80" size="3" /> 
<input type="submit" value="Submit" />
</form>

<?php
if (isset($_REQUEST['jbocku'])) {
  $jbocku = $_REQUEST['jbocku'];
  if (isset($_REQUEST['nilcla']) && ereg("^[0-9]+\$", $_REQUEST['nilcla']))
     $nilcla = $_REQUEST['nilcla'];
  else
     $nilcla = 80;
  if (isset($_REQUEST['lunbe']))
     $lunbe = $_REQUEST['lunbe'];
  else
     $lunbe = 0;

  echo "<hr /><h1>jbofi'e says:</h1>";

  /*** Create some temporary files ***/
  $iname = tempnam("/tmp", "jboski_in");
  $hname = tempnam("/tmp", "jboski_out");
  $ename = tempnam("/tmp", "jboski_err");

  /*** Transform CR to LF and write the text to translate to a file ***/
  $jbocku = StripSlashes(strtr($jbocku, "\r", "\n"));
  if ($fp = fopen("$iname", "w")) {
    fputs($fp, $jbocku);
    fclose($fp);
  }

  /*** Do the translation **/
  if ($lunbe) {
    /*** terminal-like formatting ***/
    echo "<pre class=\"blocktranslation\">";
    passthru("/usr/bin/jbofihe -b -x -w $nilcla <$iname 2>&1");
    echo "</pre>";

  } else {
    /*** HTML formatting ***/

    /* retrieve the translation */
    $ret = 0;
    system("(jbofihe -H <$iname 2>&1 || kill -9 \$\$) | tee $ename | tail -n +5 >$hname", $ret);

      /* in case something failed */
      echo "<pre class=\"translationerror\">"; passthru("cat $ename"); echo "</pre>";

      /* retrieve the result and do the necessary substitutions */      
      $content = join('', file($hname));
      $content = str_replace("</BODY>", "", $content);
      $content = str_replace("<SUB><FONT SIZE=\"-3\">", "<sub class=\"parenmark\">", $content);
      $content = str_replace("</FONT></SUB>", "</sub>", $content);
      $content = str_replace("<U><FONT SIZE=-1>", "<em class=\"sumtiplace\">", $content);
      $content = str_replace("</FONT></U>", "</em>", $content);
      $content = str_replace("<I>", "<em class=\"translation\">", $content);
      $content = str_replace("</I>", "</em>", $content);
      $content = str_replace("<B>", "<strong class=\"lojban\">", $content);
      $content = str_replace("</B>", "</strong>", $content);
      $content = str_replace("&gt;&gt;", "&raquo;", $content);
      $content = str_replace("&lt;&lt;", "&laquo;", $content);
      $content = str_replace("<P>", "<br />", $content);
      echo $content;
  }

  /*** Delete the temporary files ***/
  unlink($iname);
  unlink($hname);
  unlink($ename);
}
?>

<hr />
<p class="small">
<a href="http://go.to/jbofihe/";>la jbofi'e</a> was created by
<a href="mailto:richard@rrbcurnow.freeuk.com";>Richard Curnow</a>
<br />
This program was created by <a
href="mailto:r.poss@online.fr";>Rapha&euml;l Poss</a>
</p>

    <hr />
    
    <p>Last modified: Mon Jun 27 23:11:56 PDT 2005</p>

    <p>Please <a
    href="../llg/feedback.php">contact us</a>
    with any comments, suggestions or concerns.</p>

</body>
</html>