[sword-devel] Python sword

pierre amadio amadio.pierre at gmail.com
Thu Nov 19 14:17:42 EST 2020


I do not know exactly what is osis, so i do not know how to make an "osis ref".
Assuming it is related to the cross-references option, i think
something like that gives you an osis output with "references"

import sys

key="Mark 1:1"
chapterNbr=1
moduleName="KJV"
vk=Sword.VerseKey(key)
markup=Sword.MarkupFilterMgr(Sword.FMT_OSIS)
markup.thisown=False
mgr = Sword.SWMgr(markup)
#I dont remember where i found those , but i guess it was in
bindings/objc/src/SwordManager.h
mgr.setGlobalOption("Strong's Numbers","Off")
mgr.setGlobalOption("Cross-references","On")
mgr.setGlobalOption("Lemmas","Off")
mod=mgr.getModule(moduleName)
mod.setKey(vk)
print(mod.renderText())

Note that you can generate the same output directly with diatheke:

diatheke -b KJV -o s -f OSIS -k Mark 1:1

On Thu, 19 Nov 2020 at 19:25, Fr Cyrille <fr.cyrille at tiberiade.be> wrote:
>
> If I remember well, python3-sword can help to make the osis ref in a file.
> How to do this exactly?
>
> Le 19/11/2020 à 17:58, pierre amadio a écrit :
> > Hi there !
> >
> > I am afraid there is no real documentation for the python binding
> > (someone please correct me if I m wrong).
> >
> > I think that, as they are build automatically with swig, they are
> > suppose to be identical to the way c++ work (with all the type
> > transformation magic that can go in the process...)
> >
> > Last time i played with python, i was using the C++ doc and using the
> > online python help mechanism to try to find wich method in python
> > matched with method in C++. It more or less worked as expected :-)
> >
> > Overview of the main classes:
> > http://www.crosswire.org/sword/develop/swordapi/apiprimer.jsp
> >
> > Some code example:
> > https://wiki.crosswire.org/DevTools:Code_Examples
> >
> > I do not know of an existing python frontend, but that would be the
> > best way to get working example.
> >
> > I have some example on my own i store in github:
> >
> > https://github.com/pierre-amadio/SwordSandBox/tree/master/python
> >
> > I hope it can help.
> >
> > On Thu, 19 Nov 2020 at 14:24, Fr Cyrille <fr.cyrille at tiberiade.be> wrote:
> >> Hello,
> >> I'm interesting to know how to use the python3-sword tool. Do you have
> >> any doc or information how to use it?
> >>
> >> Thank  you.
> >> Br Cyrille
> >> _______________________________________________
> >> sword-devel mailing list: sword-devel at crosswire.org
> >> http://crosswire.org/mailman/listinfo/sword-devel
> >> Instructions to unsubscribe/change your settings at above page
> > _______________________________________________
> > sword-devel mailing list: sword-devel at crosswire.org
> > http://crosswire.org/mailman/listinfo/sword-devel
> > Instructions to unsubscribe/change your settings at above page
>
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page


More information about the sword-devel mailing list