Exemplo n.º 1
0
        //Segment given text
        public int Segment(crf_term_out[] pout,        //segment result
                           DecoderTagger tagger,       //Tagger per thread
                           List <List <string> > inbuf //feature set for segment
                           )
        {
            int ret = 0;

            if (inbuf.Count == 0)
            {
                //Empty input string
                return(Utils.ERROR_SUCCESS);
            }

            ret = tagger.reset();
            if (ret < 0)
            {
                return(ret);
            }

            ret = tagger.add(inbuf);
            if (ret < 0)
            {
                return(ret);
            }

            //parse
            ret = tagger.parse();
            if (ret < 0)
            {
                return(ret);
            }

            //wrap result
            ret = tagger.output(pout);
            if (ret < 0)
            {
                return(ret);
            }

            return(Utils.ERROR_SUCCESS);
        }
Exemplo n.º 2
0
        //Segment given text
        public int Segment(crf_term_out[] pout, //segment result
            DecoderTagger tagger, //Tagger per thread
            List<List<string>> inbuf //feature set for segment
            )
        {
            var ret = 0;
            if (inbuf.Count == 0)
            {
                //Empty input string
                return Utils.ERROR_SUCCESS;
            }

            ret = tagger.reset();
            if (ret < 0)
            {
                return ret;
            }

            ret = tagger.add(inbuf);
            if (ret < 0)
            {
                return ret;
            }

            //parse
            ret = tagger.parse();
            if (ret < 0)
            {
                return ret;
            }

            //wrap result
            ret = tagger.output(pout);
            if (ret < 0)
            {
                return ret;
            }

            return Utils.ERROR_SUCCESS;
        }