Examples of StringModel


Examples of com.clearnlp.classification.model.StringModel

   * @param labelCutoff the label count cutoff (exclusive).
   * @param featureCutoff the feature count cutoff (exclusive).
   */
  public StringTrainSpace(boolean hasWeight, int labelCutoff, int featureCutoff)
  {
    super(new StringModel(), hasWeight);
   
    s_model     = (StringModel)m_model;
    l_cutoff    = labelCutoff;
    f_cutoff    = featureCutoff;
    s_instances = Lists.newArrayList();
View Full Code Here

Examples of com.clearnlp.classification.model.StringModel

  {
    BufferedReader    fin = UTInput.createBufferedFileReader(testFile);
    PrintStream      fout = UTOutput.createPrintBufferedFileStream(outputFile);
    ObjectInputStream  in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(modelFile)));
    SparseModel    pModel = null;
    StringModel    sModel = null;
   
    switch (vectorType)
    {
    case AbstractTrainSpace.VECTOR_SPARSE:
      pModel = (SparseModel)in.readObject(); break;
    case AbstractTrainSpace.VECTOR_STRING:
      sModel = (StringModel)in.readObject(); break;
    }
   
    in.close();
   
    boolean hasWeight = AbstractTrainSpace.hasWeight(vectorType, testFile);
    int correct = 0, total = 0;
    StringPrediction r = null;
    String line, label = null;
   
    System.out.print("Predicting");
   
    while ((line = fin.readLine()) != null)
    {
      if (vectorType == AbstractTrainSpace.VECTOR_SPARSE)
      {
        Pair<String,SparseFeatureVector> sp = SparseTrainSpace.toInstance(line, hasWeight);
        r = pModel.predictBest(sp.o2);
        label = sp.o1;
      }
      else
      {
        StringInstance ss = StringTrainSpace.toInstance(line, hasWeight);
        r = sModel.predictBest(ss.getFeatureVector());
        label = ss.getLabel();
      }
     
      fout.println(r.label+" "+r.score);
      if (r.label.equals(label))  correct++;
View Full Code Here

Examples of com.clearnlp.classification.model.StringModel

   * @param labelCutoff the label count cutoff (exclusive).
   * @param featureCutoff the feature count cutoff (exclusive).
   */
  public StringTrainSpace(boolean hasWeight, int labelCutoff, int featureCutoff)
  {
    super(new StringModel(), hasWeight);
   
    s_model     = (StringModel)m_model;
    l_cutoff    = labelCutoff;
    f_cutoff    = featureCutoff;
    s_instances = Lists.newArrayList();
View Full Code Here

Examples of com.clearnlp.classification.model.StringModel

  {
    BufferedReader    fin = UTInput.createBufferedFileReader(testFile);
    PrintStream      fout = UTOutput.createPrintBufferedFileStream(outputFile);
    ObjectInputStream  in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(modelFile)));
    SparseModel    pModel = null;
    StringModel    sModel = null;
   
    switch (vectorType)
    {
    case AbstractTrainSpace.VECTOR_SPARSE:
      pModel = (SparseModel)in.readObject(); break;
    case AbstractTrainSpace.VECTOR_STRING:
      sModel = (StringModel)in.readObject(); break;
    }
   
    in.close();
   
    boolean hasWeight = AbstractTrainSpace.hasWeight(vectorType, testFile);
    int correct = 0, total = 0;
    StringPrediction r = null;
    String line, label = null;
   
    System.out.print("Predicting");
   
    while ((line = fin.readLine()) != null)
    {
      if (vectorType == AbstractTrainSpace.VECTOR_SPARSE)
      {
        Pair<String,SparseFeatureVector> sp = SparseTrainSpace.toInstance(line, hasWeight);
        r = pModel.predictBest(sp.o2);
        label = sp.o1;
      }
      else
      {
        StringInstance ss = StringTrainSpace.toInstance(line, hasWeight);
        r = sModel.predictBest(ss.getFeatureVector());
        label = ss.getLabel();
      }
     
      fout.println(r.label+" "+r.score);
      if (r.label.equals(label))  correct++;
View Full Code Here

Examples of com.nexirius.framework.datamodel.StringModel

        return ret;
    }

    public void showHelp(String text) {
        StringModel about = new StringModel("");
        try {
            XFile aboutFile = new XFile(text);

            about.setText(new String(aboutFile.getBytes()));
        } catch (Exception ex) {
            about.setText(ex.getClass().getName());
            ex.printStackTrace();
        }

        DialogManager.getPopupEditorAdaptor().noDuplicatePopupEdit(about, new SwingViewerCreator(HelpViewer.class), null);
    }
View Full Code Here

Examples of com.nexirius.framework.datamodel.StringModel

        super("Phone");
        init();
    }

    private void init() {
        fk = new StringModel("", ITeamPersistence.FOREIGN_KEY);
        append(fk);
        append(description = new StringModel("", FIELD_DESCRIPTION));
        append(number = new StringModel("", FIELD_NUMBER));
    }
View Full Code Here

Examples of com.nexirius.framework.datamodel.StringModel

        super(FIELD_ADDRESS);
        init();
    }

    private void init() {
        fk = new StringModel("", ITeamPersistence.FOREIGN_KEY);
        append(fk);
        append(street = new StringModel("", FIELD_STREET));
        append(zip = new StringModel("", FIELD_ZIP));
        append(city = new StringModel("", FIELD_CITY));
        append(state = new StringModel("", FIELD_STATE));
        mainAddress = new BooleanModel(false, FIELD_MAIN_ADDRESS);
        append(mainAddress);
    }
View Full Code Here

Examples of com.nexirius.framework.datamodel.StringModel

        }
    }

    public String getChildName() {
        try {
            StringModel m = (StringModel) getChild(CHILD_NAME);

            return m.getText();
        } catch (Exception ex) {
            return null;
        }
    }
View Full Code Here

Examples of com.nexirius.framework.datamodel.StringModel

        }
    }

    public String getNewValue() {
        try {
            StringModel m = (StringModel) getChild(VALUE);

            return m.getText();
        } catch (Exception ex) {
            return null;
        }
    }
View Full Code Here

Examples of com.nexirius.framework.datamodel.StringModel

  }
*/
    private void init(URL url, ViewerFactory factory) {
        history = new SortedVector();
        control = new StructModel("Controls");
        control.append(urlString = new StringModel(url.toString(), "URL"));
        control.appendMethod(new LoadCommand());
        control.appendMethod(prev = new PrevURLCommand());
        control.appendMethod(next = new NextURLCommand());
        control.appendMethod(new CloseCommand());

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.