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.)