예제 #1
0
        void ILoader.loadDico(LanguageDictionary dico, Factory factory)
        {
            // chargement du dico à partir d'une base SQLite

            // --  chargement des mots  ---------------------------------------

            List<Dictionary<string, object>> words = this.db.select("words", new string[] { "word", "type", "attributs", "definition" });
            for (int i = 0; i < words.Count; i++)
            {
                string w = (string)words[i]["word"];
                string t = (string)words[i]["type"];
                string a = (string)words[i]["attributs"];
                string d = (string)words[i]["definition"];

                if (a == null) a = "";
                if (d == null) d = "";

                Word word = factory.create(w, t, a.Split(new char[] {','}, StringSplitOptions.RemoveEmptyEntries), d);

                if (word.IsTypeOf(typeof(VerbType)))
                {
                    //charger la table de conjugaison
                    Word[] verbsConjugated = this.getConjugatedVerbsFor(word.word, factory);
                    ConjugationTable table = new ConjugationTable(word);
                    table.AddRange(verbsConjugated); // ajout des verbes à la table de conjugaison
                    dico.conjugaisonTables.Add(table); // ajout de la table de conjugaison au dictionnaire
                    dico.AddRange(verbsConjugated); // ajout des verbes au dictionnaire
                }

                dico.Add(word);
            }
        }
예제 #2
0
        public static Word[] contextual(LanguageDictionary dictionary, string phrase, string startWord)
        {
            // retrouver ou est situé le startWord dans la phrase
            // cela devrait permettre de déterminer le type du mot attendu (à l'aide des règles d'inférences)

            return new Word[] {};
        }
예제 #3
0
        // --  privates méthodes for loading
        private static void beginLoading(LoadTerminated callback, Parameters parameters = null)
        {
            if (NLEEngine.dico != null)
            {
                // désallouer le précédent dico

            }

            // paramétrer loader du moteur en fonction d'argument passer à la méthode load
            // utiliser "parameters"
            loader = new SQLiteLoader(Properties.Settings.Default.dbpath);

            NLEEngine.dico = new LanguageDictionary();

            if (callback == null)
            {
                // chargement synchrone
                NLEEngine.loadAsyncNext();
            }
            else
            {
                // chargement asynchrone
                new Thread(new ParameterizedThreadStart(NLEEngine.loadAsyncNext)).Start(callback);
            }
        }
예제 #4
0
 public static Word[] simple(LanguageDictionary dictionary, string startWord)
 {
     return dictionary.getAll(startWord);
 }