Beispiel #1
0
        private VerbFavourites()
        {
            var vec = MainWindow.VerbFavourites.ToList <string>();

            foreach (string s in vec)
            {
                var lookup = Verb.InfinitiveLookup(s);
                if (null != lookup)
                {
                    _items.Add(lookup);
                }
            }
        }
Beispiel #2
0
        private void LoadVerbConjugation(string folder)
        {
            string filepath = Path.Combine(folder, "Conjugation.csv");

            TextLoader loader = new TextLoaderDefaultEncoding(filepath);
            int        lines  = 0;

            while (loader.Peek() != null)
            {
                string line = loader.Next();

                if (lines == 0)
                {
                    lines++;
                    continue;
                }



                string[] parts = line.Split(',');


                int CSVlineNum = System.Convert.ToInt32(parts[0]);
                var theVerb    = Verb.InfinitiveLookup(parts[1]);

                if (theVerb == null)
                {
                    Debug.WriteLine(String.Format("Line {0} Verb {1} missing from master table", CSVlineNum, parts[1]));
                }
                else
                {
                    Verb.Mode  m = Verb.ParseMode(parts[2]);
                    Verb.Tense t = Verb.ParseTense(parts[3]);
                    theVerb.AddConjugation(m, t, parts);
                }


                lines++;
            }
        }
Beispiel #3
0
        private void LoadSpanishDictVerbUsage(string folder)
        {
            //Load verbs definitions in subfolder /VerbUsage
            foreach (var filepath in  Directory.EnumerateFiles(folder, "*.txt"))
            {
                try
                {
                    var infinitive = Path.GetFileNameWithoutExtension(filepath);

                    if (!infinitive.EndsWith("EJEMPLOS"))
                    {
                        //Find in master table
                        var match = Verb.InfinitiveLookup(infinitive.ToLower());

                        if (match == null)
                        {
                            Debug.WriteLine("MISSING FROM VERB MASTER TABLE " + infinitive);
                            //match = new Verb(infinitive.ToLower(), "MISSING FROM VERB MASTER TABLE");
                            //Verb.Add(match);
                        }
                        else
                        {
                            match.LoadActionGroups(filepath);
                        }
                    }
                    else
                    {
                        //Skip verb exmaples fo now
                        //TODO - load the additional examples
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(String.Format("Error in {0}-{1}", filepath, ex.Message));
                }
            }
        }