/// <summary> /// Добавление слова и синт.узла во внутренние хранилища. /// </summary> /// <param name="order">Порядок следования слова в предложении</param> /// <param name="word">Структура слова</param> /// <returns></returns> public void AddWord(int order, WordMap word) { if (!words.ContainsKey(order) && word != null) { words.Add(order, word); } }
public static List <SentenceMap> BuildFromMessage(Message message) { List <SentenceMap> sentlist = new List <SentenceMap>(); if (message.SentencesLength == 0) { return(sentlist); } for (int i = 0; i < message.SentencesLength; i++) { SentenceMap resSent = null; var sent = message.Sentences(i); if (sent.HasValue) { var sentval = sent.Value; resSent = new SentenceMap(); resSent._phID = sentval.SentenceID; var wlist = WordMap.GetWordsFromMessSentence(sentval); foreach (var w in wlist) { resSent.words.Add(w.Key, w.Value); } var nlist = GetNodesFromMessSentence(sentval); foreach (var node in nlist) { resSent.treeList.Add(node.Value); } sentlist.Add(resSent); } } return(sentlist); }
/// <summary> /// Получение структуры WordMap из структуры Lexema. /// </summary> private static WordMap BuildFromLexema(Lexema?lexema) { WordMap word = null; if (lexema.HasValue) { var lexval = lexema.Value; word = new WordMap(lexval.IdEntry, lexval.IdPartofspeech); word.EntryName = lexval.EntryName; word.order = lexval.Order; word.RealWord = lexval.RealWord; word.rcind = lexval.Rcind; // Чтение граммем for (int i = 0; i < lexval.GrammemsLength; i++) { var grammema = lexval.Grammems(i); if (grammema.HasValue) { word.AddPair(grammema.Value.Key, grammema.Value.Value); } } } return(word); }