Exemplo n.º 1
0
        public ChineseSegmenter(CutCommandType cutCommandType, AddWordCommandType addWordCommandType)
        {
            DagGenerator   = new DagGenerator.DagGenerator();
            RouteGenerator = new BestRouteGenerator(DagGenerator);
            if (cutCommandType == CutCommandType.All)
            {
                CutDagCommand = new CutAllCommand(DagGenerator, RouteGenerator);
            }
            else if (cutCommandType == CutCommandType.Hmm)
            {
                Algorithm     = new ViterbiAlgorithm();
                CutDagCommand = new CutWithHmmCommand(DagGenerator, RouteGenerator, Algorithm);
            }
            else
            {
                Algorithm     = new NoHmmAlgorithm();
                CutDagCommand = new CutWithoutHmmCommand(DagGenerator, RouteGenerator, Algorithm);
            }

            if (addWordCommandType == AddWordCommandType.Hmm)
            {
                Algorithm     = new ViterbiAlgorithm();
                CutDagCommand = new CutWithHmmCommand(DagGenerator, RouteGenerator, Algorithm);
            }
            else
            {
                Algorithm     = new NoHmmAlgorithm();
                CutDagCommand = new CutWithoutHmmCommand(DagGenerator, RouteGenerator, Algorithm);
            }
        }
Exemplo n.º 2
0
 public ChineseSegmenter()
 {
     DagGenerator      = new DagGenerator.DagGenerator();
     RouteGenerator    = new BestRouteGenerator(DagGenerator);
     Algorithm         = new ViterbiAlgorithm();
     CutDagCommand     = new CutWithHmmCommand(DagGenerator, RouteGenerator, Algorithm);
     AddWordCutCommand = new CutWithHmmCommand(DagGenerator, RouteGenerator, Algorithm);
 }