/** * Turn a list of lattice node clusters into a Sausage object. * * @param clusters the list of node clusters in topologically correct order * @return the Sausage corresponding to the cluster list */ protected Sausage sausageFromClusters(List <Cluster> clusters) { Sausage sausage = new Sausage(clusters.Count); int index = 0; foreach (Cluster cluster in clusters) { HashSet <String> seenWords = new HashSet <String>(); foreach (Node node in cluster) { Word word = node.getWord(); if (seenWords.Contains(word.getSpelling())) { continue; } seenWords.Add(word.getSpelling()); WordResult swr = new WordResult( node, wordSubClusterProbability( cluster, word.getSpelling())); sausage.addWordHypothesis(index, swr); } index++; } sausage.fillInBlanks(); return(sausage); }
public void Add(WordResult wr) { _path.Add(wr); }