Need suggestion for verse rule(s) for custom tag set

Discussion on theWord modules and other resources
RevSteve
Posts: 143
Joined: Thu Jun 28, 2018 5:45 am

Need suggestion for verse rule(s) for custom tag set

Post by RevSteve »

Good day everyone,
I must first state a few things, first, I am continually amazed at how I can take verse rules that don't quite fit a particular need and get them to work.
Secondly, I haven't a clue about these rules..sure, I can sort of read them but there is mystery to me concerning those
|morph$10 and then at the end of the rule...,$2,$3,etc.
Short of someone actually explaining some of that, I have been working on and off on some concept modules...that might never get to see the light of day but are very interesting none the less.

So if someone wants to reply back how I can hide the tag behind the word and get a popup, that would be good.
If not, at least I have them working when not hid behind the word...

First case, I have tried unsuccessfully to use the morph tag-style though I am unsure if anything other than what is the morphs coded into the program will work (that is hid behind the word for a popup).
This is the what I have (I see on web, it is important for the one asking for help to show what they have tried).
For this one, no strongs at all, in text.
<wt>word<WTspecialcode l="lemmaofword">

Then for verse rule, haha, this should be noticeable and actually I had modified a different verse rule and it worked about the same.

verse.rule="(<W(T\w+)>)([^<]+)<g>" "<a href=""_MORPH_$2|_NOLINK_"">$3</a>$1"

I was really surprised that this at least allowed the information to show when not hid behind the word.
I think I am missing a couple of lines perhaps, toggle line and that opening rule that ends with $3$4
That "g" probably doesn't belong either, I guess.

Then for a second situation, I have an English text with strongs and morph information.(I don't know if it is accurate or not..haven't taken the time to check it).

Fairly much standard style tagging but sometimes it has 2 sets of strongs and morphs for one english word.

is<WG2076><WTV-PXI-3S>

Then for this, I really butchered it, I am sure.

verse.rule="((^|(\ ))([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\[\]]+))" "$3<wt>$4"
verse.rule="<wt>([abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\[\]]+)(.*?)(<W(G\d+)>)?(<W(G\d+)>)?(<W(G\d+)>)?(<WT([^\ >]+)>)" "<wt><a href=_ORIGWORD_$1|_MORPH_$10|_STRONG_$4|_STRONG2_$6|_STRONG3_$8|_NOLINK_>$1</a>$2$3$5$7$9"
verse.rule="<V2>(.*?)</V2>" "<ST toggle=a><font color=red>$1</font><St>"
verse.rule="<V1>(.*?)</V1>" "<font color=#186BE7>$1</font>"


Amazingly however it does toggle and does display when not hid behind the word.

This second one is of least importance to me.

for the first one above, I am willing to modify if to whatever it takes...to get it to work...if this is possible.
I am guessing I will probably need to take the WT all the way out but still unsure how to get it hide and have a popup.

edit: For the first one above, I could create a faux strongs numbering system, say starting at G6000 but still, I would prefer correctly designed verse rules.
That way I could hide the "G" numbering system and make it work with the custom dictionary.
User avatar
jonathangkoehn
Posts: 1253
Joined: Wed Sep 29, 2010 11:04 pm
Location: Colorado, United States
Contact:

Re: Need suggestion for verse rule(s) for custom tag set

Post by jonathangkoehn »

Could you paste a line of the Biblical text in the .ont, .ot, or .nt format that you have.
Also if you check out Byz2005++ it has some good verse rules to compare against. (I believe they are based around some regex)

Secondly Rubio, Jon do you have some thoughts?
Jonathan Koehn @ https://www.thewordbooks.com
TotheWord make resources for theWord
2 Timothy 2:15 “Make every effort to present yourself before God as a proven worker who does not need to be ashamed, teaching the message of truth accurately.” NET2
User avatar
JG
Posts: 4599
Joined: Wed Jun 04, 2008 8:34 pm

Re: Need suggestion for verse rule(s) for custom tag set

Post by JG »

Need to see all the data really.
Jon
the
Word 6 Bible Software
OS for testing; Windows 10
Beta Download ------Beta Setup Guide------On-line Manual------Tech doc's and Utilities------Copyright Factsheet
RevSteve
Posts: 143
Joined: Thu Jun 28, 2018 5:45 am

Re: Need suggestion for verse rule(s) for custom tag set

Post by RevSteve »

Thanks for the replies,
Jonathan, I think although I haven't tried that particular one, once the strongs references are pulled out, the other references have to be adjusted, I presume.
But it is very similar to what I have except no strongs and custom tagging information.
What I posted, I noticed that part concerning the tag was in lower case....still I have fooled around with this long enough, not knowing the guidelines.

Let's suppose I have a Latin text and I have tags that don't follow the Morph ordering system and have no strongs.

I think then the conclusion is this is guarded information since I don't see anyone very knowledgeable.
And I haven't seen a breakdown of how the verse rules really work.

I will go a different route then, I have reasons why I don't post what I have.(that may change sometime in the future)
I may go with the faux strongs or just put it all in a dictionary.
User avatar
JG
Posts: 4599
Joined: Wed Jun 04, 2008 8:34 pm

Re: Need suggestion for verse rule(s) for custom tag set

Post by JG »

