Menu

Tree [r22] /
 History

HTTPS access


File Date Author Commit
 examples 2009-07-17 rupan [r21] first try at StarDict IFO creation & handling c...
 src 2009-07-22 rupan [r22] rework utf8 conversion
 Makefile 2009-06-25 rupan [r1] initial commit
 bgl_writer.make 2009-07-02 rupan [r12] import some values from bgl-reverse / Google Co...
 libbgl.make 2009-07-02 rupan [r12] import some values from bgl-reverse / Google Co...
 license.txt 2009-06-25 rupan [r1] initial commit
 premake4.lua 2009-06-25 rupan [r1] initial commit
 readme.txt 2009-06-28 rupan [r8] updates for type information found from google ...

Read Me

libbgl is released to the public under the terms of the GNU GPL version 3 or later.
All use is subject to its terms.

Glossary specifications were obtained from a number of sources, including:

  http://code.google.com/p/bgl-reverse/
  Google
  numerous forum postings
  my own time examining glossaries in a hex editor

Babylon glossaries (versions 1 and 2) are supported.  Sample Japanese <-> English:

http://www.babylon.com/files/Babylon6/genius_unabridged_eng_jap_eng_gen_jap_eng.exe
http://www.babylon.com/files/premium/taishukan/meikyo_jpn_jpn.bgl
http://info.babylon.com/glossaries/38B/Babylon_English_Japanese.BGL
http://info.babylon.com/glossaries/4E9/Babylon_Japanese_English_dicti.BGL

The API is simple, please see bgl_api.h for more complete documentation.
Each Babylon glossary is a collection of records of a certain set of types.  libbgl
simply reads the glossary and exports the raw data in a digestable format.  It is
not possible to "rewind" a glossary descriptor; you must close and reopen it.  Here
is a quick walkthrough of the API:

First declare some pointers:
  BGL *gloss;
  bgl_record *rec;

Next open a BGL handle for a given glossary:
  gloss = bgl_open("Babylon_English_Japanese.BGL");
  if(!gloss) ... handle the fault

Now iterate through all records in the glossary:
  while( bgl_hasMoreRecords(gloss) ) {
    rec = bgl_getNextRecord(gloss);
    if(!rec) ... handle the fault
    /* do something useful [see below] */
    bgl_freeRecord(rec);
  }

Finally close the glossary:
  bgl_close(gloss);

----------------------------------------------------------------------------------
  FAQ
----------------------------------------------------------------------------------

(Q) What?  I need to actually DO something with each record??

(A) Well, yes.  Every record in a Babylon glossary has a type.  Some types are not
well understood, but enough is known (or can be guessed) to make the glossary useful.

Overview of types:

Find out what type a record is by looking at rec->type.  Using this information,
cast rec->parsed to the appropriate data type as described below:

[This information may be out of date]

 0: (none)
    It is not known what these records are used for.
 1: record_entry_t
    This is an entry.  It contains a headword, a definition, and
    possibly other information.  It will be described in more
    detail below.
 2: record_resource_t
    These records contain named resources used in the glossary.
    For example, html files or jpeg/gif images.
 3: record_raw_t
    These records contain information about the glossary,
    such as hte author's email address or a text description
    of the glossary's contents.
 4: (none)
    This record indicates that there are no more records.
 6: (none)
    Only one record of this type per dictionary.
    Its purpose is unknown and it always has 0 data size.

(Q) Whats the deal with entries?

(A) Entries consist of:
    (1) a headword
    (2) the definition
    (3) 0 or more "items"
    Often there is additional information encoded in either (1), (2), or both.
    The headword may be concatenated with a number enclosed by '$' symbols.
    The definition may be concatenated with flags, most of which are not understood.
    "items" can be a number of things, for example verb conjugations

libbgl is copyright (c) 2008, 2009 Michael Mohr <akihana@gmail.com>