B4J Library [Chargeable] BGL Parser

Discussion in 'B4J Libraries & Classes' started by somed3v3loper, Jun 30, 2018.

  1. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    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 :

    Code:
    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 :D ) is required to get this library . (You get B4A and B4J libraries)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice