Update of /cvsroot/monetdb/pathfinder/modules/pftijah
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27498/modules/pftijah

Modified Files:
      Tag: GDK-2
        nexi.c nexi.h nexi_generate_mil.c pftijah.mx 
Log Message:
propagated changes of Tuesday Aug 14 2007 - Wednesday Aug 15 2007
from the development trunk to the GDK-2 branch



Index: nexi_generate_mil.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/nexi_generate_mil.c,v
retrieving revision 1.35
retrieving revision 1.35.2.1
diff -u -d -r1.35 -r1.35.2.1
--- nexi_generate_mil.c 15 Jun 2007 14:41:34 -0000      1.35
+++ nexi_generate_mil.c 15 Aug 2007 22:23:36 -0000      1.35.2.1
@@ -625,10 +625,12 @@
       case P_PRIOR:
 
         com_nr_left = p_com->left->number;
-        
-        MILPRINTF(MILOUT, "R%d := R%d.prior_ls(%d,qenv);\n", com_num, 
com_nr_left, txt_retr_model->size_type);
-        
-        break;   
+        if (txt_retr_model->prior_type == LOG_LENGTH_PRIOR) {
+          MILPRINTF(MILOUT, "R%d := R%d.prior_logls(%d,qenv);\n", com_num, 
com_nr_left, txt_retr_model->size_type);
+        } else {
+          MILPRINTF(MILOUT, "R%d := R%d.prior_ls(%d,qenv);\n", com_num, 
com_nr_left, txt_retr_model->size_type);
+        }
+        break;
 
       case MUST_CONTAIN_T:
 
@@ -1058,6 +1060,9 @@
       MILPRINTF(MILOUT, "R%d := collect;\n",com_num);
       MILPRINTF(MILOUT, "collect := nil;\n");
     }
+   if(txt_retr_model->rmoverlap){
+    MILPRINTF(MILOUT, "R%d := rm_overlap(R%d%s);\n", com_num, 
com_num,parserCtx->flastPfx);
+    }
     MILPRINTF(MILOUT, "R%d := R%d.tsort_rev();\n", com_num, com_num);
 #if 0
     MILPRINTF(MILOUT, "if ( retNum >= 0 ) { R%d := R%d.slice(0, retNum - 1); 
}\n", com_num, com_num);

Index: nexi.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/nexi.h,v
retrieving revision 1.17
retrieving revision 1.17.4.1
diff -u -d -r1.17 -r1.17.4.1
--- nexi.h      4 Apr 2007 13:52:05 -0000       1.17
+++ nexi.h      15 Aug 2007 22:23:36 -0000      1.17.4.1
@@ -120,6 +120,7 @@
 #define NO_PRIOR 1
 #define LENGTH_PRIOR 2
 #define LOG_NORMAL_PRIOR 3
+#define LOG_LENGTH_PRIOR 4
 
 #define PREF_ELEM_SIZE 1000
 
@@ -269,6 +270,7 @@
   int param3;
   int prior_type;
   int prior_size;
+  bool rmoverlap;
   char context[TERM_LENGTH];
   float extra;
   struct_RMT *next;

Index: nexi.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/nexi.c,v
retrieving revision 1.69.2.1
retrieving revision 1.69.2.2
diff -u -d -r1.69.2.1 -r1.69.2.2
--- nexi.c      14 Aug 2007 14:03:48 -0000      1.69.2.1
+++ nexi.c      15 Aug 2007 22:23:35 -0000      1.69.2.2
@@ -217,6 +217,7 @@
     //txt_retr_model->prior_type  = LENGTH_PRIOR;    
     //txt_retr_model->prior_size  = 0;
     txt_retr_model->prior_size  = 2;
+    txt_retr_model->rmoverlap = FALSE;
     strcpy(txt_retr_model->context, "");
     txt_retr_model->extra       = 0.0;
     txt_retr_model->next        = NULL;
