Added comments to all class headers. Comments to individual methods will
be added as needed.
This commit is contained in:
parent
b4e4decc2e
commit
37b29c8d33
24 changed files with 157 additions and 18 deletions
|
@ -21,6 +21,11 @@ package org.thdl.tib.scanner;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
/** Window that displays copyright stuff.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see WindowScannerFilter
|
||||
*/
|
||||
class AboutDialog extends Dialog implements ActionListener, WindowListener
|
||||
{
|
||||
public AboutDialog(Frame parent)
|
||||
|
|
|
@ -21,6 +21,14 @@ package org.thdl.tib.scanner;
|
|||
import java.net.*;
|
||||
import java.io.*;
|
||||
|
||||
/** Provides interfase to convert from tibetan text transliterated in
|
||||
the Acip scheme to THDL's extended wylie scheme.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see WindowScannerFilter
|
||||
@see Manipulate
|
||||
*/
|
||||
|
||||
public class AcipToWylie
|
||||
{
|
||||
private BufferedReader in;
|
||||
|
@ -32,6 +40,14 @@ public class AcipToWylie
|
|||
this.out = out;
|
||||
}
|
||||
|
||||
/** Simply constructs object and invokes #run().
|
||||
@param args If no arguments are sent, it takes the ACIP text
|
||||
from the standard input and sends the wylie text to the standard
|
||||
output. If one argument is sent, it interprets it as the
|
||||
file name for the input. If two arguments are sent, it
|
||||
interprets the first one as the file name for the input and
|
||||
the second one as the file name for the output.
|
||||
*/
|
||||
public static void main (String[] args) throws Exception
|
||||
{
|
||||
PrintWriter out;
|
||||
|
|
|
@ -19,13 +19,13 @@ package org.thdl.tib.scanner;
|
|||
|
||||
import java.io.*;
|
||||
|
||||
/** Provides recommended implementation of the SyllableListTree
|
||||
/** Provides recommended implementation of the {@link SyllableListTree}
|
||||
(currently most efficient memory-speed combination) loading
|
||||
into memory only the "trunk" of the tree, and
|
||||
searching the rest of the tree directly in the file.
|
||||
from file into memory only the "trunk" of the tree,
|
||||
and resorting to the disk when searching the rest of the tree.
|
||||
|
||||
<p>The words must be stored in a binary file tree structure format.
|
||||
This can be done using the BinaryFileGenerator.</p>
|
||||
This can be done using the {@link BinaryFileGenerator}.</p>
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see TibetanScanner
|
||||
|
|
|
@ -21,8 +21,9 @@ import java.io.*;
|
|||
import java.net.*;
|
||||
import java.util.*;
|
||||
|
||||
/** Inputs a Tibetan text and displays the words with
|
||||
their definitions through the console over a shell.
|
||||
/** Inputs a Tibetan text and displays the words with their
|
||||
definitions through the console over a shell. Use when no
|
||||
graphical interfase is supported or for batch processes.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
*/
|
||||
|
|
|
@ -16,12 +16,14 @@ Pellegrini. All Rights Reserved.
|
|||
Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
package org.thdl.tib.scanner;
|
||||
|
||||
/** Stores the multiple definitions (corresponding to
|
||||
various dictionaries) for a single Tibetan word.
|
||||
|
||||
|
||||
@see Word
|
||||
@author Andrés Montano Pellegrini
|
||||
*/
|
||||
package org.thdl.tib.scanner;
|
||||
|
||||
public class Definitions
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.awt.*;
|
|||
import javax.swing.table.*;
|
||||
|
||||
/** Used by the DictionaryTable to display the full definition
|
||||
of Tibetan word displaed in a table when its row is clicked.
|
||||
of Tibetan word displayed in a table when its row is clicked.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see DictionaryTable
|
||||
|
|
|
@ -26,10 +26,12 @@ import org.thdl.tib.input.DuffPane;
|
|||
|
||||
/** Graphical interfase to be used by applications and applets
|
||||
to input a Tibetan text (in Roman or Tibetan script) and
|
||||
displays the words (in Roman or Tibetan script) with their
|
||||
display the words (in Roman or Tibetan script) with their
|
||||
definitions (in Roman script). Uses the THDL inputting system.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see WindowScannerFilter
|
||||
@see AppletScannerFilter
|
||||
*/
|
||||
public class DuffScannerPanel extends ScannerPanel
|
||||
{
|
||||
|
|
|
@ -21,10 +21,10 @@ import java.io.*;
|
|||
|
||||
/** Searches the words directly in a file; not the preferred
|
||||
implementation. The search is too slow!
|
||||
The preferred implementation is the CachedSyllableListTree.
|
||||
The preferred implementation is the {@link CachedSyllableListTree}.
|
||||
|
||||
<p>The words must be stored in a binary file tree structure format.
|
||||
This can be done using the BinaryFileGenerator.</p>
|
||||
This can be done using the {@link BinaryFileGenerator}.</p>
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see TibetanScanner
|
||||
|
|
|
@ -19,6 +19,14 @@ Contributor(s): ______________________________________.
|
|||
package org.thdl.tib.scanner;
|
||||
import java.io.*;
|
||||
|
||||
/** Used by {@link LinkedList} to provide the implementation of a
|
||||
simple dynamic link list.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see LinkedList
|
||||
@see ListIterator
|
||||
*/
|
||||
|
||||
class Link
|
||||
{
|
||||
private Object obj;
|
||||
|
|
|
@ -19,6 +19,12 @@ Contributor(s): ______________________________________.
|
|||
package org.thdl.tib.scanner;
|
||||
import java.util.*;
|
||||
|
||||
/** Implementation of a simple dynamic link list. Be careful with word order!
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see Link
|
||||
@see ListIterator
|
||||
*/
|
||||
public class LinkedList
|
||||
{
|
||||
protected Link cabeza;
|
||||
|
|
|
@ -19,6 +19,14 @@ Contributor(s): ______________________________________.
|
|||
package org.thdl.tib.scanner;
|
||||
import java.util.*;
|
||||
|
||||
/** Used by {@link LinkedList} to provide the implementation of a
|
||||
simple dynamic link list.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see LinkedList
|
||||
@see Link
|
||||
*/
|
||||
|
||||
public class ListIterator
|
||||
{
|
||||
Link current;
|
||||
|
|
|
@ -20,6 +20,13 @@ package org.thdl.tib.scanner;
|
|||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
/** Loads dictionary stored in tree format and searches for words recursively.
|
||||
How the the dictionary is loaded depends on which implementation of
|
||||
{@link SyllableListTree} is invoked.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see SyllableListTree
|
||||
*/
|
||||
class LocalTibetanScanner implements TibetanScanner
|
||||
{
|
||||
public static String archivo;
|
||||
|
|
|
@ -20,9 +20,7 @@ package org.thdl.tib.scanner;
|
|||
|
||||
import java.io.*;
|
||||
|
||||
/** Takes the output of ConsoleScannerFilter
|
||||
(in RY format), converts the Wylie to Acip
|
||||
and displays the result in csv format.
|
||||
/** Miscelaneous methods for the manipulation of Tibetan text.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
*/
|
||||
|
@ -220,9 +218,13 @@ public class Manipulate
|
|||
return linea;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sintaxis: java Manipulate [arch-palabras] < dict-orig > dict-dest
|
||||
*
|
||||
/** Not really important.
|
||||
|
||||
Sintaxis: java Manipulate [word-file] < source-dic-entries > dest-dic-entries
|
||||
|
||||
Takes the output of ConsoleScannerFilter
|
||||
(in RY format), converts the Wylie to Acip
|
||||
and displays the result in csv format.
|
||||
* arch-palabras es usado solo cuando deseamos las palabras cambiadas
|
||||
* a otro archivo.
|
||||
*/
|
||||
|
|
|
@ -20,6 +20,20 @@ package org.thdl.tib.scanner;
|
|||
import java.util.*;
|
||||
import java.io.*;
|
||||
|
||||
/** Loads the whole dictionary into memory; not the preferred
|
||||
implementation. Provides the fastest search, but takes up to
|
||||
much resources. The preferred implementation is the
|
||||
{@link CachedSyllableListTree}.
|
||||
|
||||
<p>The words must be stored in a binary file tree structure format.
|
||||
This can be done using the {@link BinaryFileGenerator}.</p>
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see TibetanScanner
|
||||
@see CachedSyllableListTree
|
||||
@see BinaryFileGenerator
|
||||
*/
|
||||
|
||||
public class MemorySyllableListTree extends LinkedList implements SyllableListTree
|
||||
{
|
||||
protected String sil, def;
|
||||
|
|
|
@ -25,6 +25,14 @@ import javax.servlet.*;
|
|||
import javax.servlet.http.*;
|
||||
import org.thdl.tib.text.TibetanHTML;
|
||||
|
||||
/** Interfase to provide access to an on-line dictionary through a form in html;
|
||||
Inputs Tibetan text (Roman script only) and displays the
|
||||
words (Roman or Tibetan script) with their definitions.
|
||||
Runs on the server and is called upon through an HTTP request directly
|
||||
by the browser. Requires no additional software installed on the client.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
*/
|
||||
public class OnLineScannerFilter extends HttpServlet {
|
||||
|
||||
ResourceBundle rb;
|
||||
|
|
|
@ -18,6 +18,14 @@ Contributor(s): ______________________________________.
|
|||
|
||||
package org.thdl.tib.scanner;
|
||||
|
||||
/** Right now, it only used by {@link LocalTibetanScanner} to
|
||||
separate "paragraphs"; eventually it will be one
|
||||
of many tokens representing grammatical parts of the sentences that will be
|
||||
interpreted by the parser.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see LocalTibetanScanner
|
||||
*/
|
||||
class PunctuationMark extends Token
|
||||
{
|
||||
public PunctuationMark(char ch)
|
||||
|
|
|
@ -24,6 +24,13 @@ import java.util.*;
|
|||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
|
||||
/** Running on the server, receives the tibetan text from applet/applications running on
|
||||
the client and sends them the words with their definitions through the Internet.
|
||||
Requests are made through {@link RemoteTibetanScanner}.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see RemoteTibetanScanner
|
||||
*/
|
||||
public class RemoteScannerFilter extends GenericServlet
|
||||
{
|
||||
private TibetanScanner scanner;
|
||||
|
|
|
@ -20,6 +20,13 @@ package org.thdl.tib.scanner;
|
|||
import java.net.*;
|
||||
import java.io.*;
|
||||
|
||||
/** Used by applets and applications to access remote on-line dictionaries.
|
||||
Sends Tibetan text, and receives the words with their definitions. The
|
||||
{@link RemoteScannerFilter} receives the requests on the server.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see RemoteScannerFilter
|
||||
*/
|
||||
public class RemoteTibetanScanner implements TibetanScanner
|
||||
{
|
||||
private String url;
|
||||
|
|
|
@ -20,6 +20,16 @@ package org.thdl.tib.scanner;
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
/** A non-Swing graphical interfase to be used by applications
|
||||
running on platforms that don't support Swing,
|
||||
to input a Tibetan text (in Roman script only) and
|
||||
display the words (in Roman script only) with their
|
||||
definitions (in Roman script).
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
@see WindowScannerFilter
|
||||
*/
|
||||
|
||||
public class SimpleScannerPanel extends ScannerPanel
|
||||
{
|
||||
private TextArea txtInput, txtOutput;
|
||||
|
|
|
@ -27,6 +27,12 @@ Contributor(s): ______________________________________.
|
|||
|
||||
package org.thdl.tib.scanner;
|
||||
|
||||
/** The generic interface for accesing dictionaries. An instance of
|
||||
a SyllableListTree represents a node containing a syllable, a definition
|
||||
(if it is the last syllable of a word) and links to its "children".
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
*/
|
||||
public interface SyllableListTree
|
||||
{
|
||||
public String getDef();
|
||||
|
|
|
@ -19,6 +19,10 @@ Contributor(s): ______________________________________.
|
|||
package org.thdl.tib.scanner;
|
||||
import java.util.*;
|
||||
|
||||
/** Defines the core methods required to provide access to a dictionary; local or remote.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
*/
|
||||
public interface TibetanScanner
|
||||
{
|
||||
public static final String copyrightUnicode="Copyright " + '\u00A9' + " 2000-2002 by Andr" + '\u00E9' + "s Montano Pellegrini, all rights reserved.";
|
||||
|
|
|
@ -17,6 +17,12 @@ Contributor(s): ______________________________________.
|
|||
*/
|
||||
|
||||
package org.thdl.tib.scanner;
|
||||
|
||||
/** Represents a basic grammatical unit; seems unnecessary but when the parser
|
||||
is developed it will make sense.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
*/
|
||||
public class Token
|
||||
{
|
||||
protected String token;
|
||||
|
|
|
@ -28,6 +28,14 @@ import java.awt.datatransfer.*;
|
|||
import javax.swing.text.JTextComponent;
|
||||
import org.thdl.tib.input.DuffPane;
|
||||
|
||||
/** Provides a graphical interfase to input Tibetan text (Roman or
|
||||
Tibetan script) and displays the words (Roman or Tibetan script)
|
||||
with their definitions. Works without Tibetan script in
|
||||
platforms that don't support Swing. Can access dictionaries stored
|
||||
locally or remotely.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
*/
|
||||
public class WindowScannerFilter implements WindowListener, FocusListener, ActionListener, ItemListener
|
||||
{
|
||||
private ScannerPanel sp;
|
||||
|
|
|
@ -22,6 +22,10 @@ package org.thdl.tib.scanner;
|
|||
|
||||
import org.thdl.tib.text.TibetanHTML;
|
||||
|
||||
/** Tibetan word with its corresponding definitions.
|
||||
|
||||
@author Andrés Montano Pellegrini
|
||||
*/
|
||||
public class Word extends Token
|
||||
{
|
||||
/** Used to rebuild the text the user entered. */
|
||||
|
|
Loading…
Reference in a new issue