public override void Setup()
        {
            CogProject project = _projectService.Project;
            ICognateIdentifier cognateIdentifier = project.CognateIdentifiers[ComponentIdentifiers.PrimaryCognateIdentifier];
            var dolgopolsky = cognateIdentifier as DolgopolskyCognateIdentifier;

            IEnumerable<SoundClass> soundClasses;
            if (dolgopolsky == null)
            {
                Set(() => InitialEquivalenceThreshold, ref _initialEquivalenceThreshold, 2);
                soundClasses = new SoundClass[]
                    {
                        new UnnaturalClass("K", new[] {"t͡s", "d͡z", "t͡ɕ", "d͡ʑ", "t͡ʃ", "d͡ʒ", "c", "ɟ", "t͡θ", "t͡ʂ", "d͡ʐ", "k", "g", "q", "ɢ", "ɡ", "ɠ", "x", "ɣ", "χ"}, true, project.Segmenter),
                        new UnnaturalClass("P", new[] {"ɸ", "β", "f", "p͡f", "p", "b", "ɓ"}, true, project.Segmenter),
                        new UnnaturalClass("Ø", new[] {"ʔ", "ħ", "ʕ", "h", "ɦ", "-", "#ŋ"}, true, project.Segmenter),
                        new UnnaturalClass("J", new[] {"j", "ɥ", "ɰ"}, true, project.Segmenter),
                        new UnnaturalClass("M", new[] {"m", "ɱ", "ʍ"}, true, project.Segmenter),
             						new UnnaturalClass("N", new[] {"n", "ɳ", "ŋ", "ɴ", "ɲ"}, true, project.Segmenter),
             						new UnnaturalClass("S", new[] {"s", "z", "ʃ", "ʒ", "ʂ", "ʐ", "ç", "ʝ", "ɕ", "ʑ", "ɧ"}, true, project.Segmenter),
                        new UnnaturalClass("R", new[] {"ɹ", "ɻ", "ʀ", "ɾ", "r", "ʁ", "ɽ", "l", "ɭ", "ʎ", "ʟ", "ɬ", "ɮ", "ɫ", "ł"}, true, project.Segmenter),
                        new UnnaturalClass("T", new[] {"t", "d", "ɗ", "ʈ", "ɖ", "θ", "ð"}, true, project.Segmenter),
             						new UnnaturalClass("W", new[] {"w", "ʋ", "v", "ʙ"}, true, project.Segmenter)
                    };
            }
            else
            {
                Set(() => InitialEquivalenceThreshold, ref _initialEquivalenceThreshold, dolgopolsky.InitialEquivalenceThreshold);
                soundClasses = dolgopolsky.SoundClasses;
            }

            _soundClasses.SelectedSoundClass = null;
            _soundClasses.SoundClasses.Clear();
            foreach (SoundClass soundClass in soundClasses)
                _soundClasses.SoundClasses.Add(new SoundClassViewModel(soundClass));
        }
        public override void Setup()
        {
            CogProject project = _projectService.Project;
            ICognateIdentifier cognateIdentifier = project.CognateIdentifiers[ComponentIdentifiers.PrimaryCognateIdentifier];
            var sca = cognateIdentifier as SCACognateIdentifier;

            if (sca == null)
            {
                Set(() => InitialEquivalenceThreshold, ref _initialEquivalenceThreshold, 2);
            }
            else
            {
                Set(() => InitialEquivalenceThreshold, ref _initialEquivalenceThreshold, sca.InitialEquivalenceThreshold);
            }

            // TODO: these are non-editable (1: reflect that in the UI) because there is a built-in matrix for these for SCA alignment
            IEnumerable<SoundClass> soundClasses;
            soundClasses = new SoundClass[]
                    {
                        new UnnaturalClass("A", new[] {"a", "ᴀ", "ã", "ɑ", "á", "à", "ā", "ǎ", "â"}, true, project.Segmenter, 0),
                        new UnnaturalClass("B", new[] {"ɸ", "β", "f", "p͡f", "ƀ", "v", "ʙ"}, true, project.Segmenter, 1),
                        new UnnaturalClass("C", new[] {"t͡s", "d͡z", "ʦ", "ʣ", "t͡ɕ", "d͡ʑ", "ʨ", "ʥ", "t͡ʃ", "d͡ʒ", "ʧ", "ʤ", "c", "ɟ", "t͡ʂ", "d͡ʐ", "č", "ž", "t͡θ", "ʄ"}, true, project.Segmenter, 2),
                        new UnnaturalClass("D", new[] {"θ", "ð", "ŧ", "þ", "đ"}, true, project.Segmenter, 3),
                        new UnnaturalClass("E", new[] {"ɛ", "æ", "ɜ", "ɐ", "ʌ", "e", "ᴇ", "ə", "ɘ", "ɤ", "è", "é", "ē", "ě", "ê", "ɚ", "ǝ", "ẽ"}, true, project.Segmenter, 4),
                        new UnnaturalClass("G", new[] {"x", "ɣ", "χ"}, true, project.Segmenter, 5),
                        new UnnaturalClass("H", new[] {"ʔ", "ħ", "ʕ", "h", "ɦ"}, true, project.Segmenter, 6),
                        new UnnaturalClass("I", new[] {"i", "ɪ", "ɨ", "ɿ", "ʅ", "ɯ", "ĩ", "í", "ǐ", "ì", "î", "ī", "ı"}, true, project.Segmenter, 7),
                        new UnnaturalClass("J", new[] {"j", "ɥ", "ɰ"}, true, project.Segmenter, 8),
                        new UnnaturalClass("K", new[] {"k", "g", "q", "ɢ", "ɡ"}, true, project.Segmenter, 9),
                        new UnnaturalClass("L", new[] {"l", "ȴ", "l", "ɭ", "ʎ", "ʟ", "ɬ", "ɮ", "ł", "ɫ"}, true, project.Segmenter,10),
                        new UnnaturalClass("M", new[] {"m", "ɱ", "ʍ"}, true, project.Segmenter, 11),
                        new UnnaturalClass("N", new[] {"n", "ȵ", "ɳ", "ŋ", "ɴ", "ň", "ń", "ɲ"}, true, project.Segmenter, 12),
                        new UnnaturalClass("O", new[] {"Œ", "ɒ"}, true, project.Segmenter, 13),
                        new UnnaturalClass("P", new[] {"p", "b", "ɓ"}, true, project.Segmenter, 14),
                        new UnnaturalClass("R", new[] {"ɹ", "ɻ", "ʀ", "ɾ", "r", "ʁ", "ɽ", "ɐ̯"}, true, project.Segmenter, 15),
                        new UnnaturalClass("S", new[] {"s", "z", "ʃ", "ʒ", "ʂ", "ʐ", "ç", "ʝ", "š", "ž", "ɕ", "ɧ", "ʑ"}, true, project.Segmenter, 16),
                        new UnnaturalClass("T", new[] {"t", "d", "ȶ", "ȡ", "ɗ", "ʈ", "ɖ"}, true, project.Segmenter, 17),
                        new UnnaturalClass("U", new[] {"œ", "ɞ", "ɔ", "ø", "ɵ", "o", "õ", "ó", "ò", "ō", "ɶ", "ô", "ɷ"}, true, project.Segmenter, 18),
                        new UnnaturalClass("W", new[] {"w", "ʋ", "ⱱ"}, true, project.Segmenter, 19),
                        new UnnaturalClass("Y", new[] {"y", "ʏ", "ʉ", "u", "ᴜ", "ʊ", "ú", "ù"}, true, project.Segmenter, 20),
                    };

            _soundClasses.SelectedSoundClass = null;
            _soundClasses.SoundClasses.Clear();
            foreach (SoundClass soundClass in soundClasses)
                _soundClasses.SoundClasses.Add(new SoundClassViewModel(soundClass));
        }