Can you put 50 lines in a txt file and post that?
Jon
the
Word 6 Bible Software
OS for testing; Windows 10
Beta Download ------Beta Setup Guide------On-line Manual------Tech doc's and Utilities------Copyright Factsheet
RevSteve
Posts: 143
Joined: Thu Jun 28, 2018 5:45 am

Re: Need suggestion for verse rule(s) for custom tag set

Post by RevSteve »

I have come up with a compromise, Jonathan, I thought a little more about your suggestion and it occurred to me, taking together with the faux strongs number.

So I decided to take the bible file I had without strongs and added a faux WG6000 in front of every entry morph tag.
So now I put in the 2005++ verse rule and that made the custom morph tags show up with hover over.
(I don't know why I didn't think of this sooner)

Thanks for the help, that allows me to run bible texts in parallel and assess the data that I have.
Things can get rather cluttered when running several bible texts while showing the tags.

One of these days when I get tired of playing around with all this data, I will contact someone concerning these concept modules, to see if there is any interest.
RubioTerra
Posts: 732
Joined: Wed Sep 23, 2009 5:13 pm
Location: Brasília, Brazil

Re: Need suggestion for verse rule(s) for custom tag set

Post by RubioTerra »

A verse rule is a find/replace mechanism using regular expressions. In essence what you do in a verse rule is to break a span of text into its parts to reassemble them into a new string obeying the syntax theWord expects. For instance, a rule to hide Strong's and morphology tags usually takes something like this:

Code: Select all

<wt>Βίβλος<WG976><WTN-NSF l="βίβλος">
and turn it into this:

Code: Select all

<wt><a href="_ORIGWORD_Βίβλος|_LEMMA_βίβλος|_STRONG_G976|_STRONG2|_STRONG3|_STRONG4_|_MORPH_N-NSF|_MORPH2_|_NOLINK_">Βίβλος</a><WG976><WTN-NSF l="βίβλος">
The $1, $2, $3 you see in the second part of the rule are references to the captured parts of the source string. Strings are captured using parentheses, so $1 is what's inside the first set of parentheses, $2 what's inside the second, and so on.
Rúbio R. C. Terra
Brasília/DF - Brasil
User avatar
JG
Posts: 4599
Joined: Wed Jun 04, 2008 8:34 pm

Re: Need suggestion for verse rule(s) for custom tag set

Post by JG »

Details of all theWord resources are in the documents on this page. https://www.theword.net/index.php?artic ... &l=english
Jon
the
Word 6 Bible Software
OS for testing; Windows 10
Beta Download ------Beta Setup Guide------On-line Manual------Tech doc's and Utilities------Copyright Factsheet
RevSteve
Posts: 143
Joined: Thu Jun 28, 2018 5:45 am

Re: Need suggestion for verse rule(s) for custom tag set

Post by RevSteve »

Thanks for the replies, especially yours Rubio, that has me on the way to understanding.
I was able to get the 1st bible module to popup after carefully considering what you wrote.

Actually, I got the english text with strongs and morph to sort of work but it only shows 1 morph on the words with 2 morphs.
Anyway, I am not that concerned with this one.

I did notice something that I haven't considered before however, and am unsure if it is normal.
In all my theWord installations it happens the same...but I do have custom bibles in all installations, so that may be the cause.

If I hide the morph and or strongs, then show codes and then rehide them, I have to go into settings and turn on strongs/morph
by checking the box "show strongs/morph codes and then check the box "show no link".

Maybe it is the way the software handles that situation or perhaps some of those custom bibles are causing the software to turn off those controls.

Back to concerning those verse rules, I am only familiar with basic regexes so this will take me a while to learn as I go.
I am learning many things at one time and generally have focus on what is next up that I need to figure out, which most of time, doesn't have anything to do with the bible software.
RubioTerra
Posts: 732
Joined: Wed Sep 23, 2009 5:13 pm
Location: Brasília, Brazil

Re: Need suggestion for verse rule(s) for custom tag set

Post by RubioTerra »

RevSteve wrote:If I hide the morph and or strongs, then show codes and then rehide them, I have to go into settings and turn on strongs/morph
by checking the box "show strongs/morph codes and then check the box "show no link".
Instead of hiding Strong's tags with the shortcut S, use Shift+S to hide them and keep them working on mouse over. For morphology, use Shift+M instead of M.
RevSteve wrote:Actually, I got the english text with strongs and morph to sort of work but it only shows 1 morph on the words with 2 morphs.
Anyway, I am not that concerned with this one.
Your verse rule needs to have captures for every Strong or morphology tag that can be attached to a word. Your rule probably is not matching all the tags. A good starting point to learn regex and test them is https://regex101.com/. Paste the first part of your verse rule in the Regular Expression field and a sample verse in the Test String box and you can preview the result and all the captures groups. Remember to replace all "" (two double-quotes) with " (one double-quote) in your regex.
Rúbio R. C. Terra
Brasília/DF - Brasil
RevSteve
Posts: 143
Joined: Thu Jun 28, 2018 5:45 am

Re: Need suggestion for verse rule(s) for custom tag set

Post by RevSteve »

Thanks Rubio,
I took a look at it and my verse rule looks fairly correct, only has a red line at the ending of the verse rule slash </a>.
Actually I had a find and replace problem with that module that greedy regexes had added in between those double morph entries a <wt> that I was unaware of.
When I took them out, the module works fine with the double morph entries.
I will reference that online resource in the future when needed.
Post Reply