예제 #1
0
        public override object UpdateComponent()
        {
            SimpleSyllabifier syllabifier = _automaticSyllabificationEnabled
                                ? new SspSyllabifier(_combineVowels, _combineConsonants, _vowelsSameSonorityTautosyllabic, _segmentPool, _sonorityClasses.SoundClasses.Select(sc => new SonorityClass(sc.Sonority, sc.DomainSoundClass)))
                                : new SimpleSyllabifier(_combineVowels, _combineConsonants);

            _projectService.Project.VarietyProcessors[ComponentIdentifiers.Syllabifier] = syllabifier;

            _analysisService.SegmentAll();
            return(syllabifier);
        }
예제 #2
0
        public void Migrate_SimpleSyllabifier_SimpleSyllabifierNotUpdated()
        {
            var syllabifier = new SimpleSyllabifier(true, true);

            _project.VarietyProcessors[ComponentIdentifiers.Syllabifier] = syllabifier;

            var pm = new ProjectMigration4();

            pm.Migrate(_segmentPool, _project);
            Assert.That(_project.VarietyProcessors[ComponentIdentifiers.Syllabifier], Is.EqualTo(syllabifier));
        }
예제 #3
0
        public void SetUp()
        {
            _featSys = new FeatureSystem
            {
                new SymbolicFeature("place",
                    new FeatureSymbol("bilabial"),
                    new FeatureSymbol("labiodental"),
                    new FeatureSymbol("dental"),
                    new FeatureSymbol("alveolar"),
                    new FeatureSymbol("retroflex"),
                    new FeatureSymbol("palato-alveolar"),
                    new FeatureSymbol("palatal"),
                    new FeatureSymbol("velar"),
                    new FeatureSymbol("uvular"),
                    new FeatureSymbol("pharyngeal"),
                    new FeatureSymbol("glottal")),
                new SymbolicFeature("manner",
                    new FeatureSymbol("stop"),
                    new FeatureSymbol("affricate"),
                    new FeatureSymbol("fricative"),
                    new FeatureSymbol("approximant"),
                    new FeatureSymbol("trill"),
                    new FeatureSymbol("flap"),
                    new FeatureSymbol("close-vowel"),
                    new FeatureSymbol("mid-vowel"),
                    new FeatureSymbol("open-vowel")),
                new SymbolicFeature("voice",
                    new FeatureSymbol("voice+"),
                    new FeatureSymbol("voice-")),
                new SymbolicFeature("height",
                    new FeatureSymbol("close"),
                    new FeatureSymbol("near-close"),
                    new FeatureSymbol("close-mid"),
                    new FeatureSymbol("mid"),
                    new FeatureSymbol("open-mid"),
                    new FeatureSymbol("near-open"),
                    new FeatureSymbol("open")),
                new SymbolicFeature("backness",
                    new FeatureSymbol("front"),
                    new FeatureSymbol("near-front"),
                    new FeatureSymbol("central"),
                    new FeatureSymbol("near-back"),
                    new FeatureSymbol("back")),
                new SymbolicFeature("round",
                    new FeatureSymbol("round+"),
                    new FeatureSymbol("round-"))
            };

            _segmentPool = new SegmentPool();
            _segmenter = new Segmenter(_spanFactory)
                {
                    Consonants =
                    {
                        {"c", FeatureStruct.New(_featSys).Symbol("palatal").Symbol("stop").Symbol("voice-").Value},
                        {"b", FeatureStruct.New(_featSys).Symbol("bilabial").Symbol("stop").Symbol("voice+").Value},
                        {"r", FeatureStruct.New(_featSys).Symbol("alveolar").Symbol("trill").Symbol("voice+").Value}
                    },
                    Vowels =
                    {
                        {"a", FeatureStruct.New(_featSys).Symbol("open").Symbol("front").Symbol("round-").Symbol("open-vowel").Symbol("voice+").Value}
                    },
                    Boundaries = {"-"},
                    Modifiers = {"\u0303", "\u0308"},
                    Joiners = {"\u0361"}
                };

            var syllabifier = new SimpleSyllabifier(false, false);

            var meaning = new Meaning("test", null);
            var v1 = new Variety("variety1");
            _word1 = new Word("car", meaning);
            _segmenter.Segment(_word1);
            v1.Words.Add(_word1);

            syllabifier.Process(v1);

            var v2 = new Variety("variety2");
            _word2 = new Word("bar", meaning);
            _segmenter.Segment(_word2);
            v2.Words.Add(_word2);

            syllabifier.Process(v2);

            var vp = new VarietyPair(v1, v2);
            vp.SoundChangeFrequencyDistribution = new ConditionalFrequencyDistribution<SoundContext, Ngram<Segment>>();
            vp.SoundChangeFrequencyDistribution[_word1.Shape.First.ToSoundContext(_segmentPool, Enumerable.Empty<SoundClass>())].Increment(_segmentPool.Get(_word2.Shape.First));
            vp.SoundChangeProbabilityDistribution = new ConditionalProbabilityDistribution<SoundContext, Ngram<Segment>>(vp.SoundChangeFrequencyDistribution,
                (sc, fd) => new MaxLikelihoodProbabilityDistribution<Ngram<Segment>>(fd));
            v1.VarietyPairs.VarietyPairAdded(vp);
            v2.VarietyPairs.VarietyPairAdded(vp);
        }
