From: <chr...@us...> - 2012-06-14 17:15:02
|
Revision: 3742 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3742&view=rev Author: christinaunger Date: 2012-06-14 17:14:55 +0000 (Thu, 14 Jun 2012) Log Message: ----------- [tbsl] some more hacks - ?\195?\164h... domain adaptations Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_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/templator/SlotBuilder.java 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-06-14 15:30:01 UTC (rev 3741) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/converter/DRS2SPARQL_Converter.java 2012-06-14 17:14:55 UTC (rev 3742) @@ -98,7 +98,7 @@ return null; } replaceRegextoken(drs); - // System.out.println("--- DRS (after) : " + drs); // DEBUG +// System.out.println("--- DRS (after) : " + drs); // DEBUG for (DiscourseReferent referent : drs.collectDRs()) { if (referent.isMarked()) { @@ -325,7 +325,8 @@ } } if (regex != null) { - query.addFilter(new SPARQL_Filter(new SPARQL_Pair( + query.addFilter(new SPARQL_Filter( + new SPARQL_Pair( new SPARQL_Term(simple.getArguments().get(0).getValue(),false), new SPARQL_Term("'"+regex+"'",false), SPARQL_PairType.REGEX))); @@ -458,7 +459,7 @@ String var; String newvar; String regex = ""; - String[] forbidden = {"regextoken","regex","count","minimum","maximum","greater","less","greaterorequal","lessorequal","equal","sum"}; + String[] forbidden = {"regextoken","regex","count","minimum","maximum","greater","less","greaterorequal","lessorequal","equal","sum","location","description"}; Set<Simple_DRS_Condition> used = new HashSet<Simple_DRS_Condition>(); for (Simple_DRS_Condition c : cs) { 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-14 15:30:01 UTC (rev 3741) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/ltag/parser/Preprocessor.java 2012-06-14 17:14:55 UTC (rev 3742) @@ -220,8 +220,8 @@ } m = adjnounPattern.matcher(condensedstring); while (m.find()) { - if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/NN"); - condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"_"+m.group(3)+"/NN"); + if (VERBOSE) logger.trace("Replacing " + m.group(1) + " by " + m.group(2)+"_"+m.group(3)+"/JJNN"); + condensedstring = condensedstring.replaceFirst(m.group(1),m.group(2)+"_"+m.group(3)+"/JJNN"); } m = adjnprepPattern.matcher(condensedstring); while (m.find()) { 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-14 15:30:01 UTC (rev 3741) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/templator/SlotBuilder.java 2012-06-14 17:14:55 UTC (rev 3742) @@ -68,7 +68,7 @@ // words.addAll(wordnet.getBestSynonyms(token)); } - String tokenfluent = token.replaceAll(" ","").replaceAll("_",""); + String tokenfluent = token.replaceAll(" ","_");//.replaceAll("_",""); String slotX = "x/" + type + "/"; String slotP = "SLOT_" + tokenfluent + "/" + type + "/"; String slotC = "SLOT_" + tokenfluent + "/CLASS/"; @@ -165,23 +165,30 @@ else if(pos.equals("JJNN") && token.contains("_")) { String[] tokens = token.split("_"); String nntoken = tokens[tokens.length-1]; + String jjtoken = token.replace("SLOT_","").replace(nntoken,"").replace("_"," ").trim(); String slotfluent = "SLOT_" + tokenfluent + "/CLASS/" + token; String slotnn = "SLOT_" + nntoken + "/CLASS/" + nntoken; - String semantics = "<x,l1,<e,t>,[ l1:[ | SLOT_" + tokenfluent + "(x) ] ],[],[],[" + slotfluent + "]> " + - ";; <x,l1,<e,t>,[ l1:[ | SLOT_" + nntoken + "(x)"; - String slots = slotnn; - for (int i=0; i<(tokens.length-1); i++) { - semantics += ", SLOT_" + tokens[i] + "(x)"; - slots += ",SLOT_" + tokens[i] + "/CLASS/" + tokens[i]; - } - semantics += "] ],[],[],[" + slots + "]>"; +// String semantics = "<x,l1,<e,t>,[ l1:[ | SLOT_" + tokenfluent + "(x) ] ],[],[],[" + slotfluent + "]> " + +// ";; <x,l1,<e,t>,[ l1:[ | SLOT_" + nntoken + "(x)"; +// String slots = slotnn; +// for (int i=0; i<(tokens.length-1); i++) { +// semantics += ", SLOT_" + tokens[i] + "(x)"; +// slots += ",SLOT_" + tokens[i] + "/CLASS/" + tokens[i]; +// } +// semantics += "] ],[],[],[" + slots + "]>"; String[] npEntry = {token, "(NP " + treetoken + " )", - semantics }; -// "<x,l1,<e,t>,[ l1:[ | SLOT_" + tokenfluent + "(x) ] ],[],[],[" + slotfluent + "]> ;; " + -// "<x,l1,<e,t>,[ l1:[ | SLOT_" + nntoken + "(x), SLOT_" + jjtoken + "(x) ] ],[],[],[" + slotnn + "," + slotjj + "]>"}; + // semantics }; + "<x,l1,<e,t>,[ l1:[ | SLOT_" + tokenfluent + "(x) ] ],[],[],[" + slotfluent + "]> ;; " + + "<x,l1,<e,t>,[ l1:[ | SLOT_" + nntoken + "(x), SLOT_description(x,y), regex(y,'"+ jjtoken +"')] ],[],[],[" + slotnn + ",SLOT_description/DATATYPEPROPERTY/description ]>"}; + String[] dpEntry = {token, + "(DP (NP " + treetoken + " ))", + // semantics }; + "<x,l1,<<e,t>,t>,[ l1:[ x | SLOT_" + tokenfluent + "(x) ] ],[],[],[" + slotfluent + "]> ;; " + + "<x,l1,<<e,t>,t>,[ l1:[ x | SLOT_" + nntoken + "(x), SLOT_description(x,y), regex(y,'"+ jjtoken +"')] ],[],[],[" + slotnn + ",SLOT_description/DATATYPEPROPERTY/description ]>"}; result.add(npEntry); + result.add(dpEntry); } else if (pos.equals("NNSAME")) { String slot = "SLOT_" + token + "/" + type + "/" + token; 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-14 15:30:01 UTC (rev 3741) +++ trunk/components-ext/src/main/resources/tbsl/lexicon/english_oxford.lex 2012-06-14 17:14:55 UTC (rev 3742) @@ -6,8 +6,10 @@ since || (NP NP* (PP P:'since' DP[dp])) || <x,l1,<e,t>, [ l1:[ | SLOT_since(x,y) ] ], [ (l2,y,dp,<<e,t>,t>) ], [ l2=l1 ],[ SLOT_since/PROPERTY/since ]> 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' (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' (NP NUM[num] N:'pounds'))) || <x,l1,<e,t>, [ l1:[ | SLOT_price(x,y), less(y,z) ] ], [ (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' 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 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 ]> 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 ]> 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 ]> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |