# Handling Optionality

The issue is that the optional pieces are occurring in rules of any length. E.g. we could have NP -> (D)(Adj)(Mod)N

The possible options for this are:

- NP -> D Adj Mod N
- NP -> D Adj N
- NP -> D Mod N
- NP -> D N
- NP -> Adj Mod N
- NP -> Adj N
- NP -> Mod N
- NP -> N

This can be seen as using a negated mask over the optional elements with the non-optional elements interpolated

- NP -> D Adj Mod N (000)
- NP -> D Adj N (001)
- NP -> D Mod N (010)
- NP -> D N (011)
- NP -> Adj Mod N (100)
- NP -> Adj N (101)
- NP -> Mod N (110)
- NP -> N (111)

if the bit at position n in the list of optionals is 1, then that position is removed.

## No Comments