예제 #3
0
 protected EditSoundClassViewModel(string title, IEnumerable<SoundClass> soundClasses, SoundClass soundClass)
 {
     _title = title;
     _name = soundClass.Name;
     _soundClassNames = new HashSet<string>(soundClasses.Where(nc => nc != soundClass).Select(nc => nc.Name));
 }
예제 #4
0
        public static bool TryGetMatchingSoundClass(this IEnumerable<SoundClass> soundClasses, SegmentPool segmentPool, ShapeNode node, out SoundClass soundClass)
        {
            Annotation<ShapeNode> stemAnn = ((Shape) node.List).Annotations.First(ann => ann.Type() == CogFeatureSystem.StemType);
            ShapeNode left = null;
            if (stemAnn.Span.Contains(node) || node.Annotation.CompareTo(stemAnn) > 0)
            {
                ShapeNode leftNode = node.GetPrev(NodeFilter);
                if (leftNode != null)
                    left = stemAnn.Span.Contains(leftNode) ? leftNode : node.List.Begin;
            }

            Ngram<Segment> target = stemAnn.Span.Contains(node) ? segmentPool.Get(node) : Segment.Anchor;

            ShapeNode right = null;
            if (stemAnn.Span.Contains(node) || node.Annotation.CompareTo(stemAnn) < 0)
            {
                ShapeNode rightNode = node.GetNext(NodeFilter);
                if (rightNode != null)
                    right = stemAnn.Span.Contains(rightNode) ? rightNode : node.List.End;
            }

            soundClass = soundClasses.FirstOrDefault(sc => sc.Matches(left, target, right));
            return soundClass != null;
        }
