B4J Library [Chargeable] BGL Parser

Java parser for Babylon dictionaries

A wrap for this project https://github.com/secnelis/BabylonDictParser




SMMBGLParser
Author:
SMM
Version: 0.13
  • Dict
    Methods:
    • Initialize (ba As anywheresoftware.b4a.BA, name As java.lang.String, author As java.lang.String) As void
    • addEntry (entry As smm.SBabylonParser.sDictEntry) As void
    • entries As anywheresoftware.b4a.objects.collections.List
    • IsInitialized As boolean
    Properties:
    • author As java.lang.String [read only]
    • title As java.lang.String [read only]
  • DictEntry
    Methods:
    • IsInitialized As boolean
    • alternates As anywheresoftware.b4a.objects.collections.List
    Properties:
    • definition As java.lang.String [read only]
    • wordClass As int [read only]
    • displayWord As java.lang.String [read only]
    • headWord As java.lang.String [read only]
    • phonetics As java.lang.String [read only]
  • SMMBGLParser
    Events:
    • _parsed (dict As Dict)
    Methods:
    • parseDict (dir As java.lang.String, zfile As java.lang.String, srcEncoding As java.lang.String, dstEncoding As java.lang.String) As void
    • Initialize (ba As anywheresoftware.b4a.BA, EventName As java.lang.String) As void
    Permissions:
    • android.permission.READ_EXTERNAL_STORAGE
    • android.permission.WRITE_EXTERNAL_STORAGE



Sample :

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Dim par As SMMBGLParser
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    par.Initialize("par")
    If File.Exists(File.DirApp,"babylon_english_chinese.bgl")= False Then
        File.Copy( File.DirAssets,"babylon_english_chinese.bgl",File.DirApp,"babylon_english_chinese.bgl")
       
    End If
    par.parseDict(File.DirApp, "babylon_english_chinese.bgl","GBK","GBK")

End Sub
Sub par_parsed(dict As Dict)
    Log(dict.title&" by "&dict.author)
    For Each ent As DictEntry In dict.entries
        Dim phonetic As String =""
        If ent.phonetics<>Null Then
            phonetic=" ("&ent.phonetics&") "
        End If
        Log(ent.wordClass&","&ent.headWord&phonetic&" = " &ent.alternates)
    Next
End Sub

Result would be something like this:


Please note before your donation:
* You will get a wrapper for the current version with methods mentioned above , there is no promise of any kind that I will add a new feature in the future and updates will be only to fix bugs in my wrapper .
* You can ask any question here or by PM prior to your donation to make sure this wrapper does what you need / want .
* A minimum of $10 (more is better ) is required to get this library . (You get B4A and B4J libraries)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…