Open davidweichiang opened 2 years ago
The best solution I can think of so far is to allow conjunction of an FGG and a factor graph, so it will be insensitive to factorization. This would involve:
creating a new kind of terminal symbol that's not a factor -- let's call it "structural"
the FGG is designed with structural edges. For example, in the CFG example in Appendix A, there would be a structural edge from each terminal node to the following terminal node, to capture the linear ordering of the terminal symbols.
when conjoining FGG G with factor graph H, we select the factor graphs generated by G that generate exactly the same nodes and structural edges as H. We construct a new FGG that generates these graphs, with the union of the factors in the graphs generated by G and the factors in H.
This conjunction operation would be much more complicated but it can mostly be reused from the HRG parser I wrote way back when.
This thought is not fully formed, but can factorization apply to two FGGs at once?
Yes, but (1) the objection still stands that you'd have to make an FGG-to-conjoin-with that has a rule for every RHS size, and (2) you'd have to orchestrate the factorization of the two FGGs to use the same tree decomposition.
I think (2) is probably easy, since the two FGGs are required to have the same nodes.
Using conjunction to actually parse a string in parser.py is still not implemented, and one of the sticking points is that conjunction doesn't interact well with factorization. The FGG has rules of many different sizes, which factorization breaks into smaller rules. If we do conjunction before factorization, then we have to construct a FGG-to-conjoin-with that has many rules (n^{k+1} where k is the maximum size of a right-hand side). But if we do conjunction after factorization, we don't know how to construct the FGG-to-conjoin-with, because we don't know how the factorization goes.