<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 4, 2020 at 11:52 AM Cyrille <<a href="mailto:lafricain79@gmail.com">lafricain79@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
Hello Greg,<br>
Can you give more information about this python library please. It's
interesting. How to use it? </div></blockquote><div><br></div><div>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.</div><div><br></div><div>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.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Is the library in the linux repo?<br></div></blockquote><div><br></div><div>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.</div><div><br></div><div>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: <a href="https://src.fedoraproject.org/rpms/sword/tree/master">https://src.fedoraproject.org/rpms/sword/tree/master</a>. 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).</div><div><br></div><div>--Greg</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<br>
<div>Le 04/02/2020 à 12:41, Greg Hellings a
écrit :<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Maxwell,</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>--Greg<br>
</div>
<div><br>
</div>
<div>[0] <a href="https://gist.github.com/greg-hellings/0de55fc3e07d5014f005efc12ffbdffa" target="_blank">https://gist.github.com/greg-hellings/0de55fc3e07d5014f005efc12ffbdffa</a></div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Feb 4, 2020 at 11:28
AM Maxwell Murunga <<a href="mailto:maxmmur@gmail.com" target="_blank">maxmmur@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:rgb(37,37,37);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><font face="arial, sans-serif">Thank you </font></span>Dominique; <span style="font-family:arial,sans-serif;color:rgb(37,37,37)">Thanks
Cyrille; Thanks Greg.</span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:rgb(37,37,37);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><font face="arial, sans-serif"> </font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:rgb(37,37,37);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><font face="arial, sans-serif"># “Additional” steps to get
the awk script </font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:rgb(37,37,37);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><font face="arial, sans-serif"># working
fine on macOS as it does on Linux</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif">$
brew install gawk</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif"> </font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><font style="background-color:rgb(255,255,255)" face="arial,
sans-serif" color="#000000"># If Terminal Throws Error</font></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="background-color:rgb(255,255,255)"><font face="arial, sans-serif" color="#000000">$ <span style="background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">brew
unlink
awk</span></font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><font style="background-color:rgb(255,255,255)" face="arial,
sans-serif" color="#000000">$ <span style="background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">brew
link --overwrite gawk</span><span style="background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"></span></font></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:rgb(37,37,37);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><font face="arial, sans-serif"> </font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:rgb(37,37,37);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><font face="arial, sans-serif"># Confirm all went well!</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif">$
gawk --version</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif"> </font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif"># Now
proceed as normal</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif">#
Make the
executable</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif">$
chmod +x Ref2Osis.sh</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif"> </font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif">#
Thereafter, run it</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif">$
./Ref2Osis.sh</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif"><br>
</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif">Works
Perfect. </font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:black"><font face="arial, sans-serif"><br>
</font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt">Blessed
[be] the LORD God of Israel from everlasting, and to
everlasting. Amen, and Amen. <br>
</p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:rgb(37,37,37);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><font face="arial, sans-serif"> </font></span></p>
<p class="MsoNormal" style="margin:0in 0in 0.0001pt"><span style="color:rgb(37,37,37);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><font face="arial, sans-serif">~~Shalom.</font></span></p>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sun, Feb 2, 2020 at
3:39 AM Cyrille <<a href="mailto:lafricain79@gmail.com" target="_blank">lafricain79@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div> What are you doing exactly? If you try to convert
the ref to osisRef Dominique wrote an awk script which
works pretty good.<br>
See the attached file.<br>
<br>
<div>Le 01/02/2020 à 18:06, Maxwell Murunga a écrit :<br>
</div>
<blockquote type="cite">
<div dir="ltr"><span style="background-color:rgb(255,255,255)"><font face="tahoma, sans-serif" color="#000000">Greetings
Saints,</font></span>
<div><font face="tahoma, sans-serif" color="#000000"><span style="background-color:rgb(255,255,255)"><br>
</span></font>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000">I'm
processing an OSIS Commentary in InDesign
using GREP:<br>
</font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000"><br>
</font></div>
<div><font style="background-color:rgb(255,255,255)" face="monospace" color="#000000"><b>Find: </b>((\d+
)?(\w+?.? \d+[:]\d+)(.\d+)?([, \d]+(.\d+)?)*)</font></div>
<div><font style="background-color:rgb(255,255,255)" face="monospace" color="#000000"><b>Replace:</b> <reference
osisRef="$1">$1</reference></font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000"><br>
</font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000">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.</font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000"><br>
</font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000">Could
anyone be so kind enough as to provide a <b>grep</b>
or <b>sed</b> script to <span style="font-weight:bold;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">auto</span> convert
any kind of Bible <span style="font-weight:bold;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">reference</span> into
this format:<br>
</font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000"><br>
<<span style="font-weight:bold;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">reference</span> osisRef="Gen.1.1">Genesis
1:1</<span style="font-weight:bold;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">reference</span>><br>
</font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000"><<span style="font-weight:bold;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">reference</span> osisRef="2Chr.1.1">2 Chronicles 1:1</<span style="font-weight:bold;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">reference</span>></font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000"><<span style="font-weight:bold;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">reference</span> osisRef="2Chr.1.1">II
Chronicles 1:1</<span style="font-weight:bold;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial">reference</span>><br>
<br>
</font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000">In
Christ Alone,<br>
</font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000"><br>
</font></div>
<div><font style="background-color:rgb(255,255,255)" face="tahoma, sans-serif" color="#000000">Maxwell.</font></div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a>
<a href="http://www.crosswire.org/mailman/listinfo/sword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page</pre>
</blockquote>
<br>
</div>
</blockquote>
</div>
_______________________________________________<br>
sword-devel mailing list: <a href="mailto:sword-devel@crosswire.org" target="_blank">sword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/sword-devel" rel="noreferrer" target="_blank">http://www.crosswire.org/mailman/listinfo/sword-devel</a><br>
Instructions to unsubscribe/change your settings at above page</blockquote>
</div>
</blockquote>
<br>
</div>
</blockquote></div></div>