From: <chr...@us...> - 2012-06-15 16:39:51
|
Revision: 3751 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3751&view=rev Author: christinaunger Date: 2012-06-15 16:39:44 +0000 (Fri, 15 Jun 2012) Log Message: ----------- [tbsl] final changes Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex trunk/components-ext/src/main/resources/tbsl/lexicon/english_oxford.lex trunk/components-ext/src/main/resources/tbsl/oxford_eval_additional_queries.txt trunk/components-ext/src/main/resources/tbsl/oxford_eval_queries.txt trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/OxfordEvaluation.java 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-06-15 14:46:46 UTC (rev 3750) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2012-06-15 16:39:44 UTC (rev 3751) @@ -54,7 +54,7 @@ replacements.addAll(Arrays.asList(genericReplacements)); replacements.addAll(Arrays.asList(hackReplacements)); - s = s.replaceAll(",\\s"," and "); + s = s.replaceAll(",\\s"," and ").replaceAll(" and but "," but "); for (int i = 0; i < replacements.size(); i += 2) { s = s.replaceAll(replacements.get(i), replacements.get(i + 1)); } Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java 2012-06-15 14:46:46 UTC (rev 3750) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java 2012-06-15 16:39:44 UTC (rev 3751) @@ -287,6 +287,10 @@ "<x,l1,t,[ l1:[|], l4:[ | SLOT_" + token + "(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + symslot + "]>" + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(x,y) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>" + " ;; <x,l1,t,[ l1:[|], l4:[ | empty(y,x) ] ],[(l2,x,subj,<<e,t>,t>),(l3,y,obj,<<e,t>,t>)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[]>"}; + String[] adjEntry = {token, + "(NP ADJ:'"+token+"' NP*)", + "<x,l1,<e,t>,[ l1:[ | SLOT_description(x,y), regex(y,'"+ token +"')] ],[],[],[ SLOT_description/DATATYPEPROPERTY/description ]>"}; + result.add(adjEntry); result.add(vEntry); } else if (pos.equals("VB")) { Modified: trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex =================================================================== --- trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex 2012-06-15 14:46:46 UTC (rev 3750) +++ trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex 2012-06-15 16:39:44 UTC (rev 3751) @@ -45,6 +45,7 @@ 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 ],[]> + find || (S (VP V:'find' DP[object])) || <x,l1,t,[ l1:[ ?x | x=y ] ],[ (l2,y,object,<<e,t>,t>) ],[ l1=l2 ],[]> // DETERMINER @@ -143,6 +144,10 @@ and || (NP NP* CC:'and' NP[np]) || <x,l1,<e,t>,[l1:[|x=y]],[(l2,y,np,<e,t>)],[l1=l2],[]> and || (VP VP* CC:'and' VP[vp]) || - and || (ADJ ADJ* CC:'and' ADJ[adj]) || - + + but || (S S* CC:'but' S[s]) || <x,l1,t,[l1:[|]],[(l2,y,s,t)],[l1=l2],[]> + but || (DP DP* CC:'but' DP[dp]) || <x,l1,<<e,t>,t>,[l1:[|]],[(l2,y,dp,<<e,t>,t>)],[l1=l2],[]> + but || (NP NP* CC:'but' NP[np]) || <x,l1,<e,t>,[l1:[|x=y]],[(l2,y,np,<e,t>)],[l1=l2],[]> 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],[]> Modified: trunk/components-ext/src/main/resources/tbsl/lexicon/english_oxford.lex =================================================================== --- trunk/components-ext/src/main/resources/tbsl/lexicon/english_oxford.lex 2012-06-15 14:46:46 UTC (rev 3750) +++ trunk/components-ext/src/main/resources/tbsl/lexicon/english_oxford.lex 2012-06-15 16:39:44 UTC (rev 3751) @@ -13,10 +13,13 @@ for . pounds || (NP NP* (PP P:'for' (NP NUM[num] N:'pounds'))) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y) ] ], [ (l2,y,num,e) ], [ l2=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> for more than . pounds || (NP NP* (PP P:'for' DET:'more' DET:'than' (NP NUM[num] N:'pounds'))) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), greater(y,z) ] ], [ (l2,z,num,e) ], [ l2=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> - for less than . pounds || (NP NP* (PP P:'for' DET:'more' DET:'than' (NP NUM[num] N:'pounds'))) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), less(y,z) ] ], [ (l2,z,num,e) ], [ l2=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> + for less than . pounds || (NP NP* (PP P:'for' DET:'less' DET:'than' (NP NUM[num] N:'pounds'))) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), less(y,z) ] ], [ (l2,z,num,e) ], [ l2=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> for less than || (NP NP* (PP P:'for' DET:'less' DET:'than' NUM[num])) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), less(y,z) ] ], [ (l2,z,num,e) ], [ l2=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> for more than || (NP NP* (PP P:'for' DET:'more' DET:'than' NUM[num])) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), greater(y,z) ] ], [ (l2,z,num,e) ], [ l2=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> + cheaper than . pounds || (NP NP* (ADJ ADJ:'cheaper' DET:'than' (NP NUM[num] N:'pounds'))) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), less(y,z) ] ], [ (l2,z,num,e) ], [ l2=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> + below . pounds || (NP NP* (PP P:'below' (NP NUM[num] N:'pounds'))) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), less(y,z) ] ], [ (l2,z,num,e) ], [ l2=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> from . to . pounds || (NP NP* (PP P:'from' NUM[num1] P:'to' NUM[num2] N:'pounds')) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), greaterorequal(y,n1), lessorequal(y,n2) ] ], [ (l2,n1,num1,e),(l3,n2,num2,e) ], [ l2=l1,l3=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> + between . and . pounds || (NP NP* (PP P:'between' NUM[num1] P:'and' NUM[num2] N:'pounds')) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), greaterorequal(y,n1), lessorequal(y,n2) ] ], [ (l2,n1,num1,e),(l3,n2,num2,e) ], [ l2=l1,l3=l1 ],[ SLOT_price/DATATYPEPROPERTY/price ]> 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 ]> square meters || (DP N:'square' N:'meters') || <x,l1,<<e,t>,t>>, [l1:[ | SLOT_size(x,y) ]], [],[],[SLOT_size/DATATYPEPROPERTY/size ]> Modified: trunk/components-ext/src/main/resources/tbsl/oxford_eval_additional_queries.txt =================================================================== --- trunk/components-ext/src/main/resources/tbsl/oxford_eval_additional_queries.txt 2012-06-15 14:46:46 UTC (rev 3750) +++ trunk/components-ext/src/main/resources/tbsl/oxford_eval_additional_queries.txt 2012-06-15 16:39:44 UTC (rev 3751) @@ -38,7 +38,7 @@ question: Give me all houses with gated entrance or in a gated community -question: Give me all recently refurbished houses with lift (access) +question: Give me all recently refurbished houses with lift question: Give me all houses with balcony and vaulted ceiling @@ -46,17 +46,17 @@ question: Give me all houses in a corner or end-of-terrace plot -question: Give me all houses with 3 bedrooms, but cheaper than 150000 GBP +question: Give me all houses with 3 bedrooms, but cheaper than 150000 pounds question: Give me all houses with at least 2 reception rooms and a garden -question: Give me all houses in/with a courtyard +question: Give me all houses with a courtyard question: Give me all houses with fireplace and a garden that is not communal question: Give me all houses with parking but not Victorian -//question: Give me all houses with 2-5 bedrooms, a balcony, and a price less than 450000 GBP +//question: Give me all houses with 2 to 5 bedrooms, a balcony, and a price less than 450000 pounds question: Give me all houses with 3 bathrooms, but not en-suite @@ -64,9 +64,9 @@ question: Give me all houses with double glazing and central heating -question: Give me all houses with “no upper chain” (means immediately available) +question: Give me all houses immediately available -question: Give me all houses listed Grade I or Grade II (means “under protection for age …”) +question: Give me all houses listed Grade I or Grade II question: Give me all houses that have recently replumbed @@ -76,4 +76,4 @@ question: Give me all houses in Banbury Road -question: Give me all houses in the area of (John) Radcliffe hospital \ No newline at end of file +question: Give me all houses in the area of John Radcliffe hospital \ No newline at end of file Modified: trunk/components-ext/src/main/resources/tbsl/oxford_eval_queries.txt =================================================================== --- trunk/components-ext/src/main/resources/tbsl/oxford_eval_queries.txt 2012-06-15 14:46:46 UTC (rev 3750) +++ trunk/components-ext/src/main/resources/tbsl/oxford_eval_queries.txt 2012-06-15 16:39:44 UTC (rev 3751) @@ -58,7 +58,7 @@ question: houses close to The King's Arms pub -question: houses with garden large at least 2 acres +question: houses with a garden that is at least 2 acres big question: houses with many reception rooms @@ -68,13 +68,13 @@ question: houses with double glazed windows -question: 2 bedroom houses near oxford train station +question: 2 bedroom houses near Oxford train station question: 4 bedroom detached houses in Oxford -question: studio apartments in summertown, Oxford +question: studio apartments in Summertown, Oxford -question: freehold houses with 2 bedrooms and a living room in banbury +question: freehold houses with 2 bedrooms and a living room in Banbury question: houses in Oxford city centre with at most 2 bedrooms @@ -94,7 +94,7 @@ question: flats near supermarket -question: give me flats in central Oxford with at least one bedroom below 1000 GBP a month? +question: give me flats in central Oxford with at least one bedroom below 1000 pounds a month? question: find 2 bedroom flats in walking distance from the computer science departement! @@ -122,7 +122,7 @@ question: what is the average price of furnished 1 bedroom apartments in Heddington? -question: how many flats are offered in central Oxford below 1000 GBP a month? +question: how many flats are offered in central Oxford below 1000 pounds a month? question: houses close to The Ashmolean Museum, with more than one bedroom @@ -162,7 +162,7 @@ question: houses with gated entrance or in a gated community -question: recently refurbished houses with lift (access) +question: recently refurbished houses with lift question: house with balcony and vaulted ceiling @@ -170,7 +170,7 @@ question: house in a corner or end-of-terrace plot -question: house with 3 bedrooms, but cheaper than 150000 GBP +question: house with 3 bedrooms, but cheaper than 150000 pounds question: house with at least 2 reception rooms and a garden @@ -186,11 +186,11 @@ question: house with double glazing and central heating -question: house with “no upper chain” (means immediately available) +question: house with immediately available -question: house listed Grade I or Grade II (means “under protection for age …”) +question: house listed Grade I or Grade II -question: house that has recently replumbed +question: house that has been recently replumbed question: house in Witney or Wolvercote @@ -198,4 +198,4 @@ question: house in Banbury Road -question: house in the area of (John) Radcliffe hospital +question: house in the area of John Radcliffe hospital Modified: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/OxfordEvaluation.java =================================================================== --- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/OxfordEvaluation.java 2012-06-15 14:46:46 UTC (rev 3750) +++ trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/OxfordEvaluation.java 2012-06-15 16:39:44 UTC (rev 3751) @@ -63,9 +63,9 @@ while((question = in.readLine()) != null){ question = question.replace("question:", "").trim(); if(question.isEmpty() || question.startsWith("//")) continue; - if(!question.toLowerCase().contains("Give me all") && Character.isLowerCase(question.charAt(0))){ - question = "Give me all " + question; - } + //if(!question.toLowerCase().contains("Give me all") && Character.isLowerCase(question.charAt(0))){ + // question = "Give me all " + question; + //} System.out.println("########################################################"); questionCnt++; System.out.println(question); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |