Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

j3
Class J3Dict  view J3Dict download J3Dict.java

java.lang.Object
  extended byj3.J3Dict
Direct Known Subclasses:
J3DB

public class J3Dict
extends java.lang.Object

J3Dict is the internal representation of a dictionary in my j3 package. It handles lots of good stuff, although it's probably not as robust as it can be. It's linked into a J3. If this somehow becomes useful to others, then they can remove the call to j3.addDictionary(...) in the J3 cstr, and pass in null to the cstr instead.

Version:
1.0

Field Summary
static int CEDICT
          Known dicitonary type
static int EDICT
          Known dicitonary type
protected static java.io.File f_dictionary
          f_dictionary is a java.io.File representation of the dictionary.
protected static java.lang.String fileEncoding
          fileEncoding is the proper, JVM aware file encoding type represented as a string.
protected static java.lang.String fileName
          fileName is the complete, fileName included path to the dictionary file to parse
protected static java.lang.String fileType
          fileType is the type of dictionary format.
protected static java.io.FileInputStream fis_dictionary
          fis_dictionary is a java.io.FileInputStream repr.
static int FULL
          Fully parsed dictionary ready to use: FULL.
static int initLevel
          InitLevel NONE corresponds to getting to null strings on cstr.
protected static java.io.InputStreamReader isr_dictionary
          isr_dictionary is the InputStreamReader version
protected static J3 j3
          My local copy of the j3 here.
static int KANJI212
          Known dicitonary type
static int KANJIDIC
          Known dicitonary type
protected  java.util.TreeMap L1CharacterMap
          L1CharacterMap is the efficient storage of L1 ideographs Explanation time: Character maps are not the same as String Maps To lookup L1 char definitions query the L1CharacterMap To lookup L2 char definitions query the L2CharacterMap To lookup L1 STRING defs, query the L1StringMap To lookup L2 STRING defs, query the L2StringMap Example: Find the kanji for, "love" L2CharacterMapQuery('ai');
protected  java.util.TreeMap L1StringMap
          L1StringMap is a map of language 1's phonetics to l2s->phonetics
protected  java.util.TreeMap L2CharacterMap
          L2CharacterMap is the efficient storage of ideographs.
protected  java.util.TreeMap L2StringMap
          Describe variable L2StringMap here.
static int NONE
           
static int PARSED
           
static int PREPARED
           
static java.lang.String sCEDICT
          Known dicitonary type
static java.lang.String sEDICT
          Known dicitonary type
static java.lang.String sKANJI212
          Known dicitonary type
static java.lang.String sKANJIDIC
          Known dicitonary type
static java.lang.String sXML
          Known dicitonary type
static int XML
          Known dicitonary type
 
Constructor Summary
J3Dict(java.lang.String fileName, java.lang.String fileType, J3 j3)
          Creates a new J3Dict instance.
 
Method Summary
 java.util.TreeMap getL1CharacterMap()
           
 java.util.TreeMap getL1StringMap()
           
 java.util.TreeMap getL2CharacterMap()
           
 java.util.TreeMap getL2StringMap()
           
 java.lang.String[] L1CharacterQuery(java.lang.String query)
          Look for a CHARACTER in language one, L1CharacterQuery.
 java.lang.String[] L1StringQuery(java.lang.String query)
          Describe L1StringQuery method here.
 java.lang.String[] L2CharacterQuery(java.lang.String query)
          L2CharacterQuery queries for a character in the 2nd map
 java.lang.String[] L2StringQuery(java.lang.String query)
          Describe L2StringQuery method here.
protected  boolean parseCEDICT()
          parseCEDICT parses the given dict.
protected  boolean parseEDICT()
          parseEDICT parses the current GOOD dictionary file in EDICT style.
static java.util.TreeMap parseEDICTStyleDictionary(java.io.InputStreamReader newDict)
          Allows us to try to parse a file based on the FileStream
static java.util.TreeMap parseEDICTStyleDictionary(java.lang.String fileName)
          Allows us to try to parse a file based on the filename alone just sets up and calls the above method: parseEDICTStyleDict( instream ) - takes String fileName to attempt to parse as an EDICT - returns HashMap on success, null otherwise
protected  boolean parseFile()
          parseFile takes the ready file and parses it into the internal data structures so that we may use it.
protected  boolean parseKANJI212()
          parseKANJI212 parses a Kanji212 dictionary
protected  boolean parseKANJIDIC()
          Describe parseKANJIDIC method here.
static java.util.TreeMap parseKanjiDicStyleDictionary(java.io.InputStreamReader dictionary)
          parseKanjiDicStyleDictionary does what the names says, putting the info in the right (hopefully) place.
protected  boolean parseXML()
          Describe parseXML method here.
static java.util.TreeMap parseXMLStyleDictionary(java.io.InputStreamReader dictionary)
          Describe parseXMLStyleDictionary method here.
protected  boolean prepareFile()
          prepareFile gets the fileEncoding type, (ex: EUC-JP, EUC-TW...), creates and loads the file to represent the dictionary, does any pre-parsing necessities.
static java.lang.String[] queryDictionary(J3Dict dictionary, java.lang.String query)
          Describe queryDictionary method here.
 java.lang.String[] queryDictionary(java.lang.String query)
          Describe queryDictionary method here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

L1CharacterMap

