# Is there an algorithmic way to determine whether a munakh is a munakh legarmei?

In general, a munakh before psik munakh revii is a munakh legarmei. That’s the easy part.

But this question makes it clear that there are others. Specifically, they occasionally occur

• Before mapakh
• Before a kadma that precedes darga or azla
• Before pazer

It’s clear that I can’t just search for, say, munakh psik mapakh, because when I do that, in addition to the three places mesorah says (according to that other question), I also get a false positive: Yehoshua 22:22.

Worse, if I search for munakh psik pazer, I get 66 results, only two of which (according to @Double AA) are legarmei.

So, is there any algorithmic way to determine which type of munakh something is? (Asking so I can make quantifiedcantillation.nl better.)

• From a programming perspective, the list of exceptions is really not very long. It will be much easier to hard code it than to put in what is sure to be a very convoluted algorithm. Commented Feb 10, 2019 at 16:06
• Possible duplicate judaism.stackexchange.com/q/36788/759 Commented Feb 10, 2019 at 16:09
• Note Munach before line darga munach revii is also legarmei like the common case, as is Munach before line revii (with one exception in Yeshaya כה אמר האל יקוק). Commented Feb 10, 2019 at 16:13
• Ok, great. It seems like - munakh | munakh revii - munakh | darga munakh revii - munakh | revii (minus Yeshayahu 42:5) - all of the exceptions listed in the question I cite and the possible dupe you mention If that’s it, coding the manual exceptions is the way to go. Thanks! Commented Feb 10, 2019 at 16:16
• I’ll also add that someone on Facebook just pointed me to en.wikisource.org/wiki/User:Dovi/Miqra_according_to_the_Mesorah. The link to the “Technical Base (Spreadsheet)” indicates whether every psik is normal or indicates legarmei. The XML source unfortunately doesn’t make the same distinction. Commented Feb 10, 2019 at 17:57