On Tue, Nov 19, 2013 at 3:12 AM, Jim - FooBar(); <jimpil1...@gmail.com>wrote:
> > Shouldn't the EFF rule have caught the [:SIGN [:ADV "significantly"]] tag? > Why did it start a new PHRASE ? The same thing happens with XFOLD. iF the > 'x-fold' is before the adverb (2-fold increases) it shows in the DDIPK tag > otherwise (increases 2-fold) it appears after it in a new PHRASE tag. I'm > pretty sure the rule covers both cases and in fact it reaches the EFF rule > but it never mathes the * (ADV | XFOLD)? *rule. I am presuming this is > something quite simple... > Your EFF rule does not end with a SPACE. So if it chooses the adverb interpretation of "significantly", it's then looking to start a new PHRASE with a space, which your rules don't allow for. The fix is to put SPACE at the end of your EFF rule. Some of your other rules (e.g., DDIPK) have similar issues. Your grammar is highly ambiguous. You can see all the possible parses with the command: => (insta/parses parsePK "Exposure to oral didanosine is increased significantly when coadministered with tenofovir disoproxil fumarate.") but that's a lot of possibilities to comb through. => (count (insta/parses parsePK "Exposure to oral didanosine is increased significantly when coadministered with tenofovir disoproxil fumarate.")) 228 That's in large part because each possible special word can be interepreted both as its special meaning and just simply as an ordinary word. Also there are multiple valid places to end a phrase and begin a new one. To help troubleshoot this particular problem, I used: (clojure.pprint/pprint (distinct (map second (insta/parses parsePK "Exposure to oral didanosine is increased significantly when coadministered with tenofovir disoproxil fumarate.")))) Since you were mainly concerned with what ended up in the first phrase, this was an easy way to look specifically at that behavior. Instaparse allows you to have ambiguity and to prioritize certain interpretations with the ordered choice operator, but there might be a more elegant way to express the grammar. There may be some people on the instaparse group who would find it a fun exercise to figure out how to make your grammar more elegant. If you continue to have issues, perhaps you could post some example sentences and how you'd like them to be parsed, and see if anyone wants to help out. Also, if the whitespace continues to be a complicating factor, try out the auto-whitespace feature I mentioned in my last message. -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.