From: <chr...@us...> - 2012-01-05 17:44:31
|
Revision: 3531 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3531&view=rev Author: christinaunger Date: 2012-01-05 17:44:19 +0000 (Thu, 05 Jan 2012) Log Message: ----------- [tbsl] added HAVING-part to basic templates Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2BasicSPARQL_Converter.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/BasicQueryTemplate.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/BasicTemplator.java Added Paths: ----------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Having.java trunk/components-ext/src/main/resources/tbsl/lexicon/basic_english.lex Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2BasicSPARQL_Converter.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2BasicSPARQL_Converter.java 2012-01-05 17:42:15 UTC (rev 3530) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2BasicSPARQL_Converter.java 2012-01-05 17:44:19 UTC (rev 3531) @@ -16,6 +16,7 @@ import org.dllearner.algorithm.tbsl.sparql.Path; import org.dllearner.algorithm.tbsl.sparql.SPARQL_Aggregate; import org.dllearner.algorithm.tbsl.sparql.SPARQL_Filter; +import org.dllearner.algorithm.tbsl.sparql.SPARQL_Having; import org.dllearner.algorithm.tbsl.sparql.SPARQL_OrderBy; import org.dllearner.algorithm.tbsl.sparql.SPARQL_Pair; import org.dllearner.algorithm.tbsl.sparql.SPARQL_PairType; @@ -242,21 +243,41 @@ } } else if (predicate.equals("count")) { - // COUNT(?x) AS ?c - if (!literal) { - temp.addSelTerm(new SPARQL_Term(simple.getArguments().get(0).getValue(), SPARQL_Aggregate.COUNT, simple.getArguments().get(1).getValue())); - return temp; + if (simple.getArguments().size() == 1) { + temp.addSelTerm(new SPARQL_Term(simple.getArguments().get(0).getValue(), SPARQL_Aggregate.COUNT)); } else { - String fresh = "c"+createFresh(); - temp.addSelTerm(new SPARQL_Term(simple.getArguments().get(0).getValue(), SPARQL_Aggregate.COUNT, fresh)); - temp.addFilter(new SPARQL_Filter( - new SPARQL_Pair( - new SPARQL_Term(fresh), - new SPARQL_Term(simple.getArguments().get(1).getValue(),true), - SPARQL_PairType.EQ))); - return temp; + if (!literal) { + temp.addSelTerm(new SPARQL_Term(simple.getArguments().get(0).getValue(), SPARQL_Aggregate.COUNT, simple.getArguments().get(1).getValue())); + return temp; + } + else { // COUNT(?x) AS ?c + // String fresh = "c"+createFresh(); + // temp.addSelTerm(new SPARQL_Term(simple.getArguments().get(0).getValue(), SPARQL_Aggregate.COUNT, fresh)); + // temp.addFilter(new SPARQL_Filter( + // new SPARQL_Pair( + // new SPARQL_Term(fresh), + // new SPARQL_Term(simple.getArguments().get(1).getValue(),true), + // SPARQL_PairType.EQ))); + temp.addHaving(new SPARQL_Having("COUNT(?"+simple.getArguments().get(0).getValue() + ") = "+simple.getArguments().get(1).getValue())); + return temp; + } } + } else if (predicate.equals("count_greater")) { + temp.addHaving(new SPARQL_Having("COUNT(?"+simple.getArguments().get(0).getValue() + ") > "+simple.getArguments().get(1).getValue())); + return temp; + } else if (predicate.equals("count_less")) { + temp.addHaving(new SPARQL_Having("COUNT(?"+simple.getArguments().get(0).getValue() + ") < "+simple.getArguments().get(1).getValue())); + return temp; + } else if (predicate.equals("count_greatereq")) { + temp.addHaving(new SPARQL_Having("COUNT(?"+simple.getArguments().get(0).getValue() + ") >= "+simple.getArguments().get(1).getValue())); + return temp; + } else if (predicate.equals("count_lesseq")) { + temp.addHaving(new SPARQL_Having("COUNT(?"+simple.getArguments().get(0).getValue() + ") <= "+simple.getArguments().get(1).getValue())); + return temp; + } else if (predicate.equals("count_eq")) { + temp.addHaving(new SPARQL_Having("COUNT(?"+simple.getArguments().get(0).getValue() + ") = "+simple.getArguments().get(1).getValue())); + return temp; } else if (predicate.equals("sum")) { temp.addSelTerm(new SPARQL_Term(simple.getArguments().get(1).getValue(), SPARQL_Aggregate.SUM)); return temp; Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2012-01-05 17:42:15 UTC (rev 3530) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2012-01-05 17:44:19 UTC (rev 3531) @@ -87,7 +87,7 @@ Pattern vpassPattern = Pattern.compile("\\s(\\w+/VBD.(\\w+)/VBN)"); Pattern vpassinPattern = Pattern.compile("\\s((\\w+)/VPASS.\\w+/IN)"); Pattern gerundinPattern = Pattern.compile("\\s((\\w+)/((VBG)|(VBN)).\\w+/IN)"); - Pattern vprepPattern = Pattern.compile("\\s((\\w+)/V[A-Z]+\\s\\w+/(IN|TO))"); + Pattern vprepPattern = Pattern.compile("\\s((\\w+)(?<!have)/V[A-Z]+\\s\\w+/(IN|TO))"); Pattern whenPattern = Pattern.compile("(?i)(when/WRB\\s(.+\\s)(\\w+)/((V[A-Z]+)|(PASS[A-Z]+)))"); Pattern wherePattern = Pattern.compile("(?i)(where/WRB\\s(.+\\s)(\\w+)/((V[A-Z]+)|(PASS[A-Z]+)))"); Pattern adjsPattern = Pattern.compile("((\\w+)/JJ.(\\w+)/JJ)"); Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/BasicQueryTemplate.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/BasicQueryTemplate.java 2012-01-05 17:42:15 UTC (rev 3530) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/BasicQueryTemplate.java 2012-01-05 17:44:19 UTC (rev 3531) @@ -13,6 +13,7 @@ Set<Path> conditions; Set<SPARQL_Term> orderBy; Set<SPARQL_Filter> filter; + Set<SPARQL_Having> having; SPARQL_QueryType qt = SPARQL_QueryType.SELECT; List<Slot> slots; @@ -27,6 +28,7 @@ conditions = new HashSet<Path>(); orderBy = new HashSet<SPARQL_Term>(); filter = new HashSet<SPARQL_Filter>(); + having = new HashSet<SPARQL_Having>(); slots = new ArrayList<Slot>(); } @@ -71,6 +73,10 @@ } retVal += "}\n"; + + for (SPARQL_Having h : having) { + retVal += h + "\n"; + } if (orderBy != null && !orderBy.isEmpty()) { @@ -152,6 +158,14 @@ this.filter.add(f); } + + public Set<SPARQL_Having> getHavings() { + return having; + } + + public void addHaving(SPARQL_Having h) { + having.add(h); + } public Set<SPARQL_Term> getOrderBy() { @@ -241,7 +255,10 @@ public int hashCode() { final int prime = 31; int result = 1; + result = prime * result + + ((conditions == null) ? 0 : conditions.hashCode()); result = prime * result + ((filter == null) ? 0 : filter.hashCode()); + result = prime * result + ((having == null) ? 0 : having.hashCode()); result = prime * result + limit; result = prime * result + offset; result = prime * result + ((orderBy == null) ? 0 : orderBy.hashCode()); @@ -263,11 +280,21 @@ if (getClass() != obj.getClass()) return false; BasicQueryTemplate other = (BasicQueryTemplate) obj; + if (conditions == null) { + if (other.conditions != null) + return false; + } else if (!conditions.equals(other.conditions)) + return false; if (filter == null) { if (other.filter != null) return false; } else if (!filter.equals(other.filter)) return false; + if (having == null) { + if (other.having != null) + return false; + } else if (!having.equals(other.having)) + return false; if (limit != other.limit) return false; if (offset != other.offset) @@ -300,4 +327,5 @@ return true; } + } Added: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Having.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Having.java (rev 0) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Having.java 2012-01-05 17:44:19 UTC (rev 3531) @@ -0,0 +1,14 @@ +package org.dllearner.algorithm.tbsl.sparql; + +public class SPARQL_Having { + + public String filter; + + public SPARQL_Having(String s) { + filter = s; + } + + public String toString() { + return "HAVING (" + filter + ")"; + } +} Property changes on: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/SPARQL_Having.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/BasicTemplator.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/BasicTemplator.java 2012-01-05 17:42:15 UTC (rev 3530) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/BasicTemplator.java 2012-01-05 17:44:19 UTC (rev 3531) @@ -24,7 +24,7 @@ public class BasicTemplator { - String[] GRAMMAR_FILES = {"tbsl/lexicon/english.lex"}; + String[] GRAMMAR_FILES = {"tbsl/lexicon/basic_english.lex"}; PartOfSpeechTagger tagger; LTAGLexicon g; Added: trunk/components-ext/src/main/resources/tbsl/lexicon/basic_english.lex =================================================================== --- trunk/components-ext/src/main/resources/tbsl/lexicon/basic_english.lex (rev 0) +++ trunk/components-ext/src/main/resources/tbsl/lexicon/basic_english.lex 2012-01-05 17:44:19 UTC (rev 3531) @@ -0,0 +1,185 @@ + +// TO BE +// ------ + + is || (S DP[subject] (VP V:'is' DP[object])) || <x, l1, t, [ l1:[ | ], l2:[ | x=y ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + is || (S DP[subject] (VP V:'is' ADJ[comp])) || <x, l1, t, [ l1:[ | x=y ]], [ (l2,x,subject,<<e,t>,t>), (l3,y,comp,<e,t>) ], [ l2=l1, l3=l2 ],[]> + was || (S DP[subject] (VP V:'was' DP[object])) || <x, l1, t, [ l1:[ | ], l2:[ | x=y ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + was || (S DP[subject] (VP V:'was' ADJ[comp])) || <x, l1, t, [ l1:[ | x=y ]], [ (l2,x,subject,<<e,t>,t>), (l3,y,comp,<e,t>) ], [ l2=l1, l3=l2 ],[]> + which is || (NP NP* (S C:'which' (VP V:'is' DP[object]))) || <x, l1, t, [ l1:[ | x=y ] ], [ (l2,y,object,<<e,t>,t>) ], [ l2=l1 ],[]> + that is || (NP NP* (S C:'that' (VP V:'is' DP[object]))) || <x, l1, t, [ l1:[ | x=y ] ], [ (l2,y,object,<<e,t>,t>) ], [ l2=l1 ],[]> + + are || (S DP[subject] (VP V:'are' DP[object])) || <x, l1, t, [ l1:[ | ], l2:[ | x=y ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + are || (S DP[subject] (VP V:'are' ADJ[comp])) || <x, l1, t, [ l1:[ | x=y ]], [ (l2,x,subject,<<e,t>,t>), (l3,y,comp,<e,t>) ], [ l2=l1, l3=l2 ],[]> + were || (S DP[subject] (VP V:'were' DP[object])) || <x, l1, t, [ l1:[ | ], l2:[ | x=y ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + were || (S DP[subject] (VP V:'were' ADJ[comp])) || <x, l1, t, [ l1:[ | x=y ]], [ (l2,x,subject,<<e,t>,t>), (l3,y,comp,<e,t>) ], [ l2=l1, l3=l2 ],[]> + which are || (NP NP* (S C:'which' (VP V:'are' DP[object]))) || <x, l1, t, [ l1:[ | x=y ] ], [ (l2,y,object,<<e,t>,t>) ], [ l2=l1 ],[]> + that are || (NP NP* (S C:'that' (VP V:'are' DP[object]))) || <x, l1, t, [ l1:[ | x=y ] ], [ (l2,y,object,<<e,t>,t>) ], [ l2=l1 ],[]> + + is there || (S V:'is' C:'there' DP[dp]) || <x, l1, t, [ l1:[ | ] ], [ (l2,x,dp,<<e,t>,t>) ], [ l2=l1 ],[]> + are there || (S V:'are' C:'there' DP[dp]) || <x, l1, t, [ l1:[ | ] ], [ (l2,x,dp,<<e,t>,t>) ], [ l2=l1 ],[]> + is there || (S DP[dp] (VP V:'is' C:'there')) || <x, l1, t, [ l1:[ | ] ], [ (l2,x,dp,<<e,t>,t>) ], [ l2=l1 ],[]> + are there || (S DP[dp] (VP V:'are' C:'there')) || <x, l1, t, [ l1:[ | ] ], [ (l2,x,dp,<<e,t>,t>) ], [ l2=l1 ],[]> + +// TO BE: YES/NO QUESTIONS + + is || (S (VP V:'is' DP[subject] DP[object])) || <x, l1, t, [ l1:[ | ], l2:[ | x=y ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + is || (S (VP V:'is' DP[subject] ADJ[comp])) || <x, l1, t, [ l1:[ | x=y ]], [ (l2,x,subject,<<e,t>,t>), (l3,y,comp,<e,t>) ], [ l2=l1, l3=l2 ],[]> + was || (S V:'was' DP[subject] DP[object]) || <x, l1, t, [ l1:[ | ], l2:[ | x=y ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + was || (S V:'was' DP[subject] ADJ[comp]) || <x, l1, t, [ l1:[ | x=y ]], [ (l2,x,subject,<<e,t>,t>), (l3,y,comp,<e,t>) ], [ l2=l1, l3=l2 ],[]> + are || (S V:'are' DP[subject] DP[object]) || <x, l1, t, [ l1:[ | ], l2:[ | x=y ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + are || (S V:'are' DP[subject] ADJ[comp]) || <x, l1, t, [ l1:[ | x=y ]], [ (l2,x,subject,<<e,t>,t>), (l3,y,comp,<e,t>) ], [ l2=l1, l3=l2 ],[]> + were || (S V:'were' DP[subject] DP[object]) || <x, l1, t, [ l1:[ | ], l2:[ | x=y ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + were || (S V:'were' DP[subject] ADJ[comp]) || <x, l1, t, [ l1:[ | x=y ]], [ (l2,x,subject,<<e,t>,t>), (l3,y,comp,<e,t>) ], [ l2=l1, l3=l2 ],[]> + + did || (S V:'did' S*) || <x,l1,t,[ l1:[|] ],[],[],[]> + +// IMPERATIVES +// --------------------- + + give me || (S (VP V:'give' (DP N:'me') DP[object])) || <x,l1,t,[ l1:[ ?x | x=y ] ],[ (l2,y,object,<<e,t>,t>) ],[ l1=l2 ],[]> + name || (S (VP V:'name' DP[object])) || <x,l1,t,[ l1:[ ?x | x=y ] ],[ (l2,y,object,<<e,t>,t>) ],[ l1=l2 ],[]> +// give me all || (S (VP V:'give' (DP N:'me') DET:'all' DP[object])) || <x,l1,t,[ l1:[ ?x | x=y ] ],[ (l2,y,object,<<e,t>,t>) ],[ l1=l2 ],[]> +// name all || (S (VP V:'name' DET:'all' DP[object])) || <x,l1,t,[ l1:[ ?x | x=y ] ],[ (l2,y,object,<<e,t>,t>) ],[ l1=l2 ],[]> + show me || (S (VP V:'show' (DP N:'me') DP[object])) || <x,l1,t,[ l1:[ ?x | x=y ] ],[ (l2,y,object,<<e,t>,t>) ],[ l1=l2 ],[]> + show || (S (VP V:'show' DP[object])) || <x,l1,t,[ l1:[ ?x | x=y ] ],[ (l2,y,object,<<e,t>,t>) ],[ l1=l2 ],[]> + list me || (S (VP V:'list' (DP N:'me') DP[object])) || <x,l1,t,[ l1:[ ?x | x=y ] ],[ (l2,y,object,<<e,t>,t>) ],[ l1=l2 ],[]> + list || (S (VP V:'list' DP[object])) || <x,l1,t,[ l1:[ ?x | x=y ] ],[ (l2,y,object,<<e,t>,t>) ],[ l1=l2 ],[]> + + +// DETERMINER +// ---------- + + a || (DP DET:'a' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] SOME y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + an || (DP DET:'an' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] SOME y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + all || (DP DET:'all' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] EVERY y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + all the || (DP DET:'all' DET:'the' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ y | ] ], [ (l2,y,noun,<e,t>) ], [ l2=l1 ],[]> + every || (DP DET:'every' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] EVERY y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + no || (DP DET:'no' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] NO y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + each || (DP DET:'each' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] EVERY y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + the most || (DP DET:'the' ADJ:'most' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] THEMOST y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + the least || (DP DET:'the' ADJ:'least' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] THELEAST y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + most || (DP DET:'most' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] MOST y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + a few || (DP DET:'a' ADJ:'few' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] AFEW y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + some || (DP DET:'some' NP[noun]) || <x, l1, <<e,t>,t>, [ l1:[ x | ] ], [ (l2,x,noun,<e,t>) ], [ l2=l1 ],[]> + which || (DP DET:'which' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ ?y | ] ], [ (l2,y,noun,<e,t>) ], [ l2=l1 ],[]> + 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 | count_greatereq(y,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 | count_lesseq(y,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 | count_eq(y,x) ]],[(l2,y,noun,<e,t>),(l3,x,num,e)],[ l1=l2, l2=l3 ],[]> + + 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 ],[]> + + least || (ADJ DET:'least' ADJ*) || <x,l1,<e,t>,[ l1:[ | minimum(a,x,x) ] ], [],[],[]> + + how many || (DET DET:'how' DET:'many') || <x,l1,e, [ l1:[ ?x | ] ], [],[],[]> + how many || (DET DET:'how' DET:'many') || <x,l1,e, [ l1:[ | count(x) ] ], [],[],[]> + a || (DET DET:'a') || <x,l1,e, [ l1:[ x |] ], [],[],[]> + an || (DET DET:'an') || <x,l1,e, [ l1:[ x |] ], [],[],[]> + which || (DET DET:'which') || <x,l1,e, [ l1:[ ?x |] ], [],[],[]> + the || (DET DET:'the') || <x,l1,e, [ l1:[ x |] ], [],[],[]> + the most || (DET DET:'the' DET:'most') || <y, l1, e, [ l1:[ | l2:[ y | ] THEMOST y l3:[|] ] ], [], [],[]> + the least || (DET DET:'the' DET:'least') || <y, l1, e, [ l1:[ | l2:[ y | ] THELEAST y l3:[|] ] ], [], [],[]> + + // NECESSARY "CHEAT" + highest || (NP ADJ:'highest' NP*) || <x, l1, e, [ l1:[ | maximum(x) ] ], [], [],[]> ;; <x, l1, e, [ l1:[ j | SLOT_high(x,j), maximum(j) ] ],[],[],[ SLOT_high/PROPERTY/height ]> + + // COUNT + more than || (DP DET:'more' DET:'than' NUM[num] NP[np]) || <y,l1,<<e,t>,t>,[ l1:[ y,c | count_greater(y,z) ] ],[(l2,y,np,<e,t>),(l3,z,num,e)],[l2=l1,l3=l1],[]> ;; <y,l1,<<e,t>,t>,[ l1:[ y | greater(y,z) ] ],[(l2,y,np,<e,t>),(l3,z,num,e)],[l2=l1,l3=l1],[]> + less than || (DP DET:'less' DET:'than' NUM[num] NP[np]) || <y,l1,<<e,t>,t>,[ l1:[ y,c | count_less(y,z) ] ],[(l2,y,np,<e,t>),(l3,z,num,e)],[l2=l1,l3=l1],[]> ;; <y,l1,<<e,t>,t>,[ l1:[ y | less(y,z) ] ],[(l2,y,np,<e,t>),(l3,z,num,e)],[l2=l1,l3=l1],[]> + + // HOW + // how || (DP DET:'how' ADJ[adj]) || <x,l1,<<e,t>,t>,[ l1:[?x,|] ],[ (x,l2,adj,<e,t>) ],[l2=l1],[]> + + +// EMPTY STUFF +// ------------ + + also || (VP ADV:'also' VP*) || <x,l1,t,[ l1:[|] ],[],[],[]> + also || (DP ADV:'also' DP*) || <x,l1,<<e,t>,t>,[ l1:[|] ],[],[],[]> + + has || (S DP[subject] (VP V:'has' DP[object])) || <x, l1, t, [ l1:[ | ], l2:[ | empty(x,y) ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + have || (S DP[subject] (VP V:'have' DP[object])) || <x, l1, t, [ l1:[ | ], l2:[ | empty(x,y) ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + had || (S DP[subject] (VP V:'had' DP[object])) || <x, l1, t, [ l1:[ | ], l2:[ | empty(x,y) ] ], [ (l3,x,subject,<<e,t>,t>), (l4,y,object,<<e,t>,t>) ], [ l3<l1, l4<l1, l2<scope(l3), l2<scope(l4) ],[]> + +// with || (NP NP* (PP P:'with' DP[dp])) || <x,l1,<e,t>,[ l1:[| empty(x,y) ] ],[(l2,y,dp,<<e,t>,t>)],[l2=l1],[]> + + people || (NP N:'people') || <x,l1,<e,t>,[ l1:[|] ],[],[],[]> + + +// WH WORDS +// -------- + + what || (DP WH:'what') || <x, l1, <<e,t>,t>, [ l1:[ ?x | ] ], [], [], []> + which || (DP WH:'which') || <x, l1, <<e,t>,t>, [ l1:[ ?x | ] ], [], [], []> + how many || (DP WH:'how' ADJ:'many' NP[noun]) || <y, l1, <<e,t>,t>, [ l1:[ | l2:[ y | ] HOWMANY y l3:[|] ] ], [ (l4,y,noun,<e,t>) ], [ l4=l2 ],[]> + who || (DP WH:'who') || <x, l1, <<e,t>,t>, [ l1:[ ?x | ] ], [], [], []> + whom || (DP WH:'whom') || <x, l1, <<e,t>,t>, [ l1:[ ?x | ] ], [], [], []> + when || (S WH:'when' S[s]) || <x, l1, t, [ l1:[ ?x | SLOT_p(y,x) ] ], [(l2,y,s,t)], [l2=l1], [ SLOT_p/PROPERTY/date ]> + when || (DP WH:'when') || <y, l1, <<e,t>,t>, [ l1:[ ?x | SLOT_p(y,x) ] ], [], [], [ SLOT_p/PROPERTY/date ]> + where || (S WH:'where' S[s]) || <x, l1, t, [ l1:[ ?x | SLOT_p(y,x) ] ], [(l2,y,s,t)], [l2=l1], [ SLOT_p/PROPERTY/place ]> + where || (DP WH:'where') || <y, l1, <<e,t>,t>, [ l1:[ ?x | SLOT_p(y,x) ] ], [], [], [ SLOT_p/PROPERTY/place ]> + where in || (DP WH:'where' (PP P:'in' DP[dp])) || <y, l1, <<e,t>,t>, [ l1:[ ?x | SLOT_p(y,x), SLOT_in(x,z) ] ], [(l2,z,dp,<<e,t>,t>)], [l2=l1], [ SLOT_p/PROPERTY/place ]> + + +// NEGATION +// -------- + + not || (ADJ NEG:'not' ADJ*) || <x,l2,t,[ l1:[ | NOT l2:[|] ] ],[],[],[]> + not || (VP NEG:'not' VP*) || <x,l2,t,[ l1:[ | NOT l2:[|] ] ],[],[],[]> + did not || (VP V:'did' NEG:'not' VP*) || <x,l2,t,[ l1:[ | NOT l2:[|] ] ],[],[],[]> + does not || (VP V:'does' NEG:'not' VP*) || <x,l2,t,[ l1:[ | NOT l2:[|] ] ],[],[],[]> + do not || (VP V:'do' NEG:'not' VP*) || <x,l2,t,[ l1:[ | NOT l2:[|] ] ],[],[],[]> + + +// COORDINATION +// ------------ + + and || (S S* CC:'and' S[s]) || <x,l1,t,[l1:[|]],[(l2,y,s,t)],[l1=l2],[]> + and || (DP DP* CC:'and' DP[dp]) || <x,l1,<<e,t>,t>,[l1:[|]],[(l2,y,dp,<<e,t>,t>)],[l1=l2],[]> + and || (NP NP* CC:'and' NP[np]) || <x,l1,<e,t>,[l1:[|]],[(l2,y,np,<e,t>)],[l1=l2],[]> + and || (VP VP* CC:'and' VP[vp]) || - + and || (ADJ ADJ* CC:'and' ADJ[adj]) || - + + as well as || (NP NP* CC:'as' CC:'well' CC:'as' NP[np]) || <x,l1,<e,t>,[l1:[|]],[(l2,y,np,<e,t>)],[l1=l2],[]> + + or || (S S* CC:'or' S[2]) || - + or || (DP DP* CC:'or' DP[2]) || - + or || (NP NP* CC:'or' NP[2]) || - + or || (VP VP* CC:'or' VP[2]) || - + or || (ADJ ADJ* CC:'or' ADJ[2]) || - + + +// EXISTENTIAL +// ----------- + + there || (DP (NP EX:'there')) || <x,l1,<<e,t>,t>,[l1:[|]],[],[],[]> + + +// NUMBERS (1-10) +// --------------------- + + one || (NP NUM:'one' NP*) || <x,l1,<e,t>,[l1:[x|count(x,1)]],[],[],[]> + two || (NP NUM:'two' NP*) || <x,l1,<e,t>,[l1:[x|count(x,2)]],[],[],[]> + three || (NP NUM:'three' NP*) || <x,l1,<e,t>,[l1:[x|count(x,3)]],[],[],[]> + four || (NP NUM:'four' NP*) || <x,l1,<e,t>,[l1:[x|count(x,4)]],[],[],[]> + five || (NP NUM:'five' NP*) || <x,l1,<e,t>,[l1:[x|count(x,5)]],[],[],[]> + six || (NP NUM:'six' NP*) || <x,l1,<e,t>,[l1:[x|count(x,6)]],[],[],[]> + seven || (NP NUM:'seven' NP*) || <x,l1,<e,t>,[l1:[x|count(x,7)]],[],[],[]> + eight || (NP NUM:'eight' NP*) || <x,l1,<e,t>,[l1:[x|count(x,8)]],[],[],[]> + nine || (NP NUM:'nine' NP*) || <x,l1,<e,t>,[l1:[x|count(x,9)]],[],[],[]> + ten || (NP NUM:'ten' NP*) || <x,l1,<e,t>,[l1:[x|count(x,10)]],[],[],[]> + + one || (NUM NUM:'one') || <x,l1,e,[l1:[x|equal(x,1)]],[],[],[]> + two || (NUM NUM:'two') || <x,l1,e,[l1:[x|equal(x,2)]],[],[],[]> + three || (NUM NUM:'three') || <x,l1,e,[l1:[x|equal(x,3)]],[],[],[]> + four || (NUM NUM:'four') || <x,l1,e,[l1:[x|equal(x,4)]],[],[],[]> + five || (NUM NUM:'five') || <x,l1,e,[l1:[x|equal(x,5)]],[],[],[]> + six || (NUM NUM:'six') || <x,l1,e,[l1:[x|equal(x,6)]],[],[],[]> + seven || (NUM NUM:'seven') || <x,l1,e,[l1:[x|equal(x,7)]],[],[],[]> + eight || (NUM NUM:'eight') || <x,l1,e,[l1:[x|equal(x,8)]],[],[],[]> + nine || (NUM NUM:'nine') || <x,l1,e,[l1:[x|equal(x,9)]],[],[],[]> + ten || (NUM NUM:'ten') || <x,l1,e,[l1:[x|equal(x,10)]],[],[],[]> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |