Example #1
0
def briefDemo() -> None:
    """
    Demonstrate finding files in some USX Bible folders.
    """
    BibleOrgSysGlobals.introduceProgram(__name__, programNameVersion,
                                        LAST_MODIFIED_DATE)

    # These are relative paths -- you can replace these with your test folder(s)
    testFolders = (
        BibleOrgSysGlobals.BOS_TEST_DATA_FOLDERPATH.joinpath('USXTest1/'),
        BibleOrgSysGlobals.BOS_TEST_DATA_FOLDERPATH.joinpath('USXTest2/'),
        BibleOrgSysGlobals.BOS_TEST_DATA_FOLDERPATH.joinpath('USFMTest1/'),
        BibleOrgSysGlobals.BOS_TEST_DATA_FOLDERPATH.joinpath('USFMTest2/'),
    )
    for testFolder in testFolders:
        vPrint('Quiet', debuggingThisModule, '\n')
        if os.access(testFolder, os.R_OK):
            UFns = USXFilenames(testFolder)
            vPrint('Quiet', debuggingThisModule, UFns)
            result = UFns.getDerivedFilenameTuples()
            vPrint('Quiet', debuggingThisModule, "\nPossible:", len(result),
                   result)
            result = UFns.getConfirmedFilenameTuples()
            vPrint('Quiet', debuggingThisModule, "\nConfirmed:", len(result),
                   result)
            result = UFns.getUnusedFilenames()
            vPrint('Quiet', debuggingThisModule, "\nOther:", len(result),
                   result)
        else:
            vPrint(
                'Quiet', debuggingThisModule,
                f"Sorry, test folder '{testFolder}' doesn't exist on this computer."
            )
Example #2
0
def fullDemo() -> None:
    """
    Full demo to check class is working
    """
    BibleOrgSysGlobals.introduceProgram(__name__, programNameVersion,
                                        LAST_MODIFIED_DATE)

    testFolder = BibleOrgSysGlobals.BADBAD_PARALLEL_RESOURCES_BASE_FOLDERPATH.joinpath(
        '../../ExternalPrograms/morphgnt/strongs-dictionary-xml/'
    )  # Greek lexicon folder

    # demonstrate the Greek Lexicon class
    vPrint('Normal', debuggingThisModule,
           "\nDemonstrating the Greek Lexicon class…")
    hl = GreekLexicon(testFolder)  # Load and process the XML
    vPrint('Quiet', debuggingThisModule, hl)  # Just print a summary
    vPrint('Quiet', debuggingThisModule, '')
    for strongsKey in (
            'G1',
            'G123',
            'G165',
            'G1732',
            'G1979',
            'G2011',
            'G5624',
            'G5625',
    ):  # Last one is invalid
        vPrint('Quiet', debuggingThisModule, '\n' + strongsKey)
        vPrint('Quiet', debuggingThisModule, " Data:",
               hl.getStrongsEntryData(strongsKey))
        vPrint('Quiet', debuggingThisModule, " Pronunciation:",
               hl.getStrongsEntryField(strongsKey, 'pronunciation'))
        vPrint('Quiet', debuggingThisModule, " HTML:",
               hl.getStrongsEntryHTML(strongsKey))
def briefDemo() -> None:
    """
    Main program to handle command line parameters and then run what they want.
    """
    BibleOrgSysGlobals.introduceProgram( __name__, programNameVersion, LAST_MODIFIED_DATE )

    if BibleOrgSysGlobals.commandLineArguments.export:
        bbosc = BibleBookOrdersConverter().loadSystems() # Load the XML
        bbosc.pickle() # Produce the .pickle file
        bbosc.exportDataToPython() # Produce the .py tables
        bbosc.exportDataToJSON() # Produce a json output file
        # bbosc.exportDataToC() # Produce the .h and .c tables

    else: # Must be demo mode
        # Demo the converter object
        bbosc = BibleBookOrdersConverter().loadSystems() # Load the XML
        vPrint( 'Quiet', debuggingThisModule, bbosc ) # Just print a summary
Example #4
0
def briefDemo() -> None:
    """
    Demonstrate reading and processing some UTF-8 ESFM files.
    """
    BibleOrgSysGlobals.introduceProgram( __name__, programNameVersion, LAST_MODIFIED_DATE )

    import os.path
    filepath = BibleOrgSysGlobals.BOS_TEST_DATA_FOLDERPATH.joinpath( 'MatigsalugDictionaryA.sfm' )
    vPrint( 'Info', debuggingThisModule, "Using {} as test file…".format( filepath ) )

    linesDB = ESFMFile()
    linesDB.read( filepath, ignoreSFMs=('mn','aMU','aMW','cu','cp') )
    vPrint( 'Quiet', debuggingThisModule, len(linesDB.lines), 'lines read from file', filepath )
    for i, r in enumerate(linesDB.lines):
        vPrint( 'Quiet', debuggingThisModule, i, r)
        if i>9: break
    vPrint( 'Quiet', debuggingThisModule, '…\n',len(linesDB.lines)-1, linesDB.lines[-1], '\n') # Display the last record
Example #5
0
def briefDemo() -> None:
    """
    Main program to handle command line parameters and then run what they want.
    """
    BibleOrgSysGlobals.introduceProgram( __name__, programNameVersion, LAST_MODIFIED_DATE )

    if BibleOrgSysGlobals.commandLineArguments.export:
        bosc = BibleOrganisationalSystemsConverter().loadAndValidate()
        bosc.pickle() # Produce a pickle output file
        bosc.exportDataToJSON() # Produce a json output file
        bosc.exportDataToPython() # Produce the .py tables
        # bosc.exportDataToC() # Produce the .h and .c tables

    else: # Must be demo mode
        # Demo the converter object
        bosc = BibleOrganisationalSystemsConverter().loadAndValidate()
        vPrint( 'Normal', debuggingThisModule, bosc ) # Just print a summary
Example #6
0
def fullDemo() -> None:
    """
    Full demo to check class is working
    """
    BibleOrgSysGlobals.introduceProgram(__name__, programNameVersion,
                                        LAST_MODIFIED_DATE)

    if BibleOrgSysGlobals.commandLineArguments.export:
        bpsc = BiblePunctuationSystemsConverter().loadSystems()  # Load the XML
        bpsc.pickle()  # Produce the .pickle file
        bpsc.exportDataToPython()  # Produce the .py tables
        bpsc.exportDataToJSON()  # Produce a json output file
        # bpsc.exportDataToC() # Produce the .h and .c tables

    else:  # Must be demo mode
        # Demo the converter object
        bpsc = BiblePunctuationSystemsConverter().loadSystems()  # Load the XML
        vPrint('Quiet', debuggingThisModule, bpsc)  # Just print a summary