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:

Babylon English-Chinese (S) by Babylon Ltd.
48,zoster$93172$ (zos穞er || 'z<charset c=T>0251;</charset>st<charset c=T>0259;</charset>(r) /'z<charset c=T>0252;</charset>s-) = (ArrayList) []
52,zounds$93177$ (za<charset c=T>028A;</charset>ndz) = (ArrayList) []
48,zoysia$93178$ = (ArrayList) [zoysias]
48,zucchetto$93180$ = (ArrayList) [zucchettos]
48,zucchini$93181$ (zuc穋hi穘i || z<charset c=T>028A;</charset>'k<charset c=T>026A;</charset><charset c=T>02D0;</charset>n<charset c=T>026A;</charset>) = (ArrayList) [zucchinis]
48,zwieback$93190$ = (ArrayList) []
49,zygal$93191$ = (ArrayList) []
48,zygapophysis$93192$ = (ArrayList) [zygapophyses]
48,zygoma$93200$ (zy穏o穖a || za<charset c=T>026A;</charset>'g<charset c=T>0259;</charset><charset c=T>028A;</charset>m<charset c=T>0259;</charset> /z<charset c=T>026A;</charset>-) = (ArrayList) [zygomata, zygomas]
49,zygomatic$93202$ = (ArrayList) []
48,zygosis$93214$ = (ArrayList) [zygoses]
48,zygosperm$93217$ = (ArrayList) [zygosperms]
48,zygospore$93218$ = (ArrayList) [zygospores]
48,zygote$93220$ = (ArrayList) [zygotes]
48,zymase$93224$ = (ArrayList) []
48,zymogen$93225$ = (ArrayList) [zymogens]
49,zymogenic$93226$ = (ArrayList) []
49,zymoid$93231$ = (ArrayList) []
48,zymology$93233$ = (ArrayList) [zymologies]
48,zymolysis$93234$ = (ArrayList) [zymolyses]
49,zymoplastic$93236$ = (ArrayList) []
48,zymoscope$93239$ = (ArrayList) [zymoscopes]
48,zymosis$93240$ (zy穖o穝is || za<charset c=T>026A;</charset>'m<charset c=T>0259;</charset><charset c=T>028A;</charset>s<charset c=T>026A;</charset>s) = (ArrayList) [zymoses]
49,zymosthenic$93241$ = (ArrayList) []
49,zymotic$93242$ (zy'mot穒c || za<charset c=T>026A;</charset>'m<charset c=T>0251;</charset>t<charset c=T>026A;</charset>k /-'m<charset c=T>0252;</charset>t-) = (ArrayList) []
48,zymurgy$93244$ = (ArrayList) [zymurgies]

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 :D ) is required to get this library . (You get B4A and B4J libraries)
 
Top