From: <chr...@us...> - 2011-10-31 14:14:41
|
Revision: 3344 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3344&view=rev Author: christinaunger Date: 2011-10-31 14:14:31 +0000 (Mon, 31 Oct 2011) Log Message: ----------- [tbsl] fixes for dbpedia:train Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/GrammarFilter.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/templator/SlotBuilder.java trunk/components-ext/src/main/resources/tbsl/evaluation/dbpedia-train-tagged(ideal).xml trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/GrammarFilter.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/GrammarFilter.java 2011-10-31 09:33:13 UTC (rev 3343) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/GrammarFilter.java 2011-10-31 14:14:31 UTC (rev 3344) @@ -299,8 +299,11 @@ semName = semName.substring(1); out.add(new Pair<String,String>("(NP NP* ADJ:'"+ w +"' " + rawNames + ")", "<x,l1,<e,t>,[ l1:[ y | SLOT_title(x,y), regex(y,'" + semName + "') ] ], [],[],[ SLOT_title/PROPERTY/title^name ]>")); + out.add(new Pair<String,String>("(NP NP* ADJ:'"+ w +"' " + rawNames + ")", "<x,l1,<e,t>,[ l1:[|] ],[],[],[ x/RESOURCE/"+semName+"]>")); out.add(new Pair<String,String>("(DP DP* ADJ:'"+ w +"' " + rawNames + ")", "<x,l1,<<e,t>,t>,[ l1:[ y | SLOT_title(x,y), regex(y,'" + semName + "') ] ], [],[],[ SLOT_title/PROPERTY/title^name ]>")); + out.add(new Pair<String,String>("(DP DP* ADJ:'"+ w +"' " + rawNames + ")", "<x,l1,<<e,t>,t>,[ l1:[|] ],[],[],[ x/RESOURCE/"+semName+"]>")); out.add(new Pair<String,String>("(ADJ ADJ:'"+ w +"' " + rawNames + ")", "<x,l1,<e,t>,[ l1:[ y | SLOT_title(x,y), regex(y,'" + semName + "') ] ], [],[],[ SLOT_title/PROPERTY/title^name ]>")); + out.add(new Pair<String,String>("(ADJ ADJ:'"+ w +"' " + rawNames + ")", "<x,l1,<e,t>,[ l1:[|] ],[],[],[ x/RESOURCE/"+semName+"]>")); return out; 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 2011-10-31 09:33:13 UTC (rev 3343) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2011-10-31 14:14:31 UTC (rev 3344) @@ -227,18 +227,22 @@ m = nnpPattern.matcher(flat); while (m.find()) { flat = flat.replaceFirst(m.group(1),m.group(2) + "_" + m.group(3)); + m = nnpPattern.matcher(flat); } m = nnpPattern.matcher(flat); while (m.find()) { flat = flat.replaceFirst(m.group(1),m.group(2) + "_" + m.group(3)); + m = nnpPattern.matcher(flat); } m = nnPattern.matcher(flat); while (m.find()) { flat = flat.replaceFirst(m.group(1),m.group(2) + "_" + m.group(3)); + m = nnPattern.matcher(flat); } m = nnnnpPattern.matcher(flat); while (m.find()) { flat = flat.replaceFirst(m.group(1),m.group(2) + "/JJ"); + m = nnnnpPattern.matcher(flat); } return flat; 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 2011-10-31 09:33:13 UTC (rev 3343) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java 2011-10-31 14:14:31 UTC (rev 3344) @@ -246,11 +246,15 @@ "(S DP[subj] (VP V:'" + token + "' DP[obj]))", "<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) ],[]>"}; + String[] passEntry2 = {token, + "(S DP[subj] (VP V:'" + token + "' NUM[num]))", + "<x,l1,t,[ l1:[|], l4:[ y | SLOT_" + token + "(x,y), DATE(y,z) ] ],[(l2,x,subj,<<e,t>,t>),(l3,z,num,e)],[ l2<l1,l3<l1,l4<scope(l2),l4<scope(l3) ],[" + symslot + "]>"}; String[] whEntry = {token, "(S DP[obj] (VP DP[subj] V:'" + token + "'))", "<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) ],[]>"}; result.add(passEntry); + result.add(passEntry2); result.add(whEntry); } else if (pos.equals("VBD") || pos.equals("VBZ") || pos.equals("VBP")) { @@ -279,7 +283,7 @@ result.add(wasGerEntry); } else if (pos.equals("WHEN")) { - String dateSlot = "SLOT_" + token + "/PROPERTY/" + token + "Date"; + String dateSlot = "SLOT_" + token + "/PROPERTY/" + token +"^" + token + "_date"; String tokenSlot = "SLOT_" + token + "/PROPERTY/" + token; String[] whenEntry1 = {token, "(S DP[subj] (VP V:'" + token + "'))", @@ -292,7 +296,7 @@ result.add(whenEntry2); } else if (pos.equals("WHERE")) { - String placeSlot = "SLOT_" + token + "/PROPERTY/" + token + "Place"; + String placeSlot = "SLOT_" + token + "/PROPERTY/" + token + "^" + token + "_place"; String tokenSlot = "SLOT_" + token + "/PROPERTY/" + token; String[] whereEntry1 = {token, "(S DP[subj] (VP V:'" + token + "'))", Modified: trunk/components-ext/src/main/resources/tbsl/evaluation/dbpedia-train-tagged(ideal).xml =================================================================== --- trunk/components-ext/src/main/resources/tbsl/evaluation/dbpedia-train-tagged(ideal).xml 2011-10-31 09:33:13 UTC (rev 3343) +++ trunk/components-ext/src/main/resources/tbsl/evaluation/dbpedia-train-tagged(ideal).xml 2011-10-31 14:14:31 UTC (rev 3344) @@ -1958,7 +1958,7 @@ </answers> </question> <question id="10"> -<string>Who/WP was/VBD the/DT wife/NN of/IN President/NNP Lincoln/NNP</string> +<string>Who/WP was/VBD the/DT wife/NN of/IN president/NN Lincoln/NNP</string> <query> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> @@ -1985,7 +1985,7 @@ </answers> </question> <question id="9"> -<string>Who/WP developed/VBD the/DT video/NN game/NN World/NN of/IN Warcraft/NNP</string> +<string>Who/WP developed/VBD the/DT video/NN game/NN World/NNP of/NNP Warcraft/NNP</string> <query> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> @@ -25473,7 +25473,7 @@ </answers> </question> <question id="17"> -<string>In/IN which/WDT programming/NN language/NN is/VBZ GIMP/RB written/VBN</string> +<string>In/IN which/WDT programming/NN language/NN is/VBZ GIMP/NNP written/VBN</string> <query> PREFIX prop: <http://dbpedia.org/property/> PREFIX res: <http://dbpedia.org/resource/> Modified: trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex =================================================================== --- trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex 2011-10-31 09:33:13 UTC (rev 3343) +++ trunk/components-ext/src/main/resources/tbsl/lexicon/english.lex 2011-10-31 14:14:31 UTC (rev 3344) @@ -86,7 +86,7 @@ the least || (DET DET:'the' DET:'least') || <y, l1, e, [ l1:[ | l2:[ y | ] THELEAST y l3:[|] ] ], [], [],[]> // CHEAT! - highest || (NP ADJ:'highest' NP*) || <x, l1, e, [ l1:[ | maximum(a,x,x) ] ], [], [],[]> ;; <x, l1, e, [ l1:[ | SLOT_high(x), maximum(a,x,x) ] ],[],[],[ SLOT_high/PROPERTY/height^elevation ]> + highest || (NP ADJ:'highest' NP*) || <x, l1, e, [ l1:[ | maximum(a,x,x) ] ], [], [],[]> ;; <x, l1, e, [ l1:[ j | SLOT_high(x,j), maximum(a,j,j) ] ],[],[],[ SLOT_high/PROPERTY/height^elevation ]> // COUNT more than || (DP DET:'more' DET:'than' NUM[num] NP[np]) || <y,l1,<<e,t>,t>,[ l1:[ y,c | count(y,c), greater(c,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],[]> @@ -158,7 +158,7 @@ there || (DP (NP EX:'there')) || <x,l1,<<e,t>,t>,[l1:[|]],[],[],[]> -// ORDINAL NUMBERS (1-10) +// NUMBERS (1-10) // --------------------- one || (NP NUM:'one' NP*) || <x,l1,<e,t>,[l1:[x|count(x,1)]],[],[],[]> @@ -181,4 +181,4 @@ 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)]],[],[],[]> + 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. |