Parsing and meaning of 口を開かずにはいられなかった


Teacher has just calmed down the class:

> ...が、すぐにまたみんな **口を開かずにはいられなかった** 。  
>  but immediately, again everyone _couldn't enter_ without opening their
> mouth.

I can't understand the phrase in bold. I'm not even sure whether it's

> 1) (口を開かずに)(は)(いられなかった) or  
>  2) (口を開かずに)(はいられなかった)

I'm guessing that it's the first parsing and it's something like "Couldn't
keep their mouths shut"/"Couldn't help but talk" etc. But if this is the case
I can't understand how the grammar works. Could someone please break down the
grammar and possibly give some other examples?




You are right, this means:

> But, suddenly they could not help but open their mouths.

"open their mouths" might be translated as "talk" but since it is context
dependent I prefer to stick to the literal meaning.

* * *

The grammar pattern at hand is: ～ずにはいられない・～ないではいられない and as you surmised it
means "cannot help ~". It is used only when you can't help something because
of your emotions or your passion for something. Basically it describes
something that you end up doing out of your control. Thus, you can almost
safely understand it as ～てしまう.

> おかしくて笑わないでいられない。  
>  It is so weird that I could not refrain but to laugh.



> 彼女は和菓子が大好きなだけあって、和菓子屋の前を通ると何かを買わずにはいられない。  
>  As we could expect from a big fan of Japanese candies, whenever she passes
> past a Japanese candies store, she can't resist her temptation to buy one.




You are right, this means:

> But, suddenly they could not help but open their mouths.

"open their mouths" might be translated as "talk" but since it is context
dependent I prefer to stick to the literal meaning.

* * *

The grammar pattern at hand is: ～ずにはいられない・～ないではいられない and as you surmised it
means "cannot help ~". It is used only when you can't help something because
of your emotions or your passion for something. Basically it describes
something that you end up doing out of your control. Thus, you can almost
safely understand it as ～てしまう.

> おかしくて笑わないでいられない。  
>  It is so weird that I could not refrain but to laugh.



> 彼女は和菓子が大好きなだけあって、和菓子屋の前を通ると何かを買わずにはいられない。  
>  As we could expect from a big fan of Japanese candies, whenever she passes
> past a Japanese candies store, she can't resist her temptation to buy one.