protected java.util.TreeMap L1CharacterMap
L1CharacterMap is the efficient storage of L1 ideographs Explanation time: Character maps are not the same as String Maps To lookup L1 char definitions query the L1CharacterMap To lookup L2 char definitions query the L2CharacterMap To lookup L1 STRING defs, query the L1StringMap To lookup L2 STRING defs, query the L2StringMap Example: Find the kanji for, "love" L2CharacterMapQuery('ai');


L1StringMap

protected java.util.TreeMap L1StringMap
L1StringMap is a map of language 1's phonetics to l2s->phonetics


L2CharacterMap

protected java.util.TreeMap L2CharacterMap
L2CharacterMap is the efficient storage of ideographs. May better be renamed, ideographTree


L2StringMap

protected java.util.TreeMap L2StringMap
Describe variable L2StringMap here.


j3

protected static J3 j3
My local copy of the j3 here.


fileName

protected static java.lang.String fileName
fileName is the complete, fileName included path to the dictionary file to parse


fileType

protected static java.lang.String fileType
fileType is the type of dictionary format. Valid types of formats are listed below in, knownDictionaryTypes.


fileEncoding

protected static java.lang.String fileEncoding
fileEncoding is the proper, JVM aware file encoding type represented as a string.


f_dictionary

protected static java.io.File f_dictionary
f_dictionary is a java.io.File representation of the dictionary.


fis_dictionary

protected static java.io.FileInputStream fis_dictionary
fis_dictionary is a java.io.FileInputStream repr. of the dictionary


isr_dictionary

protected static java.io.InputStreamReader isr_dictionary
isr_dictionary is the InputStreamReader version


initLevel

public static int initLevel
InitLevel NONE corresponds to getting to null strings on cstr. call


NONE

public static int NONE

PREPARED

public static int PREPARED

PARSED

public static int PARSED

FULL

public static int FULL
Fully parsed dictionary ready to use: FULL.


EDICT

public static int EDICT
Known dicitonary type


CEDICT

public static int CEDICT
Known dicitonary type


KANJIDIC

public static int KANJIDIC
Known dicitonary type


KANJI212

public static int KANJI212
Known dicitonary type


XML

public static int XML
Known dicitonary type


sEDICT

public static java.lang.String sEDICT
Known dicitonary type


sCEDICT

public static java.lang.String sCEDICT
Known dicitonary type


sKANJIDIC

public static java.lang.String sKANJIDIC
Known dicitonary type


sKANJI212

public static java.lang.String sKANJI212
Known dicitonary type


sXML

public static java.lang.String sXML
Known dicitonary type

Constructor Detail

J3Dict

public J3Dict(java.lang.String fileName,
              java.lang.String fileType,
              J3 j3)
Creates a new J3Dict instance.

Method Detail

getL1CharacterMap

public java.util.TreeMap getL1CharacterMap()

getL1StringMap

public java.util.TreeMap getL1StringMap()

getL2CharacterMap

public java.util.TreeMap getL2CharacterMap()

getL2StringMap

public java.util.TreeMap getL2StringMap()

prepareFile

protected boolean prepareFile()
prepareFile gets the fileEncoding type, (ex: EUC-JP, EUC-TW...), creates and loads the file to represent the dictionary, does any pre-parsing necessities.


parseFile

protected boolean parseFile()
parseFile takes the ready file and parses it into the internal data structures so that we may use it. Query, put, get etc., on the dictionary.


parseEDICT

protected boolean parseEDICT()
parseEDICT parses the current GOOD dictionary file in EDICT style.


parseCEDICT

protected boolean parseCEDICT()
parseCEDICT parses the given dict. in CEDICT style


parseKANJIDIC

protected boolean parseKANJIDIC()
Describe parseKANJIDIC method here.


parseKANJI212

protected boolean parseKANJI212()
parseKANJI212 parses a Kanji212 dictionary


parseXML

protected boolean parseXML()
Describe parseXML method here.


parseEDICTStyleDictionary

public static java.util.TreeMap parseEDICTStyleDictionary(java.io.InputStreamReader newDict)
Allows us to try to parse a file based on the FileStream


parseEDICTStyleDictionary

public static java.util.TreeMap parseEDICTStyleDictionary(java.lang.String fileName)
Allows us to try to parse a file based on the filename alone just sets up and calls the above method: parseEDICTStyleDict( instream ) - takes String fileName to attempt to parse as an EDICT - returns HashMap on success, null otherwise


parseKanjiDicStyleDictionary

public static java.util.TreeMap parseKanjiDicStyleDictionary(java.io.InputStreamReader dictionary)
parseKanjiDicStyleDictionary does what the names says, putting the info in the right (hopefully) place.


parseXMLStyleDictionary

public static java.util.TreeMap parseXMLStyleDictionary(java.io.InputStreamReader dictionary)
Describe parseXMLStyleDictionary method here.


L1CharacterQuery

public java.lang.String[] L1CharacterQuery(java.lang.String query)
Look for a CHARACTER in language one, L1CharacterQuery.


L2CharacterQuery

public java.lang.String[] L2CharacterQuery(java.lang.String query)
L2CharacterQuery queries for a character in the 2nd map


L1StringQuery

public java.lang.String[] L1StringQuery(java.lang.String query)
Describe L1StringQuery method here.


L2StringQuery

public java.lang.String[] L2StringQuery(java.lang.String query)
Describe L2StringQuery method here.


queryDictionary

public static java.lang.String[] queryDictionary(J3Dict dictionary,
                                                 java.lang.String query)
Describe queryDictionary method here.


queryDictionary

public java.lang.String[] queryDictionary(java.lang.String query)
Describe queryDictionary method here.