@@ -462,11 +463,19 @@
         } else if (strcmp(optName, "prior") == 0) {
             if (strcasecmp(optVal, "LENGTH_PRIOR") == 0) {
                 txt_retr_model->prior_type  = LENGTH_PRIOR;
+            } else if (strcasecmp(optVal, "LOG_LENGTH_PRIOR") == 0) {
+                txt_retr_model->prior_type  = LOG_LENGTH_PRIOR;
             } else {
                 txt_retr_model->prior_type  = NO_PRIOR;
             }
             
-        } else if (strcmp(optName, "returnNumber") == 0) {
+        }  else if (strcmp(optName, "rmoverlap") == 0) {
+           if (strcasecmp(optVal, "TRUE") == 0) {
+                txt_retr_model->rmoverlap = TRUE;
+           } else {
+               txt_retr_model->rmoverlap=FALSE;
+           }
+       } else if (strcmp(optName, "returnNumber") == 0) {
            // ignore, is handled by milprint_summer
         } else if (strcmp(optName, "term-proximity") == 0) {
                 qenv_prox_val = (char*)strdup(optVal);

Index: pftijah.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/pftijah.mx,v
retrieving revision 1.151.2.1
retrieving revision 1.151.2.2
diff -u -d -r1.151.2.1 -r1.151.2.2
--- pftijah.mx  14 Aug 2007 14:03:48 -0000      1.151.2.1
+++ pftijah.mx  15 Aug 2007 22:23:37 -0000      1.151.2.2
@@ -2690,6 +2690,62 @@
 #"Adds element prior based on element length to the region score.",
 #"TIJAH");
 
+PROC prior_logls(bat region, int size_type, BAT[oid,str] qenv) : bat :=
+{
+
+        var ctx_size := new(oid,dbl,ENTITY_NUM);
+        var res_reg := new(oid,dbl,ENTITY_NUM);
+
+        if (size_type = SIZE_ENTITY) {
+                ctx_size := size_entity(region,qenv);
+        # Make sure sizes are not zero
+        ctx_size := [+](ctx_size, dbl(0.5));
+        } else if (size_type = SIZE_TERM) {
+                ctx_size := size_term(region,qenv);
+        # Make sure sizes are not zero
+        ctx_size := [+](ctx_size, dbl(0.5));
+    }
+
+        res_reg := 
[+]([log](region.select(dbl(0),dbl(nil),false,false)),[log]([log](ctx_size)));
+        res_reg := 
[-](region.select(dbl(0)).project(min(res_reg)),dbl(1)).kunion(res_reg);
+
+        return res_reg;
+
+}
+#ADDHELP("prior_logls", "thijs", "Aug, 2007,
+#"Adds element prior based on log element length to the region score.",
+#"TIJAH");
+
+################################################################################
+# OVERLAP REMOVAL
+################################################################################
+
+PROC rm_overlap(bat ctx,str ind) : bat{
+
+ ctx := ctx.sort();
+ var size := bat("tj_"+qenv.find(QENV_FTINAME)+"_size"+ind);
+ var AD:=anc_desc(ctx,ctx,size);
+ var maxD := AD.join(ctx).sort().{max}();
+ var maxA := AD.reverse().sort().join(ctx).{max}();
+
+ AD:=nil;
+
+ # candidates are nodes that have no descendents or a higher score
+ # than all descendents
+ var candidates := ctx.kdiff(maxD).access(BAT_APPEND);
+ candidates.insert(ctx.[>](maxD).select(true).mirror().join(ctx));
+
+ # keep the candidates without ancestor and w score >= ancestor scores
+ var res := candidates.kdiff(maxA).access(BAT_APPEND);
+ res.insert(candidates.[>=](maxA).select(true).mirror().join(candidates));
+
+ candidates := nil;
+ maxA:=nil;maxD:=nil;
+ return res;
+}
+#ADDHELP("rm_overlap","thijs", "August, 2007",
+#"Removes overlapping elements from result list.",
+#"TIJAH");
 
 
 
################################################################################


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to