net.sourceforge.wohenchan.convert
Class SystranConverterTable

java.lang.Object
  |
  +--net.sourceforge.wohenchan.convert.SystranConverterTable
All Implemented Interfaces:
ConverterTableInterface

public class SystranConverterTable
extends java.lang.Object
implements ConverterTableInterface

Wrapper around the translation service at systransoft.com

Version:
$Name: $ $Date: 2003/08/19 16:25:19 $
Author:
$Author: wtanaka $

Field Summary
private static java.lang.String SOURCE
           
 
Constructor Summary
SystranConverterTable()
           
 
Method Summary
static java.lang.String bytearrayencode(byte[] b)
           
private  void fireEntryFound(ConverterListener listener, ConverterEntryInterface entry)
           
 void lookupByChinese(java.lang.String chinese, java.lang.String languagepair, ConverterListener listener)
           
 void lookupByEnglishSubstring(java.lang.String str, ConverterListener listener)
          Locates ConverterEntryInterface objects corresponding to a given case insensitive English string.
 void lookupByPinyin(java.lang.String pinyin, ConverterListener listener)
          Does nothing -- Sytsran does not pinyin lookups
 void lookupBySimplifiedChinese(java.lang.String chinese, ConverterListener listener)
          Looks up a converter table entry by simplified chinese characters
 void lookupByTraditionalChinese(java.lang.String chinese, ConverterListener listener)
          Looks up a converter table entry by traditional chinese characters.
private  void parseChineseToEnglish(ConverterListener listener, java.io.Reader reader, java.lang.String chinese)
          Parses the chinese->english dictionary output for gb2312 and Big5
private  void parseEnglishToGB(ConverterListener listener, java.io.Reader reader, java.lang.String english)
          Parses the chinese->english dictionary output for gb2312.
private static java.lang.String[] split(java.lang.String string, java.lang.String separator)
           
 java.lang.String toString()
           
private  java.lang.String urlEncode(byte[] bytes)
          Encodes a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SOURCE

private static final java.lang.String SOURCE
See Also:
Constant Field Values
Constructor Detail

SystranConverterTable

public SystranConverterTable()
Method Detail

fireEntryFound

private void fireEntryFound(ConverterListener listener,
                            ConverterEntryInterface entry)
                     throws AbortSearchException
AbortSearchException

split

private static java.lang.String[] split(java.lang.String string,
                                        java.lang.String separator)

parseChineseToEnglish

private void parseChineseToEnglish(ConverterListener listener,
                                   java.io.Reader reader,
                                   java.lang.String chinese)
                            throws java.io.IOException,
                                   AbortSearchException
Parses the chinese->english dictionary output for gb2312 and Big5

java.io.IOException
AbortSearchException

lookupByPinyin

public void lookupByPinyin(java.lang.String pinyin,
                           ConverterListener listener)
Does nothing -- Sytsran does not pinyin lookups

Specified by:
lookupByPinyin in interface ConverterTableInterface
Parameters:
pinyin - The input string is specified in pinyin. The string may be composed of the letters 'a'-'z' (lower case only), the numbers '1'-'5' and space (' '). The string is composed of at least 1 space-separated pinyin syllables. Syllables are separated with exactly one space. There is no leading or trailing space. Each syllable is composed of at least two letters followed by exactly one digit. The neutral tone is expicitly specified with '5'. u w/ umlaut (as in luu2 (donkey, palm tree), or luu3 (drizzle) is specified with uu.
listener - the ConverterListener to which this object should send its results

urlEncode

private java.lang.String urlEncode(byte[] bytes)
Encodes a byte array.


bytearrayencode

public static java.lang.String bytearrayencode(byte[] b)

lookupByChinese

public void lookupByChinese(java.lang.String chinese,
                            java.lang.String languagepair,
                            ConverterListener listener)
Parameters:
chinese - the chinese input text
languagepair - "zh_en" or "zt_en"
listener - the object to which to return results

lookupBySimplifiedChinese

public void lookupBySimplifiedChinese(java.lang.String chinese,
                                      ConverterListener listener)
Looks up a converter table entry by simplified chinese characters

Specified by:
lookupBySimplifiedChinese in interface ConverterTableInterface
Returns:
a non-null, possibly empty, array of results for this search.

lookupByTraditionalChinese

public void lookupByTraditionalChinese(java.lang.String chinese,
                                       ConverterListener listener)
Looks up a converter table entry by traditional chinese characters.

Specified by:
lookupByTraditionalChinese in interface ConverterTableInterface
Returns:
a non-null, possibly empty, array of results for this search.

parseEnglishToGB

private void parseEnglishToGB(ConverterListener listener,
                              java.io.Reader reader,
                              java.lang.String english)
                       throws java.io.IOException,
                              AbortSearchException
Parses the chinese->english dictionary output for gb2312.

java.io.IOException
AbortSearchException

lookupByEnglishSubstring

public void lookupByEnglishSubstring(java.lang.String str,
                                     ConverterListener listener)
Locates ConverterEntryInterface objects corresponding to a given case insensitive English string. Systran will only find at most one match given a certain input, so we just return that match.

Specified by:
lookupByEnglishSubstring in interface ConverterTableInterface
Returns:
a non-null, possibly empty, array of results for this search.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object