Beispiel #1
0
bool CLemWord::AddNextHomonym(const char* sPlmLine)
{
    char buffer[CriticalGraphemLineLength*2];
    assert (strlen(sPlmLine) < CriticalGraphemLineLength*2);
    strcpy(buffer, sPlmLine);
    char* strPlmLine = buffer;

	assert (strPlmLine[0] == ' ');
	assert (strPlmLine[1] == ' ');
	strPlmLine += 2;

    assert ( GetHomonymsCount() );
	
	size_t iPlmLineLen = strlen(strPlmLine);
	rtrim(strPlmLine,&iPlmLineLen);

	size_t iFirstFieldLen = strcspn(strPlmLine," ");

	size_t iSomeUnusefulDigitsLen = strspn(strPlmLine + iFirstFieldLen," -1234567890");

	CHomonym* pHomonym = AddNewHomonym();

	strPlmLine += iFirstFieldLen + iSomeUnusefulDigitsLen;

	int MorphSectionOffset = ProcessGraphematicalDescriptors(strPlmLine);

	if (!pHomonym->ProcessLemmaAndGrammems(strPlmLine+MorphSectionOffset)) return false;

    {
        const CHomonym* pFirstHom = GetHomonym(0);
        pHomonym->m_bInOb = pFirstHom->m_bInOb;
        pHomonym->m_bOborot1 = pFirstHom->m_bOborot1;
        pHomonym->m_bOborot2 = pFirstHom->m_bOborot2;
        pHomonym->m_OborotNo = pFirstHom->m_OborotNo;
    }

	InitLevelSpecific(pHomonym);

	return true;

}
Beispiel #2
0
bool CLemWord::ProcessPlmLineForTheFirstHomonym(const char* sPlmLine, MorphLanguageEnum langua, int& OborotNo)
{
    char buffer[CriticalGraphemLineLength*2];
    assert (strlen(sPlmLine) < CriticalGraphemLineLength*2);
    strcpy(buffer, sPlmLine);
    char* strPlmLine = buffer;


    // откусываю признаки конца строки, если они по¤вились
    size_t iPlmLineLen = strlen(strPlmLine);
    rtrim(strPlmLine,&iPlmLineLen);

    size_t iFirstFieldLen = strcspn(strPlmLine," ");
    char WordBuffer[CriticalTokenLength+1];
    strncpy(WordBuffer, strPlmLine, iFirstFieldLen);
    WordBuffer[iFirstFieldLen] = '\0';
    SetWordStr(WordBuffer, langua);


    size_t iSomeUnusefulDigitsLen = strspn(strPlmLine + iFirstFieldLen," -1234567890");

    //  reading file position of an item from graline
    if (sscanf(strPlmLine + iFirstFieldLen, "%i %i", &m_GraphematicalUnitOffset, &m_TokenLengthInFile) != 2)
        return false;

    strPlmLine += iFirstFieldLen + iSomeUnusefulDigitsLen;

    int MorphSectionOffset = ProcessGraphematicalDescriptors(strPlmLine);

    if( m_bSpace )
        return true;

    CHomonym*  pHomonym  = AddNewHomonym();

    if (HasDes(OEXPR1))
        OborotNo = ParseOborotNo(m_UnparsedGraphemDescriptorsStr);

    if (OborotNo != -1)
    {
        pHomonym->m_OborotNo =  OborotNo;
        pHomonym->m_bInOb =  true;
        pHomonym->m_bOborot1 = HasDes(OEXPR1);
        pHomonym->m_bOborot2 = HasDes(OEXPR2);
    }
    if (HasDes(OEXPR2))
        OborotNo = -1;

    if( MorphSectionOffset == strlen(strPlmLine) )
        pHomonym->SetLemma(m_strWord);
    else
        if (!pHomonym->ProcessLemmaAndGrammems(strPlmLine+MorphSectionOffset))
            return false;

    InitLevelSpecific(pHomonym);

    if	(		(m_strWord == "\"")
        ||	(m_strWord == "'")
        )
        DelDes(OPun);




    if (pHomonym->m_LemSign != '+')
        m_bPredicted = true;

    return true;
}