From: <chr...@us...> - 2012-07-12 10:14:37
|
Revision: 3780 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3780&view=rev Author: christinaunger Date: 2012-07-12 10:14:30 +0000 (Thu, 12 Jul 2012) Log Message: ----------- [tbsl] fix: "exactly n", "at least n", etc. now behave analogous to "more than n" etc. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_Converter.java trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex trunk/components-ext/src/main/resources/tbsl/lexicon/english_oxford.lex Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_Converter.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_Converter.java 2012-07-11 18:10:57 UTC (rev 3779) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_Converter.java 2012-07-12 10:14:30 UTC (rev 3780) @@ -562,7 +562,7 @@ Set<Simple_DRS_Condition> emptyConditions = new HashSet<Simple_DRS_Condition>(); for (Simple_DRS_Condition c : drs.getAllSimpleConditions()) { - if(c.getPredicate().equals("empty")) { + if(c.getPredicate().equals("empty") || c.getPredicate().equals("empty_data")) { emptyConditions.add(c); } } @@ -572,8 +572,17 @@ boolean globalsuccess = false; for (Simple_DRS_Condition c : emptyConditions) { - String nounToExpand = c.getArguments().get(1).getValue(); - String fallbackNoun = c.getArguments().get(0).getValue(); + String nounToExpand; + String fallbackNoun; + boolean datatype = false; + if (c.getPredicate().equals("empty")) { + nounToExpand = c.getArguments().get(1).getValue(); + fallbackNoun = c.getArguments().get(0).getValue(); + } else { + nounToExpand = c.getArguments().get(0).getValue(); + fallbackNoun = c.getArguments().get(1).getValue(); // TODO das ist quark... + datatype = true; + } boolean success = false; loop: for (Simple_DRS_Condition sc : drs.getAllSimpleConditions()) { @@ -584,7 +593,8 @@ s.setSlotType(SlotType.PROPERTY); List<DiscourseReferent> newargs = new ArrayList<DiscourseReferent>(); newargs.add(c.getArguments().get(0)); - newargs.add(sc.getArguments().get(0)); + if (datatype) newargs.add(c.getArguments().get(1)); + else newargs.add(sc.getArguments().get(0)); sc.setArguments(newargs); success = true; globalsuccess = true; Modified: trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex =================================================================== --- trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex 2012-07-11 18:10:57 UTC (rev 3779) +++ trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex 2012-07-12 10:14:30 UTC (rev 3780) @@ -67,10 +67,11 @@ what || (DP DET:'what' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ ?y | ] ], [ (l2,y,noun,<e,t>) ], [ l2=l1 ],[]> many || (DP DET:'many' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] MANY y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> the || (DP DET:'the' NP[noun]) || <x, l1, <<e,t>,t>, [ l1:[x|] ], [ (l2,x,noun,<e,t>) ], [ l2=l1 ],[]> - at least || (DP DET:'at' DET:'least' NUM[num] NP[noun]) || <y,l1,<<e,t>,t>,[l1:[ y,j |count(a,y,j), greaterorequal(j,x) ]],[(l2,y,noun,<e,t>),(l3,x,num,e)],[ l1=l2, l2=l3 ],[]> - at most || (DP DET:'at' DET:'most' NUM[num] NP[noun]) || <y,l1,<<e,t>,t>,[l1:[ y,j | count(a,y,j), lessorequal(j,x) ]],[(l2,y,noun,<e,t>),(l3,x,num,e)],[ l1=l2, l2=l3 ],[]> - exactly || (DP DET:'exactly' NUM[num] NP[noun]) || <y,l1,<<e,t>,t>,[l1:[ y,j | count(y,j), equals(j,x) ]],[(l2,y,noun,<e,t>),(l3,x,num,e)],[ l1=l2, l2=l3 ],[]> - + at least || (DP DET:'at' DET:'least' NUM[num] NP[noun]) || <y,l1,<<e,t>,t>,[ l1:[ y,c | count(y,c), greaterorequal(c,x) ] ],[(l2,y,noun,<e,t>),(l3,x,num,e)],[l2=l1,l3=l1],[ SLOT_arg/RESOURCE/y ]> ;; <y,l1,<<e,t>,t>,[l1:[ y | greaterorequal(y,x) ]],[(l2,y,noun,<e,t>),(l3,x,num,e)],[ l1=l2, l2=l3 ],[ SLOT_arg/LITERAL/y ]> + at most || (DP DET:'at' DET:'most' NUM[num] NP[noun]) || <y,l1,<<e,t>,t>,[ l1:[ y,c | count(y,c), lessorequal(c,x) ] ],[(l2,y,noun,<e,t>),(l3,x,num,e)],[l2=l1,l3=l1],[ SLOT_arg/RESOURCE/y ]> ;; <y,l1,<<e,t>,t>,[l1:[ y | lessorequal(y,x) ]],[(l2,y,noun,<e,t>),(l3,x,num,e)],[ l1=l2, l2=l3 ],[ SLOT_arg/LITERAL/y ]> + exactly || (DP DET:'exactly' NUM[num] NP[noun]) || <y,l1,<<e,t>,t>,[ l1:[ y,c | count(y,c), equal(c,x) ] ],[(l2,y,noun,<e,t>),(l3,x,num,e)],[l2=l1,l3=l1],[ SLOT_arg/RESOURCE/y ]> ;; <y,l1,<<e,t>,t>,[l1:[ y | equal(y,x) ]],[(l2,y,noun,<e,t>),(l3,x,num,e)],[ l1=l2, l2=l3 ],[ SLOT_arg/LITERAL/y ]> + equal to || (DP DET:'equal' DET:'to' NUM[num] NP[noun]) || <y,l1,<<e,t>,t>,[ l1:[ y,c | count(y,c), equal(c,x) ] ],[(l2,y,noun,<e,t>),(l3,x,num,e)],[l2=l1,l3=l1],[ SLOT_arg/RESOURCE/y ]> ;; <y,l1,<<e,t>,t>,[l1:[ y | equal(y,x) ]],[(l2,y,noun,<e,t>),(l3,x,num,e)],[ l1=l2, l2=l3 ],[ SLOT_arg/LITERAL/y ]> + other || (NP ADJ:'other' NP*) || <x,l1,<e,t>,[ l1:[ | ] ], [],[],[]> total || (NP ADJ:'total' NP[np]) || <s,l1,<e,t>,[ l1:[ ?s | sum(a,x,s) ] ], [ (l2,x,np,<e,t>) ],[ l2=l1 ],[]> Modified: trunk/components-ext/src/main/resources/tbsl/lexicon/english_oxford.lex =================================================================== --- trunk/components-ext/src/main/resources/tbsl/lexicon/english_oxford.lex 2012-07-11 18:10:57 UTC (rev 3779) +++ trunk/components-ext/src/main/resources/tbsl/lexicon/english_oxford.lex 2012-07-12 10:14:30 UTC (rev 3780) @@ -34,7 +34,7 @@ with || (NP NP* (PP P:'with' DP[dp])) || <x,l1,<e,t>, [ l1:[ | empty(x,y) ] ], [ (l2,y,dp,<<e,t>,t>) ], [ l2=l1 ],[]> ;; <x,l1,<e,t>, [ l1:[ | SLOT_description(x,z), regextoken(z,y) ] ], [ (l2,y,dp,<<e,t>,t>) ], [ l2=l1 ],[ SLOT_description/DATATYPEPROPERTY/description, SLOT_arg/LITERAL/z ]> with || (PP P:'with' DP[dp]) || <x,l1,<e,t>, [ l1:[ | empty(x,y) ] ], [ (l2,y,dp,<<e,t>,t>) ], [ l2=l1 ],[]> ;; <x,l1,<e,t>, [ l1:[ | SLOT_description(x,z), regextoken(z,y) ] ], [ (l2,y,dp,<<e,t>,t>) ], [ l2=l1 ],[ SLOT_description/DATATYPEPROPERTY/description, SLOT_arg/LITERAL/z ]> - square meters || (DP N:'square' N:'meters') || <x,l1,<<e,t>,t>>, [l1:[ | SLOT_size(x,y) ]], [],[],[SLOT_size/DATATYPEPROPERTY/size ]> + square meters || (NP N:'square' N:'meters') || <x,l1,<e,t>, [l1:[ | SLOT_size(x,y) ]], [],[],[SLOT_size/DATATYPEPROPERTY/size ]> // MONTHS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |