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 long posHijos;
private String sil, def[]; private String sil, def[];
private static String delimiter; 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). /** Number of dictionary. If 0, partial word (no definition).
*/ */
@ -47,7 +51,8 @@ public class BinaryFileGenerator extends LinkedList
{ {
wordRaf = null; wordRaf = null;
defRaf = null; defRaf = null;
delimiter = " - "; delimiter = null;
delimiterType=delimiterDash;
} }
public BinaryFileGenerator() public BinaryFileGenerator()
@ -110,8 +115,9 @@ public class BinaryFileGenerator extends LinkedList
boolean markerNotFound; boolean markerNotFound;
// used for acip dict // used for acip dict
if (delimiter==null) switch(delimiterType)
{ {
case delimiterAcip:
outAHere: outAHere:
while (true) while (true)
{ {
@ -354,15 +360,28 @@ public class BinaryFileGenerator extends LinkedList
} }
} }
} }
break;
} default:
else
while ((entrada = br.readLine())!=null) while ((entrada = br.readLine())!=null)
{ {
entrada = entrada.trim(); entrada = entrada.trim();
if (!entrada.equals("")) 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); marker = entrada.indexOf(delimiter);
}
if (marker<0) if (marker<0)
{ {
System.out.println("Error loading line " + currentLine + ", in file " + archivo + ":"); System.out.println("Error loading line " + currentLine + ", in file " + archivo + ":");
@ -375,6 +394,7 @@ public class BinaryFileGenerator extends LinkedList
add(s1, s2 , defNum); add(s1, s2 , defNum);
} }
} }
}
currentLine++; currentLine++;
} }
} }
@ -547,11 +567,17 @@ public class BinaryFileGenerator extends LinkedList
if (args[0].charAt(0)=='-') if (args[0].charAt(0)=='-')
{ {
if (args[0].equals("-tab")) if (args[0].equals("-tab"))
{
delimiterType = delimiterGeneric;
delimiter="\t"; delimiter="\t";
}
else if (args[0].equals("-acip")) else if (args[0].equals("-acip"))
delimiter=null; delimiterType=delimiterAcip;
else else
{
delimiterType=delimiterGeneric;
delimiter=args[0].substring(1); delimiter=args[0].substring(1);
}
if (args.length>2) if (args.length>2)
{ {
printSintax(); printSintax();
@ -576,14 +602,23 @@ public class BinaryFileGenerator extends LinkedList
if (args[i].charAt(0)=='-') if (args[i].charAt(0)=='-')
{ {
if (args[i].equals("-tab")) if (args[i].equals("-tab"))
{
delimiterType=delimiterGeneric;
delimiter="\t"; delimiter="\t";
}
else if (args[i].equals("-acip")) else if (args[i].equals("-acip"))
delimiter=null; delimiterType=delimiterAcip;
else else
{
delimiterType=delimiterGeneric;
delimiter=args[i].substring(1); delimiter=args[i].substring(1);
}
i++; i++;
} }
else delimiter=" -"; else
{
delimiterType=delimiterDash;
}
sl.addFile(args[i] + ".txt", n); sl.addFile(args[i] + ".txt", n);
n++; i++; n++; i++;
} }