Package cc.mallet.fst.confidence

Examples of cc.mallet.fst.confidence.ConstrainedForwardBackwardConfidenceEstimator


                        logger.info("Failed to decode input sequence " + i + ", answer " + a);
                        error = true;
                    }
                }
                if (!error) {             
                  ConstrainedForwardBackwardConfidenceEstimator cfb = new ConstrainedForwardBackwardConfidenceEstimator(crf);
                  SumLatticeDefault lattice = new SumLatticeDefault (cfb.getTransducer(), input);
                    double conf = 0;
                   
                    for (int j = 0; j < input.size(); j++) {
                        StringBuffer buf = new StringBuffer();
                        for (int a = 0; a < k; a++) {
                            String tag = outputs[a].get(j).toString();
                         
                          //Lets's get the confidence if this is an entity
                          if(tag.startsWith("B-")) {
                            int endTagIdx = j+1;
                            while(endTagIdx < input.size() && outputs[a].get(endTagIdx).toString().startsWith("I-")) {
                              endTagIdx++;
                            }
                            endTagIdx -= 1;
                           
                            Segment s = new Segment(input, outputs[a], outputs[a], j, endTagIdx, tag, outputs[a].get(endTagIdx));
                            conf = cfb.estimateConfidenceFor(s, lattice);
                          }
                         
                          if(!tag.equals("O")) {
                            tag = tag + ":" + Double.toString(conf);
                          }
View Full Code Here

TOP

Related Classes of cc.mallet.fst.confidence.ConstrainedForwardBackwardConfidenceEstimator

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.