Beispiel #1
0
 /// <summary>
 /// Constructeur du dictionnaire
 /// </summary>
 /// <param name="loader">Objet permettant de gérer les opération entre le dictionnaire et son support de stockage</param>
 public LanguageDictionary()
 {
     this.IsLoaded = false;
     this.root = new FragmentWord(' ');
     this.conjugaisonTables = new List<ConjugationTable>();
     this.tenses = null;
     this.persons = null;
 }
Beispiel #2
0
            public bool AddFragment(Word w, string substr)
            {
                char c = substr[0];

                FragmentWord f = this.search(c);
                if (f == null)
                {
                    f = new FragmentWord(c);
                    this.childs.Add(c, f);
                }

                if (substr.Length > 1)
                {
                    return f.AddFragment(w, substr.Substring(1)); // on propage l'ajout
                }
                else if (substr.Length == 1)
                {
                    if (f.word == null)
                    {
                        f.word = w;
                        return true; // on a ajouté le mot
                    }
                    else
                    {
                        // vérifier que le type est bien différent. (on peut avoir plusieurs fois le même mot avec un type différent !)
                        // TODO: écrire code correspondant !
                        bool identicalSequences = true;
                        foreach (WordType type in w.types)
                        {
                             if (!f.word.types.Contains(type))
                             {
                                 identicalSequences = false;
                                 f.word.AddType(type);
                             }
                        }

                        return !identicalSequences; // on a ajouté au moins un type
                    }
                }

                return false; // on a rien ajouté
            }