private void MergeNodes(List <WordNodePair> list, string treePos)
        {
            var parent = new ParseNodeDrawable(new Symbol(treePos));

            if (!AllSame(list))
            {
                foreach (var wordNodePair in list)
                {
                    if (!ContainsChild(parent, wordNodePair.GetNode()))
                    {
                        parent.AddChild(GetParent(wordNodePair.GetNode()));
                    }
                }
            }
        }
 public ParseTree.ParseTree Convert(AnnotatedSentence.AnnotatedSentence annotatedSentence, List <TreeEnsembleModel> models)
 {
     try {
         var wordNodePairs = ConstructWordPairList(annotatedSentence, annotatedSentence.GetFileName());
         var dependencyMap = SetDependencyMap(wordNodePairs);
         if (wordNodePairs.Count > 1)
         {
             return(ConstructTreeFromWords(wordNodePairs, dependencyMap, models));
         }
         else
         {
             var parent = new ParseNodeDrawable(new Symbol("S"));
             parent.AddChild(wordNodePairs[0].GetNode());
             return(new ParseTree.ParseTree(parent));
         }
     } catch (Exception e) {
         if (e is UniversalDependencyNotExistsException || e is NonProjectiveDependencyException || e is MorphologicalAnalysisNotExistsException)
         {
             Console.WriteLine(e.ToString());
         }
     }
     return(null);
 }