Esempio n. 1
0
int16_t short_recog_cell (cell *c)
{
 // was && но если нет c->evn - что распознавать?
 if( (c->cg_flag & c_cg_comp) ||
     (!c->env) )
   return 0;

 comp_from_kit(c);
 {
int16_t n,i;
uchar res[20];
CCOM_comp cc;
//запись в структуру CCOM_comp данных для EVNRecog_lp
cc.h = c->env->h;
cc.w = c->env->w;
cc.rw = c->env->rw;
cc.nl = c->env->nl;
cc.begs = c->env->begs;
cc.ends = c->env->ends;
cc.scale = c->env->scale;

// n = (int16_t)EVNRecog_lp(c->env,lpool,lpool_lth,&res[0]);
 n = (int16_t)EVNRecog_lp(&cc,lpool,lpool_lth,&res[0]);

//восстановление из структуры CCOM_comp результатов EVNRecog_lp
 c->env->type = cc.type;
 c->env->cs = cc.cs;
 c->env->pidx = cc.pidx;
 c->env->reasno = cc.reasno;

 if( n )
     {
     for(i=0;i<n;i++)
	    {
	    c->vers[i].let=res[i];
	    c->vers[i].prob=254;
	    }
       c->vers[n].let=0;
       c->flg = c_f_let;
       c->recsource |= c_rs_ev;
       c->history   |= c_rs_ev;
     }
  else
    {
    c->vers[0].let=176;
    c->vers[1].let=0;
    c->flg = c_f_bad;
    }
  c->nvers=n;
}

 //recog_letter();
 v2_pidx_crit(c);
 sort_vers(c);
 //c->reasno = wcomp.reasno;
 //return vers_to_cell(c);
 return c->nvers;
}
Esempio n. 2
0
int16_t recop_cell(cell *c)
{
 c->reasno=0; criteria(c);  if (db_pidx_crit) v2_pidx_crit(c);
 if ( c->nvers == 0 )  {
    c->recsource = 0;
    c->history   = 0;
    }
 return c->nvers;
}
Esempio n. 3
0
int16_t reco2_cell(cell *c) {
	c->reasno = 0;
	second_recog(c);
	if ((db_pidx_crit) && c->nvers) {
		v2_pidx_crit(c);
		if (db_status && (db_trace_flag & 2))
			est_snap(db_pass, c, "second rec proport");
	}
	if (c->nvers == 0) {
		c->recsource = 0;
		c->history = 0;
	}
	return c->nvers;
}
Esempio n. 4
0
//
// rotate word cells
//
int16_t erection_incline_word(cell *b, cell *e, int16_t base_3, int16_t n_call)
{
cell  *c, *tmp, *cnext                  ;
int32_t  inc,    i                         ;
int16_t   shave=(erection_enable==2)        ;
version save_versions[VERS_IN_CELL]     ;
int16_t   save_nvers                        ;

if( (inc=get_incline_of_word(b,e))==0 )
  return 0;
if( 1&&!test_incline_of_word(b,e,inc) )
    return 0;

for(i=0, c=b; c!=e; c=c->next, i++)
  {
  tmp = c->prev; // left cell
  cnext=c->next; // right cell
  if( local_pass )
    {
    if( c->pos_inc&erect_rot )
        continue;
    if( c->stick_inc!=NO_INCLINE && (((long)c->stick_inc*c->h)/204l)>16 &&
      ( (c->flg==c_f_bad) && c->stick_inc<max_incline ||
      c->nvers>0 && (memchr(incline_chars,c->vers[0].let,sizeof(incline_chars)) &&
		!is_russian_baltic_conflict(c->vers[0].let)&&// 17.07.2001 E.P.
		!is_russian_turkish_conflict(c->vers[0].let) // 21.05.2002 E.P.
	  ||
      erect_solid_stick(c))) )
        c->save_stick_inc = c->stick_inc;
    else
        c->save_stick_inc = (int16_t)inc;
    c->pos_inc = erect_rest;
    continue;
    }
  // rotate cell images
  if( c->stick_inc!=NO_INCLINE && (((long)c->stick_inc*c->h)/204l)>16 &&
      ( (c->flg==c_f_bad) && c->stick_inc<max_incline ||
      c->nvers>0 && (memchr(incline_chars,c->vers[0].let,sizeof(incline_chars)) &&
		!is_russian_baltic_conflict(c->vers[0].let)&&// 17.07.2001 E.P.
		!is_russian_turkish_conflict(c->vers[0].let) // 21.05.2002 E.P.
	  ||
      erect_solid_stick(c))) )
    c=erect_cell_value (c, c->stick_inc, shave , TRUE);
  else
    c=erect_cell_value (c, (int16_t)inc, shave , TRUE);

  for(tmp = tmp->next;tmp!=cnext;tmp=tmp->next)
    {    // shift cell boxes
    erect_rotate_bl(tmp,base_3,inc,-1);//(int16_t)(line_scale?(base_3>>line_scale):base_3),inc,-1);
    v2_pidx_crit(tmp);
    if( (save_nvers = c->nvers)>0 )
        memcpy(save_versions,c->vers,VERS_IN_CELL*sizeof(version));
    // recognizing corrected images
    if( (tmp->flg&(c_f_bad|c_f_let)) && !local_pass)
      {
      if(n_call==0  )
        {
        if( tmp->nvers>0 &&
			memchr(disable_rerecog,tmp->vers[0].let,sizeof(disable_rerecog) ) &&
				!is_russian_baltic_conflict(tmp->vers[0].let)&&// 17.07.2001 E.P.
				!is_russian_turkish_conflict(tmp->vers[0].let)   // 21.05.2002 E.P.
			||
            tmp->nvers<1 )
          {
          short_recog_cell( tmp );
          levcut(tmp,1);
          add_versions(tmp, save_versions, save_nvers);
          } // end of spec letters for 1 pass
        }
      else
        {
        s_glue GL={0};

        GL.celist[0]   = tmp;
        GL.maxlist[0]  = tmp;
        GL.complist[0] = tmp->env;
        GL.maxlist[1]  = GL.celist[1]=NULL;
        GL.complist[1] = NULL;
        GL.ncell       = 1;
        GL.row         = tmp->row;
        GL.col         = tmp->col;
        GL.width       = tmp->w;
        GL.height      = tmp->h;

        if(crecell(tmp,&GL,3)>=0)
          dmBOX(tmp,&GL);
        } // end of spec letters for 2 pass
      } // end of if letter
    } // end of cykl tmp
  }

return (int16_t)inc;
}
Esempio n. 5
0
////////////////////
/////////////////
// Tools.c
int16_t short_recog_cell(CSTR_rast c, int line_scale) {
	int16_t n, i;
	uchar res[20];

	CSTR_rast_attr attr;
	CCOM_comp *comp;
	// ExtComponent ec;
	int16_t *pint16;
	uchar * lpool;
	UniVersions vers = { 0 };

	CSTR_GetAttr(c, &attr);
	comp = CSTR_GetComp(c);

	// исходно была ошибка Tools.c -
	// если c->env == 0 в lpool лежало неизвестно что!

	// if( (c->cg_flag & CSTR_cg_comp) &&  !c->env )
	//   return 0;
	if ((attr.cg_flag & CSTR_cg_comp) || !comp)
		return 0;

	// comp_from_kit(c);

	// CCOM_comp -> to ExtComponent
	/*  memset(&ec,0,sizeof(ExtComponent));
	 if( !Ccomp2ExtComponenet(comp,&ec,&attr,line_scale) )
	 return 0;
	 */
	// n = (int16_t)EVNRecog_lp(c->env,lpool,lpool_lth,&res[0]);

	pint16 = (int16_t *) comp->linerep;
	// *pint16 == comp->size_linerep ?????
	lpool = comp->linerep + 2;
	//  n = (int16_t)EVNRecog_lp(&ec,lpool,*pint16,&res[0]);
	n = (int16_t) EVNRecog_lp(comp, lpool, *pint16, &res[0]);

	vers.lnAltMax = REC_MAX_VERS;
	if (n) {
		for (i = 0; i < n; i++) {
			//c->vers[i].let=res[i];
			//c->vers[i].prob=254;
			vers.Alt[i].Liga = res[i];
			vers.Alt[i].Prob = 254;
			vers.Alt[i].Method = REC_METHOD_EVN;
		}
		attr.flg = CSTR_f_let;
		attr.recsource |= CSTR_rs_ev;
		attr.RecogHistory |= CSTR_rs_ev;
	} else {
		attr.flg = CSTR_f_bad;
	}

	vers.lnAltCnt = n;
	CSTR_StoreCollectionUni(c, &vers);
	CSTR_SetAttr(c, &attr);

	v2_pidx_crit(c);
	sort_vers(c);

	CSTR_GetCollectionUni(c, &vers);

	return (int16_t) vers.lnAltCnt;
}