Now translation tool accepts synonyms separated by ';' in the entry field.
This commit is contained in:
parent
115d0e0e6c
commit
e89c49651c
5 changed files with 37 additions and 10 deletions
|
@ -224,7 +224,7 @@ public class BinaryFileGenerator extends SimplifiedLinkedList
|
||||||
int currentPage=0, currentLine=1;
|
int currentPage=0, currentLine=1;
|
||||||
char ch;
|
char ch;
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(archivo)));
|
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(archivo)));
|
||||||
String entrada="", s1="", s2="", currentLetter="", temp="", lastWeirdDefiniendum="";
|
String entrada="", s1="", s2="", currentLetter="", temp="", lastWeirdDefiniendum="", alternateWords[];
|
||||||
boolean markerNotFound;
|
boolean markerNotFound;
|
||||||
|
|
||||||
// used for acip dict
|
// used for acip dict
|
||||||
|
@ -504,7 +504,17 @@ public class BinaryFileGenerator extends SimplifiedLinkedList
|
||||||
{
|
{
|
||||||
s1 = deleteQuotes(entrada.substring(0,marker).trim());
|
s1 = deleteQuotes(entrada.substring(0,marker).trim());
|
||||||
s2 = deleteQuotes(entrada.substring(marker+1).trim());
|
s2 = deleteQuotes(entrada.substring(marker+1).trim());
|
||||||
add(s1, s2 , defNum);
|
marker2 = s1.indexOf(';');
|
||||||
|
if (marker2>0)
|
||||||
|
{
|
||||||
|
alternateWords = Manipulate.parseFields(s1, ';');
|
||||||
|
for (marker2=0; marker2<alternateWords.length; marker2++)
|
||||||
|
{
|
||||||
|
add(alternateWords[marker2],s2, defNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else add(s1, s2 , defNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentLine++;
|
currentLine++;
|
||||||
|
|
|
@ -17,8 +17,8 @@ Contributor(s): ______________________________________.
|
||||||
*/
|
*/
|
||||||
package org.thdl.tib.scanner;
|
package org.thdl.tib.scanner;
|
||||||
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import org.thdl.util.*;
|
||||||
|
|
||||||
/** Miscelaneous static methods for the manipulation of Tibetan text.
|
/** Miscelaneous static methods for the manipulation of Tibetan text.
|
||||||
|
|
||||||
|
@ -27,6 +27,23 @@ import java.io.*;
|
||||||
|
|
||||||
public class Manipulate
|
public class Manipulate
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public static String[] parseFields (String s, char delimiter)
|
||||||
|
{
|
||||||
|
int pos;
|
||||||
|
String field;
|
||||||
|
SimplifiedLinkedList ll = new SimplifiedLinkedList();
|
||||||
|
|
||||||
|
while ((pos = s.indexOf(delimiter))>=0)
|
||||||
|
{
|
||||||
|
field = s.substring(0, pos).trim();
|
||||||
|
ll.addLast(field);
|
||||||
|
s = s.substring(pos+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ll.addLast(s.trim());
|
||||||
|
return ll.toStringArray();
|
||||||
|
}
|
||||||
|
|
||||||
public static String replace(String linea, String origSub, String newSub)
|
public static String replace(String linea, String origSub, String newSub)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,8 +81,8 @@ public class OnLineScannerFilter extends HttpServlet
|
||||||
else
|
else
|
||||||
out.println(" <title>The Online Tibetan to English Translation/Dictionary Tool</title>");
|
out.println(" <title>The Online Tibetan to English Translation/Dictionary Tool</title>");
|
||||||
|
|
||||||
out.println(" <META name=\"keywords\" content=\"tibetan, english, dictionary, jim valby, rangjung yeshe, jeffrey hopkins, tsig mdzod chen mo, online, translation, scanner, parser, buddhism, language, processing, font, dharma, chos, tibet\">");
|
out.println(" <meta name=\"keywords\" content=\"tibetan, english, dictionary, jim valby, rangjung yeshe, jeffrey hopkins, tsig mdzod chen mo, online, translation, scanner, parser, buddhism, language, processing, font, dharma, chos, tibet\">");
|
||||||
out.println(" <META NAME=\"Description\" CONTENT=\"This Java tool takes Tibetan language passages and divides the passages up into their component phrases and words, and displays corresponding dictionary definitions.\">");
|
out.println(" <meta name=\"Description\" content=\"This Java tool takes Tibetan language passages and divides the passages up into their component phrases and words, and displays corresponding dictionary definitions.\">");
|
||||||
out.println(" <meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\">");
|
out.println(" <meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\">");
|
||||||
|
|
||||||
script = request.getParameter("script");
|
script = request.getParameter("script");
|
||||||
|
@ -93,7 +93,6 @@ public class OnLineScannerFilter extends HttpServlet
|
||||||
wantsTibetan = (script==null || script.equals("tibetan"));
|
wantsTibetan = (script==null || script.equals("tibetan"));
|
||||||
if (wantsTibetan)
|
if (wantsTibetan)
|
||||||
{
|
{
|
||||||
out.println("<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
|
|
||||||
out.println("<style>.tmw {font: 28pt TibetanMachineWeb}");
|
out.println("<style>.tmw {font: 28pt TibetanMachineWeb}");
|
||||||
out.println(".tmw1 {font: 28pt TibetanMachineWeb1}");
|
out.println(".tmw1 {font: 28pt TibetanMachineWeb1}");
|
||||||
out.println(".tmw2 {font: 28pt TibetanMachineWeb2}");
|
out.println(".tmw2 {font: 28pt TibetanMachineWeb2}");
|
||||||
|
@ -168,9 +167,9 @@ public class OnLineScannerFilter extends HttpServlet
|
||||||
out.println(" <td width=\"75%\">");
|
out.println(" <td width=\"75%\">");
|
||||||
out.println(" <p><input type=\"radio\" value=\"tibetan\" ");
|
out.println(" <p><input type=\"radio\" value=\"tibetan\" ");
|
||||||
if (wantsTibetan) out.println("checked ");
|
if (wantsTibetan) out.println("checked ");
|
||||||
out.println("name=\"script\">Tibetan script (using <a href=\"http://iris.lib.virginia.edu/tibet/tools/tmw.html\" target=\"_blank\">Tibetan Machine Web font</a>)<br>");
|
out.println("name=\"script\">Tibetan script (using <a href=\"http://iris.lib.virginia.edu/tibet/tools/tmw.html\" target=\"_blank\">Tibetan Machine Web font</a>)<br/>");
|
||||||
out.println(" <input type=\"radio\" value=\"roman\" ");
|
out.println(" <input type=\"radio\" value=\"roman\" ");
|
||||||
if (!wantsTibetan) out.println("checked ");
|
if (!wantsTibetan) out.println("checked ");
|
||||||
out.println("name=\"script\">Roman script</td>");
|
out.println("name=\"script\">Roman script</td>");
|
||||||
out.println(" </tr>");
|
out.println(" </tr>");
|
||||||
out.println("</table>");
|
out.println("</table>");
|
||||||
|
|
|
@ -27,7 +27,7 @@ public abstract class TibetanScanner
|
||||||
{
|
{
|
||||||
public static final String copyrightUnicode="Copyright " + '\u00A9' + " 2000-2003 by Andr" + '\u00E9' + "s Montano Pellegrini, all rights reserved.";
|
public static final String copyrightUnicode="Copyright " + '\u00A9' + " 2000-2003 by Andr" + '\u00E9' + "s Montano Pellegrini, all rights reserved.";
|
||||||
public static final String copyrightASCII="Copyright 2000-2003 by Andres Montano Pellegrini, all rights reserved.";
|
public static final String copyrightASCII="Copyright 2000-2003 by Andres Montano Pellegrini, all rights reserved.";
|
||||||
public static final String copyrightHTML="<hr><small><strong>" + "The Tibetan to English Translation Tool: Version 2.1.0, compiled on " + ThdlVersion.getTimeOfCompilation() + ". Copyright © 2000-2002 by <a href=\"http://www.people.virginia.edu/~am2zb/\" target=\"_blank\">Andrés Montano Pellegrini</a><br>All rights reserved</small></strong>";
|
public static final String copyrightHTML="<hr><small><strong>" + "The Tibetan to English Translation Tool: Version 2.1.0, compiled on " + ThdlVersion.getTimeOfCompilation() + ". Copyright © 2000-2002 by <a href=\"http://www.people.virginia.edu/~am2zb/\" target=\"_blank\">Andrés Montano Pellegrini</a><br/>All rights reserved</strong></small>";
|
||||||
public static final String aboutUnicode=
|
public static final String aboutUnicode=
|
||||||
"Warning: Since version 1.3.0. the dictionary database format changed and " +
|
"Warning: Since version 1.3.0. the dictionary database format changed and " +
|
||||||
"is incompatible with previous versions. In order to use the newest version " +
|
"is incompatible with previous versions. In order to use the newest version " +
|
||||||
|
|
|
@ -216,7 +216,8 @@ class WhichDictionaryFrame extends Dialog implements ActionListener, ItemListene
|
||||||
else if (obj instanceof Choice)
|
else if (obj instanceof Choice)
|
||||||
{
|
{
|
||||||
Choice ch = (Choice) obj;
|
Choice ch = (Choice) obj;
|
||||||
response = dictsOnline[ch.getSelectedIndex()];
|
dictType = ch.getSelectedIndex();
|
||||||
|
response = dictsOnline[dictType];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue