示例#1
0
  public final void addCoreFeatures(
      InstancesTagger is, int ic, int i, int oper, String form, long[] f) {

    for (int l = f.length - 1; l >= 0; l--) f[l] = 0;

    int formi = is.forms[ic][i];
    int wl = is.chars[ic][i][11]; // .forms[i].length();

    int position = 1 + (i < 3 ? i : 3);

    int c0 = is.chars[ic][i][0],
        c1 = is.chars[ic][i][1],
        c2 = is.chars[ic][i][2],
        c3 = is.chars[ic][i][3],
        c4 = is.chars[ic][i][4],
        c5 = is.chars[ic][i][5];
    int e0 = is.chars[ic][i][6],
        e1 = is.chars[ic][i][7],
        e2 = is.chars[ic][i][8],
        e3 = is.chars[ic][i][9],
        e4 = is.chars[ic][i][10];

    int len = is.length(ic);

    x.v1 = oper;
    x.v0 = _f0;
    x.v2 = formi;
    x.cz3();
    f[0] = x.getVal();
    f[1] = x.csa(3, position);
    x.v0 = _f1;
    x.v2 = formi;
    x.v3 = i + 1 >= len ? x.v3 = _ewrd : is.forms[ic][i + 1];
    x.cz4();
    f[2] = x.getVal();

    // contains upper case include again!!!

    short upper = 0;
    short number = 1;
    for (int k1 = 0; k1 < wl; k1++) {
      char c = form.charAt(k1);
      if (Character.isUpperCase(c)) {
        if (k1 == 0) upper = 1;
        else {
          // first char + another
          if (upper == 1) upper = 3;
          // another uppercase in the word
          else if (upper == 0) upper = 2;
        }
      }

      if (Character.isDigit(c) && k1 == 0) number = 2;
      else if (Character.isDigit(c) && number == 1) number = 3;
    }

    // contains a number
    z.v0 = _f21;
    z.v2 = number;
    z.cz3();
    f[3] = z.getVal();

    z.v0 = _f4;
    z.v1 = oper;
    z.v2 = c0;
    z.cz3();
    f[4] = z.getVal();
    z.v0 = _f5;
    z.v2 = e0;
    z.cz3();
    f[5] = z.getVal();

    z.v2 = c0;
    z.v3 = c1;
    z.v4 = c2;
    z.v5 = c3;
    z.v6 = c4;
    z.v0 = _f6;
    z.cz4();
    f[6] = z.getVal();
    z.v0 = _f7;
    z.cz5();
    f[7] = z.getVal();
    z.v0 = _f8;
    z.cz6();
    f[8] = z.getVal();
    z.v0 = _f9;
    z.cz7();
    f[9] = z.getVal();

    int c = 10;
    z.v2 = e0;
    z.v3 = e1;
    z.v4 = e2;
    z.v5 = e3;
    z.v6 = e4;
    z.v0 = _f10;
    z.cz4();
    f[c++] = z.getVal();
    f[c++] = z.csa(3, upper);
    z.v0 = _f11;
    z.cz5();
    f[c++] = z.getVal();
    f[c++] = z.csa(3, upper);
    z.v0 = _f12;
    z.cz6();
    f[c++] = z.getVal();
    f[c++] = z.csa(3, upper);
    z.v0 = _f13;
    z.cz7();
    f[c++] = z.getVal();
    f[c++] = z.csa(3, upper);

    if (len > i + 1) {

      z.v0 = _f14;
      z.v2 = is.chars[ic][i + 1][0];
      z.cz3();
      f[c++] = z.getVal();

      z.v0 = _f15;
      z.v2 = is.chars[ic][i + 1][5];
      z.cz3();
      f[c++] = z.getVal();

      if (is.chars[ic][i + 1][11] > 1) {
        z.v0 = _f16;
        z.v2 = is.chars[ic][i + 1][0];
        z.v3 = is.chars[ic][i + 1][2];
        z.cz4();
        f[c++] = z.getVal();

        z.v0 = _f17;
        z.v2 = is.chars[ic][i + 1][1];
        z.v3 = is.chars[ic][i + 1][6];
        z.cz4();
        f[c++] = z.getVal(); // fv.add(li.l2i(mf.calc4(b)));
      }

      x.v0 = _f18;
      x.v2 = is.forms[ic][i + 1];
      x.cz3();
      f[c++] = x.getVal();

      if (len > i + 2) {
        x.v0 = _f32;
        x.v2 = is.forms[ic][i + 2];
        x.v3 = is.forms[ic][i + 1];
        x.cz4();
        f[c++] = x.getVal();
        x.cz3();
        f[c++] = x.getVal(); // fv.add(li.l2i(mf.calc3(b)));
      }

      if (len > i + 3) {
        x.v0 = _f33;
        x.v2 = is.forms[ic][i + 3];
        x.v3 = is.forms[ic][i + 2];
        x.cz4();
        f[c++] = x.getVal(); // fv.add(li.l2i(mf.calc4(b)));
        x.cz3();
        f[27] = x.getVal(); // fv.add(li.l2i(mf.calc3(b)));
      }
    }

    // length

    z.v0 = _f19;
    z.v1 = oper;
    z.v2 = wl;
    z.cz3();
    f[c++] = z.getVal(); // fv.add(li.l2i(mf.calc3(dl1)));

    if (i < 1) return;

    x.v0 = _f27;
    x.v1 = oper;
    x.v2 = is.forms[ic][i - 1];
    x.cz3();
    f[c++] = x.getVal(); // fv.add(li.l2i(mf.calc3(b)));

    if (i < 2) return;

    // added this before it was 99.46
    x.v0 = _f28;
    x.v2 = is.forms[ic][i - 2];
    x.cz3();
    f[c++] = x.getVal(); // fv.add(li.l2i(mf.calc3(b)));

    // result 99.484
    if (i < 3) return;

    x.v0 = _f31;
    x.v1 = oper;
    x.v2 = is.forms[ic][i - 3];
    x.v3 = is.forms[ic][i - 2];
    x.cz4();
    f[c++] = x.getVal(); // fv.add(li.l2i(mf.calc4(b)));
  }
示例#2
0
  public void initValues() {

    z = new D4(li);

    x = new D4(li);
    x.a0 = s_type;

    s_pos = mf.getFeatureCounter().get(POS).intValue(); // mf.getFeatureBits(POS);
    s_word = mf.getFeatureCounter().get(WORD);
    s_type = mf.getFeatureCounter().get(TYPE).intValue(); // mf.getFeatureBits(TYPE);
    s_char = mf.getFeatureCounter().get(CHAR).intValue(); // mf.getFeatureBits(CHAR);
    s_oper = mf.getFeatureCounter().get(OPERATION).intValue(); // mf.getFeatureBits(OPERATION);

    types = new String[mf.getFeatureCounter().get(Pipe.OPERATION)];
    for (Entry<String, Integer> e : mf.getFeatureSet().get(Pipe.OPERATION).entrySet())
      types[e.getValue()] = e.getKey();

    // wds  = new String[mf.getFeatureCounter().get(Pipe.WORD)];
    // for(Entry<String,Integer> e : mf.getFeatureSet().get(Pipe.WORD).entrySet()) wds[e.getValue()]
    // = e.getKey();

    z.a0 = s_type;
    z.a1 = s_oper;
    z.a2 = s_char;
    z.a3 = s_char;
    z.a4 = s_char;
    z.a5 = s_char;
    z.a6 = s_char;
    z.a7 = s_char;
    x.a0 = s_type;
    x.a1 = s_oper;
    x.a2 = s_word;
    x.a3 = s_word;
    x.a4 = s_word;
    x.a5 = s_char;
    x.a6 = s_char;
    x.a7 = s_char;
  }