def initialize(debug, cnt, prefix, stem, suffix)
@debug = debug;
@cnt = cnt;
@prefix = prefix;
@stem = stem;
@suffix = suffix;
@prefixesPOS = prefix.pos
@stemsPOS = stem.pos
@suffixesPOS = suffix.pos
@prefixesGlosses = prefix.glosses
@stemsGlosses = stem.glosses
@suffixesGlosses = suffix.glosses
if (@stemsPOS.length != @stemsGlosses.length)
if (@debug)
puts "\"" + get_lemma() + "\" : stem's sizes for POS (" + @stemsPOS.length.to_s + ") and GLOSS ("+ @stemsGlosses.length.to_s + ") do not match"
end
end
while(@stemsPOS.length>0)
stemPOS = @stemsPOS.slice(0)
if(stemPOS)
stemPOS.force_encoding "UTF-8"
end
if (@stemsGlosses.length>0)
stemGloss = @stemsGlosses.slice(0)
else
stemGloss = nil
end
if(stemGloss)
stemGloss.force_encoding "UTF-8"
end
if (stemPOS.end_with?("CONJ") or
stemPOS.end_with?("EMPHATIC_PARTICLE") or
stemPOS.end_with?("FUNC_WORD") or
stemPOS.end_with?("FUT_PART") or
stemPOS.end_with?("INTERJ") or
stemPOS.end_with?("INTERROG_PART") or
stemPOS.end_with?("IV1S") or
stemPOS.end_with?("IV2MS") or
stemPOS.end_with?("IV2FS") or
stemPOS.end_with?("IV3MS") or
stemPOS.end_with?("IV3FS") or
stemPOS.end_with?("IV2D") or
stemPOS.end_with?("IV2FD") or
stemPOS.end_with?("IV3MD") or
stemPOS.end_with?("IV3FD") or
stemPOS.end_with?("IV1P") or
stemPOS.end_with?("IV2MP") or
stemPOS.end_with?("IV2FP") or
stemPOS.end_with?("IV3MP") or
stemPOS.end_with?("IV3FP") or
stemPOS.end_with?("NEG_PART") or
stemPOS.end_with?("PREP") or
stemPOS.end_with?("RESULT_CLAUSE_PARTICLE") )
@stemsPOS.slice!(0)
@prefixesPOS.push(stemPOS)
if (stemGloss)
@stemsGlosses.slice!(0)
@prefixesGlosses.push(stemGloss)
end
else
break
end
end
while(@stemsPOS.length>0)
stemPOS = @stemsPOS.slice(@stemsPOS.length-1)
if(stemPOS)
stemPOS.force_encoding "UTF-8"
end
if (@stemsGlosses.length>0)
stemGloss = @stemsGlosses.slice(@stemsGlosses.length-1)
else
stemGloss = nil
end
if(stemGloss)
stemGloss.force_encoding "UTF-8"
end
if (stemPOS.end_with?("CASE_INDEF_NOM") or
stemPOS.end_with?("CASE_INDEF_ACC") or
stemPOS.end_with?("CASE_INDEF_ACCGEN") or
stemPOS.end_with?("CASE_INDEF_GEN") or
stemPOS.end_with?("CASE_DEF_NOM") or
stemPOS.end_with?("CASE_DEF_ACC") or
stemPOS.end_with?("CASE_DEF_ACCGEN") or
stemPOS.end_with?("CASE_DEF_GEN") or
stemPOS.end_with?("NSUFF_MASC_SG_ACC_INDEF") or
stemPOS.end_with?("NSUFF_FEM_SG") or
stemPOS.end_with?("NSUFF_MASC_DU_NOM") or
stemPOS.end_with?("NSUFF_MASC_DU_NOM_POSS") or
stemPOS.end_with?("NSUFF_MASC_DU_ACCGEN") or
stemPOS.end_with?("NSUFF_MASC_DU_ACCGEN_POSS") or
stemPOS.end_with?("NSUFF_FEM_DU_NOM") or
stemPOS.end_with?("NSUFF_FEM_DU_NOM_POSS") or
stemPOS.end_with?("NSUFF_FEM_DU_ACCGEN") or
stemPOS.end_with?("NSUFF_FEM_DU_ACCGEN_POSS") or
stemPOS.end_with?("NSUFF_MASC_PL_NOM") or
stemPOS.end_with?("NSUFF_MASC_PL_NOM_POSS") or
stemPOS.end_with?("NSUFF_MASC_PL_ACCGEN") or
stemPOS.end_with?("NSUFF_MASC_PL_ACCGEN_POSS") or
stemPOS.end_with?("NSUFF_FEM_PL") or
stemPOS.end_with?("POSS_PRON_1S") or
stemPOS.end_with?("POSS_PRON_2MS") or
stemPOS.end_with?("POSS_PRON_2FS") or
stemPOS.end_with?("POSS_PRON_3MS") or
stemPOS.end_with?("POSS_PRON_3FS") or
stemPOS.end_with?("POSS_PRON_2D") or
stemPOS.end_with?("POSS_PRON_3D") or
stemPOS.end_with?("POSS_PRON_1P") or
stemPOS.end_with?("POSS_PRON_2MP") or
stemPOS.end_with?("POSS_PRON_2FP") or
stemPOS.end_with?("POSS_PRON_3MP") or
stemPOS.end_with?("POSS_PRON_3FP") or
stemPOS.end_with?("IVSUFF_DO:1S") or
stemPOS.end_with?("IVSUFF_DO:2MS") or
stemPOS.end_with?("IVSUFF_DO:2FS") or
stemPOS.end_with?("IVSUFF_DO:3MS") or
stemPOS.end_with?("IVSUFF_DO:3FS") or
stemPOS.end_with?("IVSUFF_DO:2D") or
stemPOS.end_with?("IVSUFF_DO:3D") or
stemPOS.end_with?("IVSUFF_DO:1P") or
stemPOS.end_with?("IVSUFF_DO:2MP") or
stemPOS.end_with?("IVSUFF_DO:2FP") or
stemPOS.end_with?("IVSUFF_DO:3MP") or
stemPOS.end_with?("IVSUFF_DO:3FP") or
stemPOS.end_with?("IVSUFF_MOOD:I") or
stemPOS.end_with?("IVSUFF_SUBJ:2FS_MOOD:I") or
stemPOS.end_with?("IVSUFF_SUBJ:D_MOOD:I") or
stemPOS.end_with?("IVSUFF_SUBJ:3D_MOOD:I") or
stemPOS.end_with?("IVSUFF_SUBJ:MP_MOOD:I") or
stemPOS.end_with?("IVSUFF_MOOD:S") or
stemPOS.end_with?("IVSUFF_SUBJ:2FS_MOOD:SJ") or
stemPOS.end_with?("IVSUFF_SUBJ:D_MOOD:SJ") or
stemPOS.end_with?("IVSUFF_SUBJ:MP_MOOD:SJ") or
stemPOS.end_with?("IVSUFF_SUBJ:3MP_MOOD:SJ") or
stemPOS.end_with?("IVSUFF_SUBJ:FP") or
stemPOS.end_with?("PVSUFF_DO:1S") or
stemPOS.end_with?("PVSUFF_DO:2MS") or
stemPOS.end_with?("PVSUFF_DO:2FS") or
stemPOS.end_with?("PVSUFF_DO:3MS") or
stemPOS.end_with?("PVSUFF_DO:3FS") or
stemPOS.end_with?("PVSUFF_DO:2D") or
stemPOS.end_with?("PVSUFF_DO:3D") or
stemPOS.end_with?("PVSUFF_DO:1P") or
stemPOS.end_with?("PVSUFF_DO:2MP") or
stemPOS.end_with?("PVSUFF_DO:2FP") or
stemPOS.end_with?("PVSUFF_DO:3MP") or
stemPOS.end_with?("PVSUFF_DO:3FP") or
stemPOS.end_with?("PVSUFF_SUBJ:1S") or
stemPOS.end_with?("PVSUFF_SUBJ:2MS") or
stemPOS.end_with?("PVSUFF_SUBJ:2FS") or
stemPOS.end_with?("PVSUFF_SUBJ:3MS") or
stemPOS.end_with?("PVSUFF_SUBJ:3FS") or
stemPOS.end_with?("PVSUFF_SUBJ:2MD") or
stemPOS.end_with?("PVSUFF_SUBJ:2FD") or
stemPOS.end_with?("PVSUFF_SUBJ:3MD") or
stemPOS.end_with?("PVSUFF_SUBJ:3FD") or
stemPOS.end_with?("PVSUFF_SUBJ:1P") or
stemPOS.end_with?("PVSUFF_SUBJ:2MP") or
stemPOS.end_with?("PVSUFF_SUBJ:2FP") or
stemPOS.end_with?("PVSUFF_SUBJ:3MP") or
stemPOS.end_with?("PVSUFF_SUBJ:3FP") or
stemPOS.end_with?("CVSUFF_DO:1S") or
stemPOS.end_with?("CVSUFF_DO:3MS") or
stemPOS.end_with?("CVSUFF_DO:3FS") or
stemPOS.end_with?("CVSUFF_DO:3D") or
stemPOS.end_with?("CVSUFF_DO:1P") or
stemPOS.end_with?("CVSUFF_DO:3MP") or
stemPOS.end_with?("CVSUFF_DO:3FP") or
stemPOS.end_with?("CVSUFF_SUBJ:2MS") or
stemPOS.end_with?("CVSUFF_SUBJ:2FS") or
stemPOS.end_with?("CVSUFF_SUBJ:2MP") )
@stemsPOS.slice!(@stemsPOS.length-1)
@suffixesPOS.insert(0,stemPOS)
if (stemGloss)
@stemsGlosses.slice!(@stemsGlosses.length-1)
@suffixesGlosses.insert(0,stemGloss)
end
else
break
end
end
if (@stemsPOS.length > 1)
pos0 = @stemsPOS[0]
pos1 = @stemsPOS[1]
if(pos1=="bayon" or pos1=="bayona" or pos1=="bayoni")
if (@debug)
puts "Merging \""+pos1+"\" into first part of stem \"" + pos0 + "\""
end
array = pos0.split("/");
sb = array[0] + pos1+"/"
i=1
while( i < array.length)
sb+=array[i]
end
@stemsPOS.slice!(0)
@stemsPOS[0] = sb
end
end
if (@stemsPOS.length > 1 and @debug)
puts"More than one stem for " + @stemsPOS.to_string()
end
end