Package org.fnlp.ml.classifier.struct.inf

Examples of org.fnlp.ml.classifier.struct.inf.LinearViterbi$Node


    boolean status(final List<String> toks) {
        if (standaloneNodes.size() > 0) {
            out.println("Standalone Nodes:");
            for (String nodeName : standaloneNodes.keySet()) {
                Node node = standaloneNodes.get(nodeName);
                for (String curi : node.getInstalledContributions()) {
                    for (String dc : node.getDeployedComposites(curi)) {
                        out.println("   " + nodeName + " " + dc);
                    }
                }
            }
            out.println();
        }
        if (nodes.size() > 0) {
            for (Node node : nodes.values()) {
                out.println("Domain: " + node.getDomainName());
                List<String> ics;
                if (toks.size() > 1) {
                    ics = new ArrayList<String>();
                    ics.add(toks.get(1));
                } else {
                    ics = node.getInstalledContributions();
                }

                for (String curi : ics) {
                    Contribution c = node.getInstalledContribution(curi);
                    List<String> dcs = node.getDeployedComposites(curi);
                    if (toks.size() > 2) {
                        dcs = new ArrayList<String>();
                        dcs.add(toks.get(2));
                    } else {
                        dcs = node.getDeployedComposites(curi);
                    }
                    for (String compositeUri : dcs) {
                        for (Artifact a : c.getArtifacts()) {
                            if (compositeUri.equals(a.getURI())) {
                                out.println("   " + curi
View Full Code Here


    // viterbi解码
    Inferencer inference;

    HammingLoss loss = new HammingLoss();
    if (standard) {
      inference = new LinearViterbi(templets, labels.size());
      update = new LinearViterbiPAUpdate((LinearViterbi) inference, loss);
    } else {
      inference = new HigherOrderViterbi(templets, labels.size());
      update = new HigherOrderViterbiPAUpdate(templets, labels.size(), true);
    }
View Full Code Here

      dictPipe = new DictLabel(dict, labels);

    oldfeaturePipe = featurePipe;
    featurePipe = new SeriesPipes(new Pipe[] { dictPipe, featurePipe });

    LinearViterbi dv = new ConstraintViterbi(
        (LinearViterbi) getClassifier().getInferencer());
    getClassifier().setInferencer(dv);
  }
View Full Code Here

   */
  public void removeDictionary()  {
    if(oldfeaturePipe != null){
      featurePipe = oldfeaturePipe;
    }
    LinearViterbi dv = new LinearViterbi(
        (LinearViterbi) getClassifier().getInferencer());
    getClassifier().setInferencer(dv);

    dictPipe = null;
    oldfeaturePipe = null;
View Full Code Here

    labels.setStopIncrement(true);


    // viterbi解码
    HammingLoss loss = new HammingLoss();
    Inferencer inference = new LinearViterbi(templets, labels.size());
    Update update = new LinearViterbiPAUpdate((LinearViterbi) inference, loss);


    OnlineTrainer trainer = new OnlineTrainer(inference, update, loss,
        features.size(), 50,0.1f);
View Full Code Here

      cws.setDictionary(dict);
    dictPipe = null;
    dictPipe = new DictPOSLabel(dict, labels);
    oldfeaturePipe = featurePipe;
    featurePipe = new SeriesPipes(new Pipe[] { dictPipe, featurePipe });
    LinearViterbi dv = new ConstraintViterbi(
        (LinearViterbi) getClassifier().getInferencer(),labels.size());
    getClassifier().setInferencer(dv);
  }
View Full Code Here

      cws.removeDictionary();

    if(oldfeaturePipe != null){
      featurePipe = oldfeaturePipe;
    }
    LinearViterbi dv = new LinearViterbi(
        (LinearViterbi) getClassifier().getInferencer());
    getClassifier().setInferencer(dv);

    dictPipe = null;
    oldfeaturePipe = null;
View Full Code Here

    // viterbi解码
    Inferencer inference;
    boolean standard = true;
    HammingLoss loss = new HammingLoss();
    if (standard) {
      inference = new LinearViterbi(templets, labels.size());
      update = new LinearViterbiPAUpdate((LinearViterbi) inference, loss);
    } else {
      inference = new HigherOrderViterbi(templets, labels.size());
      update = new HigherOrderViterbiPAUpdate(templets, labels.size(), true);
    }
View Full Code Here

   */
  public static void main(String[] args) throws Exception {
    seg = new CWSTagger("./models/seg.m");
    cl = seg.getClassifier();
    int ysize = cl.getAlphabetFactory().getLabelSize();
    LinearViterbi vit = (LinearViterbi) cl.getInferencer();
    System.out.println(cl.getAlphabetFactory().getFeatureSize());
    HigherOrderViterbi inferencer = new HigherOrderViterbi(vit.getTemplets(), ysize);
    inferencer.setWeights(vit.getWeights());
    cl.setInferencer(inferencer);


    dict = MyCollection.loadSet("./data/FNLPDATA/all.dict", true);

View Full Code Here

    for (Way way : waysById.values()) {
     
      List<WayNode> origWayNodes = way.getWayNodes();
      List<OSMNode> wayNodes = new ArrayList<OSMNode>(origWayNodes.size());
      for (WayNode origWayNode : origWayNodes) {
        Node origNode = nodesById.get(origWayNode.getNodeId());
        if (origNode != null) {
          wayNodes.add(nodeMap.get(origNode));
        }
      }
     
View Full Code Here

TOP

Related Classes of org.fnlp.ml.classifier.struct.inf.LinearViterbi$Node

Copyright © 2018 www.massapicom. 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.