Пример #1
0
 public TaggedLemmasFormsEnumerator(TaggedLemmasForms collection)
 {
     collectionRef = collection;
     currentIndex  = -1;
     currentObject = null;
     currentSize   = collectionRef.Count;
 }
Пример #2
0
 public TaggedLemmasForms(TaggedLemmasForms other) : this(morphodita_csharpPINVOKE.new_TaggedLemmasForms__SWIG_1(TaggedLemmasForms.getCPtr(other)), true)
 {
     if (morphodita_csharpPINVOKE.SWIGPendingException.Pending)
     {
         throw morphodita_csharpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #3
0
 public void SetRange(int index, TaggedLemmasForms values)
 {
     morphodita_csharpPINVOKE.TaggedLemmasForms_SetRange(swigCPtr, index, TaggedLemmasForms.getCPtr(values));
     if (morphodita_csharpPINVOKE.SWIGPendingException.Pending)
     {
         throw morphodita_csharpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #4
0
 public virtual void convertGenerated(TaggedLemmasForms forms)
 {
     morphodita_csharpPINVOKE.TagsetConverter_convertGenerated(swigCPtr, TaggedLemmasForms.getCPtr(forms));
     if (morphodita_csharpPINVOKE.SWIGPendingException.Pending)
     {
         throw morphodita_csharpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Пример #5
0
        public virtual int generate(string lemma, string tag_wildcard, int guesser, TaggedLemmasForms forms)
        {
            int ret = morphodita_csharpPINVOKE.Morpho_generate(swigCPtr, lemma, tag_wildcard, guesser, TaggedLemmasForms.getCPtr(forms));

            if (morphodita_csharpPINVOKE.SWIGPendingException.Pending)
            {
                throw morphodita_csharpPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #6
0
        public static TaggedLemmasForms Repeat(TaggedLemmaForms value, int count)
        {
            global::System.IntPtr cPtr = morphodita_csharpPINVOKE.TaggedLemmasForms_Repeat(TaggedLemmaForms.getCPtr(value), count);
            TaggedLemmasForms     ret  = (cPtr == global::System.IntPtr.Zero) ? null : new TaggedLemmasForms(cPtr, true);

            if (morphodita_csharpPINVOKE.SWIGPendingException.Pending)
            {
                throw morphodita_csharpPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #7
0
        public TaggedLemmasForms GetRange(int index, int count)
        {
            global::System.IntPtr cPtr = morphodita_csharpPINVOKE.TaggedLemmasForms_GetRange(swigCPtr, index, count);
            TaggedLemmasForms     ret  = (cPtr == global::System.IntPtr.Zero) ? null : new TaggedLemmasForms(cPtr, true);

            if (morphodita_csharpPINVOKE.SWIGPendingException.Pending)
            {
                throw morphodita_csharpPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Пример #8
0
    public static int Main(string[] args)
    {
        if (args.Length < 1)
        {
            Console.Error.WriteLine("Usage: RunMorphoCli dict_file");
            return(1);
        }

        Console.Error.Write("Loading dictionary: ");
        Morpho morpho = Morpho.load(args[0]);

        if (morpho == null)
        {
            Console.Error.WriteLine("Cannot load dictionary from file '{0}'", args[0]);
            return(1);
        }
        Console.Error.WriteLine("done");

        TaggedLemmas      lemmas      = new TaggedLemmas();
        TaggedLemmasForms lemmasForms = new TaggedLemmasForms();

        for (string line; (line = Console.In.ReadLine()) != null;)
        {
            string[] tokens = line.Split('\t');

            if (tokens.Length == 1) /* analyze */
            {
                int result = morpho.analyze(tokens[0], Morpho.GUESSER, lemmas);

                string guesser = result == Morpho.GUESSER ? "Guesser " : "";
                foreach (TaggedLemma lemma in lemmas)
                {
                    Console.WriteLine("{0}Lemma: {1} {2}", guesser, lemma.lemma, lemma.tag);
                }
            }
            else if (tokens.Length == 2)   /* generate */
            {
                int    result  = morpho.generate(tokens[0], tokens[1], Morpho.GUESSER, lemmasForms);
                String guesser = result == Morpho.GUESSER ? "Guesser " : "";
                foreach (TaggedLemmaForms lemmaForms in lemmasForms)
                {
                    Console.WriteLine("{0}Lemma: {1}", guesser, lemmaForms.lemma);
                    foreach (TaggedForm form in lemmaForms.forms)
                    {
                        Console.WriteLine("  {0} {1}", form.form, form.tag);
                    }
                }
            }
        }

        return(0);
    }
Пример #9
0
    public static int Main(string[] args)
    {
        if (args.Length < 1) {
            Console.Error.WriteLine("Usage: RunMorphoCli dict_file");
            return 1;
        }

        Console.Error.Write("Loading dictionary: ");
        Morpho morpho = Morpho.load(args[0]);
        if (morpho == null) {
            Console.Error.WriteLine("Cannot load dictionary from file '{0}'", args[0]);
            return 1;
        }
        Console.Error.WriteLine("done");

        TaggedLemmas lemmas = new TaggedLemmas();
        TaggedLemmasForms lemmasForms = new TaggedLemmasForms();
        for (string line; (line = Console.In.ReadLine()) != null; ) {
            string[] tokens = line.Split('\t');

            if (tokens.Length == 1) /* analyze */ {
                int result = morpho.analyze(tokens[0], Morpho.GUESSER, lemmas);

                string guesser = result == Morpho.GUESSER ? "Guesser " : "";
                foreach (TaggedLemma lemma in lemmas)
                    Console.WriteLine("{0}Lemma: {1} {2}", guesser, lemma.lemma, lemma.tag);
            } else if (tokens.Length == 2) /* generate */ {
                int result = morpho.generate(tokens[0], tokens[1], Morpho.GUESSER, lemmasForms);
                String guesser = result == Morpho.GUESSER ? "Guesser " : "";
                foreach (TaggedLemmaForms lemmaForms in lemmasForms) {
                    Console.WriteLine("{0}Lemma: {1}", guesser, lemmaForms.lemma);
                    foreach (TaggedForm form in lemmaForms.forms)
                            Console.WriteLine("  {0} {1}", form.form, form.tag);
                }
            }
        }

        return 0;
    }
Пример #10
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TaggedLemmasForms obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }