private int AddLemma(string strTerm, string strProp)
{
int curpos = 0;
int last_depos = DM_DENTRY_FIRST;
int cur_depos = DM_COMMON_NULL;
int value = 0;
int lmpos = DM_COMMON_NULL;
//Check if lemma has already in the dictionary
if ((lmpos = SeekLemma(strTerm)) == DM_LEMMA_NULL)
{
//new lemma, insert it into the dictionary
while (curpos < strTerm.Length)
{
value = strTerm[curpos];
curpos++;
if (InsertDentry(last_depos, value, ref cur_depos) < 0)
{
return -1;
}
last_depos = cur_depos;
}
dentry[cur_depos].lemma_pos = lmlist.Count;
Lemma lm = new Lemma();
lm.strProp = strProp;
lm.len = (uint)strTerm.Length;
lmlist.Add(lm);
return 1;
}
return 0;
}