A more generic strategy that doesn't require changing internal tables.
Define two commands:
\newcommand{\semigroup}{(semi\discretionary{-)}{}{)}group}
\newcommand{\digraph}{di\-[rec\-ted~]graph}
For the second one the usual \-
suffices. For the first one the more powerful \discretionary
is needed:
\discretionary{<prebreak>}{<postbreak>}{<nobreak>}
If a line break (for hyphenation) takes place at the discretionary item, the <prebreak>
text will be at the end of the line and the <postbreak>
text at the start of the next line; otherwise <nobreak>
will be used.
Don't forget to type \semigroup{}
if a space follows.
In case you change your mind about \digraph
it will be easy to change its definition than hunting through the document for it.
Another definition for \digraph
allowing hyphenation after the closing bracket might be
\newcommand{\digraph}{di\-[rec\-ted\discretionary{]-}{}{\kern.3em]}graph}
(there can't be flexible spaces in the <nobreak>
text).
I don't think that infrequent "words" such as "(pseudo)scientific" (the full "pseudoscientific" is normally written without a hyphen) warrant a special treatment: it's easier to decide about hyphenation when the text is finished. However, you could make up your personal command:
\makeatletter
\newcommand{\myallowhy}{\nobreak\hskip\z@skip}
\makeatother
\newcommand{\spword}[1]{(#1\discretionary{-)}{}{)}\myallowhy}
and input it as
\spword{pseudo}scientific
The "pseudo" part would never be hyphenated. If that's desired, just change the definition into
\makeatletter
\newcommand{\myallowhy}{\nobreak\hskip\z@skip}
\makeatother
\newcommand{\spword}[1]{(#1\myallowhy\discretionary{-)}{}{)}\myallowhy}
In order to do the same (i.e. retain all hyphenation possibilities) for "(computer-)aided" (hyphenation: com·put·er and aid·ed) with a hard hyphen, one can define
\newcommand{\spwordH}[1]{(#1\myallowhy\discretionary{-)}{}{-)}\myallowhy}
Note: The definition of \myallowhy
is modelled on Babel's \allowhyphens
that can't be used here, because it's a no-op when the T1 encoding is in force.
Since \nobreak
is used after \makeatletter
its use is justified.