Example #1
0
 public static SoundContext ToSoundContext(this Alignment<Word, ShapeNode> alignment, SegmentPool segmentPool, int seq, int col, IEnumerable<SoundClass> soundClasses)
 {
     ShapeNode leftNode = alignment.GetLeftNode(seq, col);
     SoundClass leftEnv;
     if (leftNode == null || !soundClasses.TryGetMatchingSoundClass(segmentPool, leftNode, out leftEnv))
         leftEnv = null;
     Ngram<Segment> target = alignment[seq, col].ToNgram(segmentPool);
     ShapeNode rightNode = alignment.GetRightNode(seq, col);
     SoundClass rightEnv;
     if (rightNode == null || !soundClasses.TryGetMatchingSoundClass(segmentPool, rightNode, out rightEnv))
         rightEnv = null;
     return new SoundContext(leftEnv, target, rightEnv);
 }
Example #2
0
 public static SoundContext ToSoundContext(this ShapeNode node, SegmentPool segmentPool, IEnumerable<SoundClass> soundClasses)
 {
     ShapeNode prevNode = node.GetPrev(NodeFilter);
     SoundClass leftEnv;
     if (!soundClasses.TryGetMatchingSoundClass(segmentPool, prevNode, out leftEnv))
         leftEnv = null;
     ShapeNode nextNode = node.GetNext(NodeFilter);
     SoundClass rightEnv;
     if (!soundClasses.TryGetMatchingSoundClass(segmentPool, nextNode, out rightEnv))
         rightEnv = null;
     return new SoundContext(leftEnv, segmentPool.Get(node), rightEnv);
 }