예제 #5
0
 public static bool TryGetMatchingSoundClass(this IEnumerable<SoundClass> soundClasses, SegmentPool segmentPool, Alignment<Word, ShapeNode> alignment, int seq, int col, out SoundClass soundClass)
 {
     ShapeNode leftNode = alignment.GetLeftNode(seq, col);
     Ngram<Segment> target = alignment[seq, col].ToNgram(segmentPool);
     ShapeNode rightNode = alignment.GetRightNode(seq, col);
     soundClass = soundClasses.FirstOrDefault(sc => sc.Matches(leftNode, target, rightNode));
     return soundClass != null;
 }
예제 #6
0
 public SoundClassViewModel(SoundClass soundClass)
     : this(soundClass, -1)
 {
 }
예제 #7
0
 public SoundClassViewModel(SoundClass soundClass, int sonority)
 {
     _soundClass = soundClass;
     _sonority = sonority;
 }
예제 #8
0
        public static bool TryGetMatchingSoundClass(this IEnumerable <SoundClass> soundClasses, SegmentPool segmentPool, Alignment <Word, ShapeNode> alignment, int seq, int col, out SoundClass soundClass)
        {
            ShapeNode       leftNode  = alignment.GetLeftNode(seq, col);
            Ngram <Segment> target    = alignment[seq, col].ToNgram(segmentPool);
            ShapeNode       rightNode = alignment.GetRightNode(seq, col);

            soundClass = soundClasses.FirstOrDefault(sc => sc.Matches(leftNode, target, rightNode));
            return(soundClass != null);
        }
예제 #9
0
        public static bool TryGetMatchingSoundClass(this IEnumerable <SoundClass> soundClasses, SegmentPool segmentPool, ShapeNode node, out SoundClass soundClass)
        {
            Annotation <ShapeNode> stemAnn = ((Shape)node.List).Annotations.First(ann => ann.Type() == CogFeatureSystem.StemType);
            ShapeNode left = null;

            if (stemAnn.Range.Contains(node) || node.Annotation.CompareTo(stemAnn) > 0)
            {
                ShapeNode leftNode = node.GetPrev(NodeFilter);
                if (leftNode != null)
                {
                    left = stemAnn.Range.Contains(leftNode) ? leftNode : node.List.Begin;
                }
            }

            Ngram <Segment> target = stemAnn.Range.Contains(node) ? segmentPool.Get(node) : Segment.Anchor;

            ShapeNode right = null;

            if (stemAnn.Range.Contains(node) || node.Annotation.CompareTo(stemAnn) < 0)
            {
                ShapeNode rightNode = node.GetNext(NodeFilter);
                if (rightNode != null)
                {
                    right = stemAnn.Range.Contains(rightNode) ? rightNode : node.List.End;
                }
            }

            soundClass = soundClasses.FirstOrDefault(sc => sc.Matches(left, target, right));
            return(soundClass != null);
        }
예제 #10
0
 public SoundContext(SoundClass leftEnv, Ngram <Segment> target, SoundClass rightEnv)
 {
     _leftEnv  = leftEnv;
     _target   = target;
     _rightEnv = rightEnv;
 }
예제 #11
0
 public SoundContext(Ngram <Segment> target, SoundClass rightEnv)
     : this(null, target, rightEnv)
 {
 }
예제 #12
0
 public SoundContext(SoundClass leftEnv, Ngram <Segment> target)
     : this(leftEnv, target, null)
 {
 }