Example #1
0
void BaseDecoder::LoadRef(DecodingSentence * sentence)
{
    ClearRefInfo();

    if(sentence->refs == NULL)
        return;

    int     beg = -1, end = -1;
    char    transTmp[1024 * 4], tgtTmp[1024 * 4];
    bool    successful = true;

    tgtSent = StringUtil::Copy(sentence->refs->refs[0].str);

    StringUtil::RemoveRightSpaces(tgtSent);
    sprintf(tgtTmp, "<s> %s </s>", tgtSent);

    tgtLength = (int)StringUtil::Split( tgtTmp, " ", tgtWords );

    tgtWordLength = new int[tgtLength];
    for(int i = 0; i < tgtLength; i++){
        tgtWordLength[i] = (int)strlen(tgtWords[i]);
    }

    int wCount = 0;
    model->GetWId(tgtTmp, tgtWid, wCount, NULL);

    if(wCount != tgtLength){
        fprintf(stderr, "wCount != tgtLength\n");
        exit(0);
    }
}
Example #2
0
void ClearSymUnion( symbol * sym )
/***************************************/
/* clear the symbol unions of any possible allocated data */
{
    sym->info &= ~SYM_LINK_GEN;
    if( IS_SYM_VF_REF(sym) ) {
        ClearRefInfo( sym );
    } else {
        WipeSym( sym );
    }
}