/// добавление слова и всех его форм в словарь /// wordBase - marshaled-слово /// morphoType - морфотип /// nounType - тип сущетсвительного public void AddWord(char *wordBase, MorphoTypeNative morphoType, ref MorphoAttributePair?nounType) { var baseMorphoForm = new BaseMorphoFormNative(wordBase, morphoType); for (TreeDictionaryNative _this = this, _this_next; ;) { var first_char = _UPPER_INVARIANT_MAP[*wordBase]; #region [.сохранение характеристик if end-of-word.] if (first_char == '\0') { // sort & merge after insert - may be faster/better (30.04.2014)!!!! //* var len = morphoType.MorphoFormEndingUpperAndMorphoAttributes.Length; SortedListIntPtrKey <pair[]> .Tuple[] tuples; int tuplesOffset; if (!_this.HasEndings()) { tuplesOffset = 0; tuples = new SortedListIntPtrKey <pair[]> .Tuple[len]; } else { tuplesOffset = _this._Endings.Count; tuples = new SortedListIntPtrKey <pair[]> .Tuple[len + tuplesOffset]; for (int i = 0; i < tuplesOffset; i++) { tuples[i] = _this._Endings.Array[i]; } } for (int i = 0; i < len; i++) { var p = morphoType.MorphoFormEndingUpperAndMorphoAttributes[i]; var pairs_current_len = p.MorphoAttributes.Length; var pairs_current = new pair[pairs_current_len]; for (int j = 0; j < pairs_current_len; j++) { var ma = MorphoAttributePair.GetMorphoAttribute(morphoType, p.MorphoAttributes[j], ref nounType); pairs_current[j] = new pair(baseMorphoForm, ma); } tuples[i + tuplesOffset] = new SortedListIntPtrKey <pair[]> .Tuple() { Key = p.EndingUpper, Value = pairs_current }; } ShellSortAscending(tuples); MergeSorted(ref tuples); _this._Endings.SetArray(tuples); //*/ return; } #endregion if (!_this._Slots.TryGetValue(first_char, out _this_next)) { /// добавление новой буквы _this_next = new TreeDictionaryNative(); _this._Slots.Add(first_char, _this_next); } _this = _this_next; wordBase++; } }
internal static void EndLoad() { BaseMorphoFormNative.EndLoad(); MorphoTypeNative.EndLoad(); tempBufferPairs = null; }