[sword-devel] Grep or Sed Command to Automate OSIS References?

Cyrille lafricain79 at gmail.com
Tue Feb 4 11:05:14 MST 2020



Le 04/02/2020 à 13:01, Greg Hellings a écrit :
>
>
> On Tue, Feb 4, 2020 at 11:52 AM Cyrille <lafricain79 at gmail.com
> <mailto:lafricain79 at gmail.com>> wrote:
>
>     Hello Greg,
>     Can you give more information about this python library please.
>     It's interesting. How to use it?
>
>
> The Python library is a binding of the C++ library that is
> auto-generated with Swig. So its API is almost the exact same as the
> C++ library, with a tiny number of additional bits to smooth the way
> into the Python world. In general, if it happens in the C++ code, you
> can rely on the same classes, objects, and methods to exist in the
> Python bindings. Even most of the operator definitions are maintained,
> although not all of them are possible as you are more limited in how
> you express those in Python.
>
> As I'm not an expert on the C++ API, any particular details you will
> need to ask those more knowledgeable about. But you should be able to
> scan any C or C++ Sword code and directly translate the calls into Python.

This is Chinese for me 😜 I'm sorry! I would like to knwo how to use
this script. I had a look for some package related to sword and python.
But I couldn't find anything in Debian/Ubuntu.
>
>     Is the library in the linux repo?
>
>
> That is going to be distro dependent. I maintain it in Fedora 31 as
> "python3-sword" (and previous as python2-sword and python-sword before
> that). I believe it's also in the EPEL7 repository for CentOS/RHEL 7
> users. It might be in EPEL8, if that's your thing, as well, but if not
> let me know and I'll make the branch for that.
>
> Other distros, you'll have to check. As long as your distro includes
> Python 2 or 3 build headers and the Swig tool (most of them do), then
> building it shouldn't be difficult. My build tree for Fedora is here:
> https://src.fedoraproject.org/rpms/sword/tree/master. To build the
> same either use SVN HEAD, or use my two swig-related patches in that
> tree, and add the appropriate options to your CMake invocation (they
> can be found in the sword.spec file but amount to
> -DSWORD_PYTHON_3:BOOL=TRUE to build the Python 3 version).
>
> --Greg
>
>
>     Le 04/02/2020 à 12:41, Greg Hellings a écrit :
>>     Maxwell,
>>
>>     If you install the Python bindings to the Sword library, you can
>>     use the library's extensive parsing information as well as its
>>     knowledge of locales. A very simple Python script[0] will iterate
>>     all lines of input (you can give it a list of file arguments, you
>>     can pipe the output of a different program to it, you can write
>>     the lines in manually from stdin) and parse them. Doing exactly
>>     this work was impetus to get the bindings fixed up and compiling
>>     again some years back when converting references by external
>>     means was awfully slow for another member of this list. Using the
>>     bindings like this became nearly fool-proof and brought down the
>>     amount of time required to execute from unbearably long periods
>>     to under a second.
>>
>>     --Greg
>>
>>     [0]
>>     https://gist.github.com/greg-hellings/0de55fc3e07d5014f005efc12ffbdffa
>>
>>     On Tue, Feb 4, 2020 at 11:28 AM Maxwell Murunga
>>     <maxmmur at gmail.com <mailto:maxmmur at gmail.com>> wrote:
>>
>>         Thank you Dominique; Thanks Cyrille; Thanks Greg.
>>
>>          
>>
>>         # “Additional” steps to get the awk script 
>>
>>         # working fine on macOS as it does on Linux
>>
>>         $ brew install gawk
>>
>>          
>>
>>         # If Terminal Throws Error
>>
>>         $ brew unlink awk
>>
>>         $ brew link --overwrite gawk
>>
>>          
>>
>>         # Confirm all went well!
>>
>>         $ gawk --version
>>
>>          
>>
>>         # Now proceed as normal
>>
>>         # Make the executable
>>
>>         $ chmod +x Ref2Osis.sh
>>
>>          
>>
>>         # Thereafter, run it
>>
>>         $ ./Ref2Osis.sh
>>
>>
>>         Works Perfect. 
>>
>>
>>         Blessed [be] the LORD God of Israel from everlasting, and to
>>         everlasting. Amen, and Amen. 
>>
>>          
>>
>>         ~~Shalom.
>>
>>
>>         On Sun, Feb 2, 2020 at 3:39 AM Cyrille <lafricain79 at gmail.com
>>         <mailto:lafricain79 at gmail.com>> wrote:
>>
>>             What are you doing exactly? If you try to convert the ref
>>             to osisRef Dominique wrote an awk script which works
>>             pretty good.
>>             See the attached file.
>>
>>             Le 01/02/2020 à 18:06, Maxwell Murunga a écrit :
>>>             Greetings Saints,
>>>
>>>             I'm processing an OSIS Commentary in InDesign using GREP:
>>>
>>>             *Find: *((\d+ )?(\w+?.? \d+[:]\d+)(.\d+)?([, \d]+(.\d+)?)*)
>>>             *Replace:* <reference osisRef="$1">$1</reference>
>>>
>>>             It partially accomplishes the task, but does not
>>>             automatically convert the book names to the standard
>>>             OSIS abbreviations. I also need help in figuring out how
>>>             to add looking for Arabic and Roman numerals (1-2
>>>             instances of the letter "I"; or simply "1" or "2" ) to
>>>             cover instances of something like I Corinthians or II
>>>             Corinthians; 1 Corinthians or 2 Corinthians.
>>>
>>>             Could anyone be so kind enough as to provide a *grep* or
>>>             *sed* script to auto convert any kind of
>>>             Bible reference into this format:
>>>
>>>             <reference osisRef="Gen.1.1">Genesis 1:1</reference>
>>>             <reference osisRef="2Chr.1.1">2 Chronicles 1:1</reference>
>>>             <reference osisRef="2Chr.1.1">II Chronicles 1:1</reference>
>>>
>>>             In Christ Alone,
>>>
>>>             Maxwell.
>>>
>>>             _______________________________________________
>>>             sword-devel mailing list: sword-devel at crosswire.org <mailto:sword-devel at crosswire.org>
>>>             http://www.crosswire.org/mailman/listinfo/sword-devel
>>>             Instructions to unsubscribe/change your settings at above page
>>
>>         _______________________________________________
>>         sword-devel mailing list: sword-devel at crosswire.org
>>         <mailto:sword-devel at crosswire.org>
>>         http://www.crosswire.org/mailman/listinfo/sword-devel
>>         Instructions to unsubscribe/change your settings at above page
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20200204/d0ef16cd/attachment-0001.html>


More information about the sword-devel mailing list