# 0.7 (19.6.2008) Patch by Petr Dlouhy, added support for many new dicts
# 0.6 (29.5.2008) Patch by Petr Dlouhy, added support for French-Czech and Spanish-Czech dictionaries; automatic encoding selection; all unrecognized characters are printed now as #something# (note: some of them are bugs in Lingea dictionaries); typo
# 0.5 (3.12.2007) Patch by Petr Dlouhy, iPaq and 2000 dicts support
# Patch by Josef Riha
# 0.4 (30.10.2007) Patch by Petr Dlouhy, optional HTML generation
# 0.3 (28.10.2007) Patch by Petr Dlouhy, cleanup, bugfix. More dictionaries.
# 0.2 (19.7.2007) Changes, documentation, first 100% dictionary
# 0.1 (20.5.2006) Initial version based on Nomad specs
#
# Supported dictionaries:
# - Lingea Německý Kapesní slovník
# - Lingea Anglický Kapesní slovník
# - Lingea 2002 series (theoretically all of them)
# - Lingea 2000 series (theoretically all of them)
# - Lingea Pocket series
#
# Tested on this dicts:
# lg_czen-eco.trd
# lg_czen-ind.trd
# lg_czen-law.trd
# lg_czen-2.trd
# lg_czgr-eco.trd
# lg_czgr-1.trd
# lg_encz-abc.trd
# lg_encz-eco.trd
# lg_encz-grm.trd
# lg_encz-ind.trd
# lg_encz-laa.trd
# lg_encz-law.trd
# lg_encz-2.trd
# lg_en-rth.trd
# lg_ensk-2.trd
# lg_ensk-2_.trd
# lg_en-wn.trd
# lg_frcz-1f.trd
# lg_grcz-eco.trd
# lg_grcz-1.trd
# lg_grsk-2.trd
# lg_sken-2.trd
# lg_sken-2_.trd
# lg_skgr-2.trd
# lg_spcz-1.trd
# 00czus-1.trd
# 00uscz-1.trd
#
#
# Modified by:
# - Petr Dlouhy (petr.dlouhy | email.cz)
# Generalization of data block rules, sampleFlag 0x04, sound out fix, data phrase prefix with comment (0x04)
# HTML output, debugging patch, options on command line
# Decoding for 2000 and Pocket series.
#
# - Ing. Josef Riha ( jose1711 | gmail.com )
# Slovak letters support
#
# <write your name here>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# VERSION
VERSION = "0.7"
import getopt, sys
def usage():
print "Lingea Dictionary Decoder"
print "-------------------------"
print "Version: %s" % VERSION
print "Copyright (C) 2007 - Klokan Petr Pridal, Petr Dlouhy"
if (len(stream) != 13752) and (len(stream) != 21988) and (len(stream) != 16204) and (len(stream) != 12656) and (len(stream) != 30696) : #hack to workaround bug in some dicts (lg_czen-eco, lg_encz-ind, lg_czgr-eco, lg_grsk-2, lg_grcz-2.trd)
'#STROKE#', '#SHARP#', 'β', '#AL53#', '#AL54#', '#AL55#', '#AL56#', '#AL57#', 's', '#SYMBOL#', # symbol 58 is used in Spanish word pillo as s (seimpre)
'#PRON#', '#UPCASE#', '#SPECIAL#', '#UNICODE#'] # 4 bytes after unicode