Examples of DebugResult


Examples of org.ictclas4j.bean.DebugResult

    this.isRecogniseUnknown = true;
  }

  public SegResult split(String src) {
    SegResult finalResult = new SegResult();// �ִʽ��
    DebugResult debugResult = new DebugResult(src);

    if (src != null) {
      int index = 0;
      SegResult midResult = null;
      finalResult.setRawContent(src);
      SentenceSeg ss = new SentenceSeg(src);
      ArrayList<Sentence> sens = ss.getSens();

      for (Sentence sen : sens) {
        logger.debug(sen);
        MidResult mr = new MidResult();
        mr.setIndex(index++);
        mr.setSource(sen.getContent());
        if (sen.isSeg()) {

          // ԭ�ӷִ�
          AtomSeg as = new AtomSeg(sen.getContent());
          ArrayList<Atom> atoms = as.getAtoms();
          mr.setAtoms(atoms);

          // ���ɷִ�ͼ��,�Ƚ��г����ִʣ�Ȼ������Ż��������д��Ա��
          SegGraph segGraph = GraphGenerate.generate(atoms, dictLib);
          mr.setSegGraph(segGraph.getSnList());
          // ���ɶ���ִ�ͼ��
          SegGraph biSegGraph = GraphGenerate.biGenerate(segGraph, dictLib);
          mr.setBiSegGraph(biSegGraph.getSnList());

          // ��N���·��
          NShortPath nsp = new NShortPath(biSegGraph, segPathCount);
          ArrayList<ArrayList<Integer>> bipath = nsp.getPaths();
          mr.setBipath(bipath);

          for (ArrayList<Integer> onePath : bipath) {
            // �õ����ηִ�·��
            ArrayList<SegNode> segPath = getSegPath(segGraph, onePath);
            ArrayList<SegNode> firstPath = AdjustSeg.firstAdjust(segPath);
            SegResult firstResult = outputResult(firstPath);
            mr.addFirstResult(firstResult.toString());

            if (isRecogniseUnknown)
              midResult = optinium(mr, firstPath);
            else {
              PosTagger lexTagger = new PosTagger(Utility.TAG_TYPE.TT_NORMAL, dictLib);
              lexTagger.recognise(firstPath);
              SegResult optResult = outputResult(firstPath);
              mr.addOptResult(optResult.toString());
              ArrayList<SegNode> adjResult = AdjustSeg.finalAdjust(firstPath, dictLib);

              midResult = outputResult(adjResult);
            }
            break;
          }
        } else {
          SegAtom atom = new SegAtom(sen.getContent());
          SegAtom[] atoms = new SegAtom[1];
          atoms[0] = atom;
          midResult = new SegResult();
          midResult.setRawContent(sen.getContent());
          midResult.setAtoms(atoms);
        }
        finalResult.merge(midResult);
        debugResult.addMidResult(mr);
      }
      logger.debug(finalResult.toString());
      if (this.isOutputMidResult) {
        DebugUtil.output2html(debugResult);
      }
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.