示例#1
0
        public virtual bool parse(Lattice lattice)
        {
            bool ret = MeCabPINVOKE.Tagger_parse__SWIG_1(swigCPtr, Lattice.getCPtr(lattice));

            if (MeCabPINVOKE.SWIGPendingException.Pending)
            {
                throw MeCabPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
示例#2
0
        public static bool parse(Model model, Lattice lattice)
        {
            bool ret = MeCabPINVOKE.Tagger_parse__SWIG_0(Model.getCPtr(model), Lattice.getCPtr(lattice));

            if (MeCabPINVOKE.SWIGPendingException.Pending)
            {
                throw MeCabPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
示例#3
0
        public virtual Lattice createLattice()
        {
            IntPtr  cPtr = MeCabPINVOKE.Model_createLattice(swigCPtr);
            Lattice ret  = (cPtr == IntPtr.Zero) ? null : new Lattice(cPtr, false);

            if (MeCabPINVOKE.SWIGPendingException.Pending)
            {
                throw MeCabPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
示例#4
0
        public virtual Node lookup(string begin, string end, Lattice lattice)
        {
            IntPtr cPtr = MeCabPINVOKE.Model_lookup(swigCPtr, begin, end, Lattice.getCPtr(lattice));
            Node   ret  = (cPtr == IntPtr.Zero) ? null : new Node(cPtr, false);

            if (MeCabPINVOKE.SWIGPendingException.Pending)
            {
                throw MeCabPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
示例#5
0
    static void Main(String[] argv)
    {
        try {
            Console.WriteLine(MeCab.MeCab.VERSION);
            String arg = "";
            for (int i = 0; i < argv.Length; ++i)
            {
                arg += " ";
                arg += argv[i];
            }
            MeCab.Tagger t = new MeCab.Tagger(arg);
            String       s = "太郎は花子が持っている本を次郎に渡した。";
            Console.WriteLine(t.parse(s));

            for (MeCab.Node n = t.parseToNode(s); n != null; n = n.next)
            {
                Console.WriteLine(n.surface + "\t" + n.feature);
            }

            MeCab.Model  model = new MeCab.Model(arg);
            MeCab.Tagger t2    = model.createTagger();
            Console.WriteLine(t2.parse(s));

            MeCab.Lattice lattice = model.createLattice();
            Console.WriteLine(s);
            lattice.set_sentence(s);
            if (t2.parse(lattice))
            {
                Console.WriteLine(lattice.toString());
            }

            lattice.add_request_type(MeCab.MeCab.MECAB_NBEST);
            lattice.set_sentence(s);
            t2.parse(lattice);
            for (int i = 0; i < 10; ++i)
            {
                lattice.next();
                Console.WriteLine(lattice.toString());
            }
        }

        catch (Exception e) {
            Console.WriteLine("Generic Exception Handler: {0}", e.ToString());
        }
    }
示例#6
0
文件: Tagger.cs 项目: Hayaki/mecab
 public virtual bool parse(Lattice lattice) {
   bool ret = MeCabPINVOKE.Tagger_parse__SWIG_1(swigCPtr, Lattice.getCPtr(lattice));
   if (MeCabPINVOKE.SWIGPendingException.Pending) throw MeCabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
示例#7
0
文件: Tagger.cs 项目: Hayaki/mecab
 public static bool parse(Model model, Lattice lattice) {
   bool ret = MeCabPINVOKE.Tagger_parse__SWIG_0(Model.getCPtr(model), Lattice.getCPtr(lattice));
   if (MeCabPINVOKE.SWIGPendingException.Pending) throw MeCabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
示例#8
0
文件: Model.cs 项目: Hayaki/mecab
 public virtual Node lookup(string begin, string end, Lattice lattice) {
   IntPtr cPtr = MeCabPINVOKE.Model_lookup(swigCPtr, begin, end, Lattice.getCPtr(lattice));
   Node ret = (cPtr == IntPtr.Zero) ? null : new Node(cPtr, false);
   if (MeCabPINVOKE.SWIGPendingException.Pending) throw MeCabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
示例#9
0
 internal static HandleRef getCPtr(Lattice obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
示例#10
0
文件: Lattice.cs 项目: Hayaki/mecab
 internal static HandleRef getCPtr(Lattice obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }