public void GetFeatureVector(DependencyInstance inst,
FeatureVector[,,] fvs,
double[,,] probs,
FeatureVector[,,,] ntFvs,
double[,,,] ntProbs, Parameters parameters)
{
string[] toks = inst.Sentence;
string[] pos = inst.POS;
string[] labs = inst.Labs;
var posA = new string[pos.Length];
for (int i = 0; i < pos.Length; i++)
{
posA[i] = pos[i].SubstringWithIndex(0, 1);
}
// Get production crap.
for (int w1 = 0; w1 < toks.Length; w1++)
{
for (int w2 = w1 + 1; w2 < toks.Length; w2++)
{
for (int ph = 0; ph < 2; ph++)
{
bool attR = ph == 0 ? true : false;
int childInt = attR ? w2 : w1;
int parInt = attR ? w1 : w2;
FeatureVector prodFV = CreateFeatureVector(toks, pos, posA, w1, w2, attR,
new FeatureVector());
double prodProb = parameters.GetScore(prodFV);
fvs[w1, w2, ph] = prodFV;
probs[w1, w2, ph] = prodProb;
}
}
}
if (Labeled)
{
for (int w1 = 0; w1 < toks.Length; w1++)
{
for (int t = 0; t < Types.Length; t++)
{
string type = Types[t];
for (int ph = 0; ph < 2; ph++)
{
bool attR = ph == 0 ? true : false;
for (int ch = 0; ch < 2; ch++)
{
bool child = ch == 0 ? true : false;
FeatureVector prodFV = CreateFeatureVector(toks, pos, posA, w1,
type, attR, child,
new FeatureVector());
double ntProb = parameters.GetScore(prodFV);
ntFvs[w1, t, ph, ch] = prodFV;
ntProbs[w1, t, ph, ch] = ntProb;
}
}
}
}
}
}