From 2fa8b7f2003c43ba1627c12519bf1ba58c5aa483 Mon Sep 17 00:00:00 2001 From: travismccauley Date: Sun, 20 Jun 2004 17:27:52 +0000 Subject: [PATCH] updated addRecord method to use LexComponentRepository api to save --- .../org/thdl/lex/test/DictionaryImporter.java | 263 ++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 src/java/org/thdl/lex/test/DictionaryImporter.java diff --git a/src/java/org/thdl/lex/test/DictionaryImporter.java b/src/java/org/thdl/lex/test/DictionaryImporter.java new file mode 100644 index 0000000..f3357b9 --- /dev/null +++ b/src/java/org/thdl/lex/test/DictionaryImporter.java @@ -0,0 +1,263 @@ +package org.thdl.lex; +import java.net.*; +import java.io.*; +import java.util.*; +import org.thdl.lex.*; +import org.thdl.lex.component.*; +import org.thdl.tib.scanner.Manipulate; + +public class DictionaryImporter +{ + private PrintWriter out; + private BufferedReader in; + private String delim; + private int delimiterType; + + public final static int delimiterGeneric=0; + public final static int delimiterAcip=1; + public final static int delimiterDash=2; + +//helpers + public void doImport() throws Exception + { + String entrada, s1, s2, alternateWords[]; + int marker, marker2, len, currentLine=1; + long start = System.currentTimeMillis(); + + while ((entrada = in.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 && marker0) + { + alternateWords = s1.split(";"); + for (marker2=0; marker2= 0) + in = new BufferedReader(new InputStreamReader(new BufferedInputStream((new URL(args[currentArg])).openStream()))); + else + in = new BufferedReader(new InputStreamReader(new FileInputStream(args[currentArg]))); + } + + new DictionaryImporter(in, out).doImport(); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } +}