public ArrayList<POS> classify(String fs, ParametersFloat params, int w1, InstancesTagger is, int n, short[] pos, Long2IntInterface li) { F2SF f = new F2SF(params.parameters); long vs[] = new long[_MAX]; int lemmas[]; if (options.noLemmas) lemmas = new int[is.length(n)]; else lemmas = is.plemmas[n]; addFeatures(is,n,fs,w1,pos,is.forms[n], lemmas, vs); ArrayList<POS> best = new ArrayList<POS>(types.length); for(int t=0;t<types.length;t++) { int p = t<<s_type; f.clear(); f.add(vs,li, p); POS px = new POS(t, f.score); best.add(px); } Collections.sort(best); return best; }
public int fillFeatureVectorsOne(String fs, ParametersFloat params, int w1, InstancesTagger is, int n, short[] pos,Long2IntInterface li, float[] score) { float best = -1000; int bestType = -1; F2SF f = new F2SF(params.parameters); long vs[] = new long[_MAX]; int lemmas[]; if (options.noLemmas) lemmas = new int[is.length(n)]; else lemmas = is.plemmas[n]; addFeatures(is,n,fs,w1,pos,is.forms[n], lemmas, vs); //for(int t = 0; t < types.length; t++) { for(int t=0;t<types.length;t++) { int p = t<<s_type; f.clear(); for(int k=0;vs[k]!=Integer.MIN_VALUE;k++) if(vs[k]>0) f.add(li.l2i(vs[k]+p)); if (f.score > best) { bestType=t; score[w1]= best =f.score; } } return bestType; }
else lemmas = is.plemmas[n]; this.pipe.addFeatures(is,n,wds[is.forms[n][w]],w,is.gpos[n],is.forms[n], lemmas, vs);