Beispiel #1
0
        static void Main(string[] args)
        {
            // Заполняем запись.
            DictionaryArticle article = new DictionaryArticle();

            article.word        = "estar";
            article.translation = null;
            article.signature   = null;
            article.conjugation = Conjugator.CONJUGATION_1;
            article.Group       = Conjugator.GROUP_IRREGULAR_INDIVIDUAL;
            article.index       = 0;


            FileStream   file   = File.Create(@"conjugation.txt");
            StreamWriter writer = new StreamWriter(file);


            for (byte t = 0; t <= 15; t++)
            {
                List <string> result = Conjugator.Conjugate(article, t);

                writer.WriteLine(Grammar.tenses[t]);
                writer.WriteLine();

                foreach (string item in result)
                {
                    writer.WriteLine(item);
                }

                writer.WriteLine();
                writer.WriteLine();
            }

            writer.Close();
        }
Beispiel #2
0
        private void DisplayForms(DictionaryArticle article, byte tense, int left, int top)
        {
            List <string> forms = Conjugator.Conjugate(article, tense);

            Label labelTense = new Label();

            labelTense.Text      = Grammar.tenses[tense];
            labelTense.Width     = 190;
            labelTense.BackColor = Color.FromArgb(230, 230, 230);
            labelTense.Left      = left;
            labelTense.Top       = top;
            this.Controls.Add(labelTense);

            top += 37;

            foreach (String form in forms)
            {
                Label labelForm = new Label();
                labelForm.Text  = form;
                labelForm.Width = 180;
                labelForm.Left  = left;
                labelForm.Top   = top;
                this.Controls.Add(labelForm);

                top += 25;
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.InputEncoding  = Encoding.Unicode;
            Console.OutputEncoding = Encoding.Unicode;

            Console.WriteLine("Doushi Japanese verb conjugator");
            Console.WriteLine("Type 'exit' to quit");
            Console.WriteLine();

            while (true)
            {
                Console.WriteLine("Dictionary form verb:");
                Console.Write("> ");
                var verb = Console.ReadLine();

                if (string.IsNullOrWhiteSpace(verb))
                {
                    continue;
                }
                else if (verb.Equals("exit", StringComparison.OrdinalIgnoreCase))
                {
                    return;
                }

                if (verb.Length < 2)
                {
                    continue;
                }

                Console.WriteLine("Reading (optional)");
                Console.Write("> ");
                var reading = Console.ReadLine();

                Console.WriteLine("Verb type (Auto detects when the reading is provided (not totally accurate))\n'1': Ichidan\n'2': Godan\n'3': Special Suru/Kuru");
                Console.Write("> ");
                var t    = Console.ReadLine();
                var type = t switch
                {
                    "1" => Doushi.Type.ICHIDAN,
                    "2" => ((Func <Doushi.Type>)(() =>
                    {
                        var t = Conjugator.TryFindType(verb, reading.Length >= 2 ? reading : verb);
                        return(t != Doushi.Type.ICHIDAN ? t : Doushi.Type.GODAN_RU);
                    }))(),
                    "3" => Conjugator.TryFindType(verb, verb),
                    _ => reading.Length >= 2 ? Conjugator.TryFindType(verb, reading) : Doushi.Type.UNKNOWN
                };

                Console.WriteLine();
                Console.WriteLine($" {verb} {type}\n\n Affirmative | Negative\n");

                var conj = Conjugator.Conjugate(verb, type, reading);

                if (conj != null)
                {
                    Console.WriteLine($" -> Non-Past: {conj.NonPast.Affirmative} | {conj.NonPast.Negative}\n");
                    Console.WriteLine($" -> Non-Past Polite: {conj.NonPastPolite.Affirmative} | {conj.NonPastPolite.Negative}\n");
                    Console.WriteLine($" -> Past: {conj.Past.Affirmative} | {conj.Past.Negative}\n");
                    Console.WriteLine($" -> Past Polite: {conj.PastPolite.Affirmative} | {conj.PastPolite.Negative}\n");
                    Console.WriteLine($" -> Te Form: {conj.TeForm.Affirmative} | {conj.TeForm.Negative}\n");
                    Console.WriteLine($" -> Potential: {conj.Potential.Affirmative} | {conj.Potential.Negative}\n");
                    Console.WriteLine($" -> Passive: {conj.Passive.Affirmative} | {conj.Passive.Negative}\n");
                    Console.WriteLine($" -> Causative: {conj.Causative.Affirmative} | {conj.Causative.Negative}\n");
                    Console.WriteLine($" -> Causative Passive: {conj.CausativePassive.Affirmative} | {conj.CausativePassive.Negative}\n");
                    Console.WriteLine($" -> Imperative: {conj.Imperative.Affirmative} | {conj.Imperative.Negative}\n");
                }
                else
                {
                    Console.WriteLine("Invalid input");
                }
                Console.WriteLine();
            }
        }
    }