/// <summary> /// сохранение морфотипа /// </summary> private void AddMorphoType2Dictionary(ref MorphoTypeNative_pair_t morphoTypePair) { if (_MorphoTypesDictionary.ContainsKey(morphoTypePair.Name)) { _ModelLoadingErrorCallback("Duplicated morpho-type", StringsHelper.ToString(morphoTypePair.Name)); //throw (new DuplicatedMorphoTypeException()); } else { _MorphoTypesDictionary.Add(morphoTypePair.Name, morphoTypePair.MorphoType); } }
/// <summary> /// создание морфотипа из строки /// </summary> private MorphoTypeNative_pair_t?CreateMorphoTypePair(char *lineBase, int lineLength) { var index1 = IndexOf(lineBase, COMMA); if (index1 == -1) { return(null); } var index2 = IndexAfter_MORPHO_TYPE(lineBase + index1 + 1); if (index2 == -1) { return(null); } var partOfSpeech = default(PartOfSpeechEnum); if (_EnumParserPartOfSpeech.TryParse(lineBase, index1, ref partOfSpeech)) { var startIndex = index1 + 1 + index2 + 1; IntPtr namePtr; AllocHGlobalAndCopy(lineBase + startIndex, lineLength - startIndex, out namePtr); var morphoType = new MorphoTypeNative(_PartOfSpeechList.GetPartOfSpeech(partOfSpeech)); var morphoTypePair = new MorphoTypeNative_pair_t() { Name = namePtr, MorphoType = morphoType, }; return(morphoTypePair); } else { var pos = StringsHelper.ToString(lineBase, index1); _ModelLoadingErrorCallback("Unknown part-of-speech: '" + pos + '\'', StringsHelper.ToString(lineBase)); } return(null); }