예제 #4
0
        public void Migrate_SimpleSyllabifier_SimpleSyllabifierNotUpdated()
        {
            var syllabifier = new SimpleSyllabifier(true, true);
            _project.VarietyProcessors[ComponentIdentifiers.Syllabifier] = syllabifier;

            var pm = new ProjectMigration4();
            pm.Migrate(_segmentPool, _project);
            Assert.That(_project.VarietyProcessors[ComponentIdentifiers.Syllabifier], Is.EqualTo(syllabifier));
        }
예제 #5
0
        public void SetUp()
        {
            _featSys = new FeatureSystem
            {
                new SymbolicFeature("place",
                                    new FeatureSymbol("bilabial"),
                                    new FeatureSymbol("labiodental"),
                                    new FeatureSymbol("dental"),
                                    new FeatureSymbol("alveolar"),
                                    new FeatureSymbol("retroflex"),
                                    new FeatureSymbol("palato-alveolar"),
                                    new FeatureSymbol("palatal"),
                                    new FeatureSymbol("velar"),
                                    new FeatureSymbol("uvular"),
                                    new FeatureSymbol("pharyngeal"),
                                    new FeatureSymbol("glottal")),
                new SymbolicFeature("manner",
                                    new FeatureSymbol("stop"),
                                    new FeatureSymbol("affricate"),
                                    new FeatureSymbol("fricative"),
                                    new FeatureSymbol("approximant"),
                                    new FeatureSymbol("trill"),
                                    new FeatureSymbol("flap"),
                                    new FeatureSymbol("close-vowel"),
                                    new FeatureSymbol("mid-vowel"),
                                    new FeatureSymbol("open-vowel")),
                new SymbolicFeature("voice",
                                    new FeatureSymbol("voice+"),
                                    new FeatureSymbol("voice-")),
                new SymbolicFeature("height",
                                    new FeatureSymbol("close"),
                                    new FeatureSymbol("near-close"),
                                    new FeatureSymbol("close-mid"),
                                    new FeatureSymbol("mid"),
                                    new FeatureSymbol("open-mid"),
                                    new FeatureSymbol("near-open"),
                                    new FeatureSymbol("open")),
                new SymbolicFeature("backness",
                                    new FeatureSymbol("front"),
                                    new FeatureSymbol("near-front"),
                                    new FeatureSymbol("central"),
                                    new FeatureSymbol("near-back"),
                                    new FeatureSymbol("back")),
                new SymbolicFeature("round",
                                    new FeatureSymbol("round+"),
                                    new FeatureSymbol("round-"))
            };

            _segmentPool = new SegmentPool();
            _segmenter   = new Segmenter(_spanFactory)
            {
                Consonants =
                {
                    { "c", FeatureStruct.New(_featSys).Symbol("palatal").Symbol("stop").Symbol("voice-").Value   },
                    { "b", FeatureStruct.New(_featSys).Symbol("bilabial").Symbol("stop").Symbol("voice+").Value  },
                    { "r", FeatureStruct.New(_featSys).Symbol("alveolar").Symbol("trill").Symbol("voice+").Value }
                },
                Vowels =
                {
                    { "a", FeatureStruct.New(_featSys).Symbol("open").Symbol("front").Symbol("round-").Symbol("open-vowel").Symbol("voice+").Value }
                },
                Boundaries = { "-" },
                Modifiers  = { "\u0303", "\u0308" },
                Joiners    = { "\u0361" }
            };

            var syllabifier = new SimpleSyllabifier(false, false);

            var meaning = new Meaning("test", null);
            var v1      = new Variety("variety1");

            _word1 = new Word("car", meaning);
            _segmenter.Segment(_word1);
            v1.Words.Add(_word1);

            syllabifier.Process(v1);

            var v2 = new Variety("variety2");

            _word2 = new Word("bar", meaning);
            _segmenter.Segment(_word2);
            v2.Words.Add(_word2);

            syllabifier.Process(v2);

            var vp = new VarietyPair(v1, v2);

            vp.CognateSoundCorrespondenceFrequencyDistribution = new ConditionalFrequencyDistribution <SoundContext, Ngram <Segment> >();
            vp.CognateSoundCorrespondenceFrequencyDistribution[_word1.Shape.First.ToSoundContext(_segmentPool, Enumerable.Empty <SoundClass>())].Increment(_segmentPool.Get(_word2.Shape.First));
            vp.CognateSoundCorrespondenceProbabilityDistribution = new ConditionalProbabilityDistribution <SoundContext, Ngram <Segment> >(vp.CognateSoundCorrespondenceFrequencyDistribution,
                                                                                                                                           (sc, fd) => new MaxLikelihoodProbabilityDistribution <Ngram <Segment> >(fd));
            v1.VarietyPairs.VarietyPairAdded(vp);
            v2.VarietyPairs.VarietyPairAdded(vp);
        }