fixed the importing of dictionaries using '-' as a separator, without confusing such character with reverse vowel in the tibetanized sanskrit.

This commit is contained in:
amontano 2002-11-27 23:30:44 +00:00
parent c13adf9d14
commit c12088ce5d

View file

@ -36,6 +36,10 @@ public class BinaryFileGenerator extends LinkedList
private long posHijos;
private String sil, def[];
private static String delimiter;
private static int delimiterType;
private final static int delimiterGeneric=0;
private final static int delimiterAcip=1;
private final static int delimiterDash=2;
/** Number of dictionary. If 0, partial word (no definition).
*/
@ -47,7 +51,8 @@ public class BinaryFileGenerator extends LinkedList
{
wordRaf = null;
defRaf = null;
delimiter = " - ";
delimiter = null;
delimiterType=delimiterDash;
}
public BinaryFileGenerator()
@ -110,8 +115,9 @@ public class BinaryFileGenerator extends LinkedList
boolean markerNotFound;
// used for acip dict
if (delimiter==null)
switch(delimiterType)
{
case delimiterAcip:
outAHere:
while (true)
{
@ -354,15 +360,28 @@ public class BinaryFileGenerator extends LinkedList
}
}
}
}
else
break;
default:
while ((entrada = br.readLine())!=null)
{
entrada = entrada.trim();
if (!entrada.equals(""))
{
switch(delimiterType)
{
/* this is needed to make sure that the dash used in reverse vowels with extended
wylie is not confused with the dash that separates definiendum and definition. */
case delimiterDash:
marker=entrada.indexOf('-');
len = entrada.length();
while (marker>=0 && marker<len-1 && Manipulate.isVowel(entrada.charAt(marker+1)) && !Character.isWhitespace(entrada.charAt(marker-1)))
{
marker = entrada.indexOf('-', marker+1);
}
break;
default:
marker = entrada.indexOf(delimiter);
}
if (marker<0)
{
System.out.println("Error loading line " + currentLine + ", in file " + archivo + ":");
@ -375,6 +394,7 @@ public class BinaryFileGenerator extends LinkedList
add(s1, s2 , defNum);
}
}
}
currentLine++;
}
}
@ -547,11 +567,17 @@ public class BinaryFileGenerator extends LinkedList
if (args[0].charAt(0)=='-')
{
if (args[0].equals("-tab"))
{
delimiterType = delimiterGeneric;
delimiter="\t";
}
else if (args[0].equals("-acip"))
delimiter=null;
delimiterType=delimiterAcip;
else
{
delimiterType=delimiterGeneric;
delimiter=args[0].substring(1);
}
if (args.length>2)
{
printSintax();
@ -576,14 +602,23 @@ public class BinaryFileGenerator extends LinkedList
if (args[i].charAt(0)=='-')
{
if (args[i].equals("-tab"))
{
delimiterType=delimiterGeneric;
delimiter="\t";
}
else if (args[i].equals("-acip"))
delimiter=null;
delimiterType=delimiterAcip;
else
{
delimiterType=delimiterGeneric;
delimiter=args[i].substring(1);
}
i++;
}
else delimiter=" -";
else
{
delimiterType=delimiterDash;
}
sl.addFile(args[i] + ".txt", n);
n++; i++;
}