Hello,
While searching for a solution for handling zero/phantom words,
I had a side fun idea (not directly relevant to the said problem):
Enable specifying a wildcard word (similar to the facility provided with the !! command).
So I added this modification:
The wild-card symbol I used is \*, e.g. dict\* (I avoided a bare * in order not to clash with a bullet).
If a word contains a this wild-card symbol, then dictionary_lookup_wild() is invoked
instead of dictionary_lookup_list() !
The words that are found in this way are marked with [*].
Here are some results:
linkparser> \* feels good
Found 50860 linkages (1000 of 1000 random linkages had no P.P. violations)
Linkage 1, cost vector = (UNUSED=0 DIS= 0.00 LEN=4)
+----------->WV---------->+
+------Wd-----+-----Ss----+--Paf--+
| | | |
LEFT-WALL fettucini[*].n-u feels.v good.a
This indeed sounds reasonable...
We can insist to get a regular noun:
linkparser> \*.n feels good
Found 376 linkages (376 had no P.P. violations)
Linkage 1, cost vector = (UNUSED=0 DIS= 0.00 LEN=4)
+--------->WV-------->+
+-----Wd----+----Ss---+--Paf--+
| | | |
LEFT-WALL fallacy[*].n feels.v good.a
This time it is arguable...
Drawbacks:
1. Specifying a word to be resolved with no subscript is not supported,
because dictionary_lookup_wild() doesn't include this possibility (probably a design error).
2. It may easily panic.
This modification incurs a negligible overhead on regular sentence processing,
since only unknown words need to be checked for the wild-card symbol.
I don't know if this is too useful, but if it feels good I can send a patch.
But in any case, it may be useful to provide a user interface to do similar things.
I don't really know what the best way to do it is, but here is an example:
word_choice_symbol = "\1";
set_word_choice_file("some_file", word_choice_symbol);
sentence_parse(dict, "This ^Abe a test").
And in "some_file":
be: be is was will_be would_be am are
However, once the wildcard word is handled, its processing is heavy.
This is because all the dictionary matching words are fetched into the word slot, in order that the solver will choose the appropriate words.
Maybe it is possible to implement such a "fill in the gaps" more efficiently by performing a linkage on the words without the wildcard word, and:
1. Find the unmatched connectors of all the partial linkages between the given words.
This I don't know how to do (and I need this for other things!).
2. Search words in the dict with disjuncts that exactly match these connectors.
Here there is a question how to create a canonical form of a disjunct, in order to make the comparison.
Amir