public static Sentence Convert(JsonSentence jsonSentence) { var result = new Sentence(); result.Words.AddRange(jsonSentence.Words); result.SimpleSentences.AddRange(jsonSentence.SimpleSentences.Select(list => wordIndexesToSimpleSentence(list, jsonSentence.Words))); result.LinkedChains.AddRange(jsonSentence.LinkedChains.Select(chain => jsonLinkedChainToModelChain(chain, jsonSentence.Words))); result.Uniforms.AddRange(wordIndexesListsToWordChains(jsonSentence.Uniforms, jsonSentence.Words)); result.ValuableAuxParts.AddRange(wordIndexesListsToWordChains(jsonSentence.ValuableAuxParts, jsonSentence.Words)); result.Subjects.AddRange(wordIndexesListsToWordChains(jsonSentence.Subjects, jsonSentence.Words)); result.Predicates.AddRange(wordIndexesListsToWordChains(jsonSentence.Predicates, jsonSentence.Words)); return result; }
public static JsonSentence Convert(Sentence sentence) { var result = new JsonSentence { Words = sentence.Words.ToArray(), Text = String.Join(" ", sentence.Words.Select(word => word.Text)), SimpleSentences = wordsCahinsToIndexesLists(sentence.SimpleSentences, sentence.Words), Uniforms = wordsCahinsToIndexesLists(sentence.Uniforms, sentence.Words), ValuableAuxParts = wordsCahinsToIndexesLists(sentence.ValuableAuxParts, sentence.Words), Subjects = wordsCahinsToIndexesLists(sentence.Subjects, sentence.Words), Predicates = wordsCahinsToIndexesLists(sentence.Predicates, sentence.Words), LinkedChains = linkedChainsToJsonModel(sentence.LinkedChains, sentence.Words) }; return result; }