private void AddNewMeaning() { var vm = new EditMeaningViewModel(_projectService.Project.Meanings); if (_dialogService.ShowModalDialog(this, vm) == true) { var newMeaning = new Meaning(vm.Gloss, vm.Category); _projectService.Project.Meanings.Add(newMeaning); Messenger.Default.Send(new DomainModelChangedMessage(true)); SelectedMeaning = _meanings.Single(s => s.DomainMeaning == newMeaning); } }
public override bool Equals(object obj) { Meaning meaning = obj as Meaning; if (meaning == null) { return(false); } // Return true if the ID match return(Id == meaning.Id); }
public Meaning DeleteMeaning(int meaningID) { var db = new LangInformantDbContext(); Meaning dbEntry = db.Meanings.Find(meaningID); if (dbEntry != null) { db.Meanings.Remove(dbEntry); db.SaveChanges(); } return(dbEntry); }
private Meaning GetMeaning(int table, int index) { Meaning meaning = new Meaning { Index = int.Parse(parser.GetHtmlSpanText(string.Format(TurengHtmlXPaths.Index, table, index)).Trim()), Category = parser.GetHtmlSpanText(string.Format(TurengHtmlXPaths.Category, table, index)), Source = parser.GetHtmlSpanText(string.Format(TurengHtmlXPaths.Source, table, index)), Destination = parser.GetHtmlSpanText(string.Format(TurengHtmlXPaths.Destination, table, index)) }; return(meaning); }
private void BtnEditMeaning_Click(object sender, EventArgs e) { var selectedMeaning = meaningBindingSource.Current as Meaning; if (selectedMeaning != null) { txtMeaning.Text = selectedMeaning.MeaningWord; _Meaning = selectedMeaning; lblEditAlert2.Visible = true; btnAddMeaning.Text = "Kaydet"; } }
public void ReturnCorrectResultMessage_WhenNewMeaningIsAddedToWordSuccessfully() { // arrange var dictionariesRepository = new Mock <IRepository <Dictionary> >(); var unitOfWork = new Mock <IUnitOfWork>(); var dictionariesFactory = new Mock <IDictionariesFactory>(); string dictionaryTitle = "SomeTitle"; string wordName = "SomeName"; string newMeaning = "Some Meaning To Add"; var targetWord = new Word() { Name = wordName }; var dictionary = new Dictionary(); dictionary.Words.Add(targetWord); dictionariesRepository.Setup(x => x.All(It.IsAny <Expression <Func <Dictionary, bool> > >())) .Returns(new List <Dictionary>() { dictionary }); var meaning = new Meaning() { Description = newMeaning }; dictionariesFactory .Setup(x => x.GetMeaning(newMeaning)) .Returns(meaning); var parameters = new List <string>() { dictionaryTitle, wordName, newMeaning }; var updateWordCommad = new UpdateWordCommand(dictionariesRepository.Object, unitOfWork.Object, dictionariesFactory.Object); // act string resultMessage = updateWordCommad.Execute(parameters); // assert StringAssert.Contains(wordName, resultMessage); StringAssert.Contains("Added new meaning", resultMessage); }
protected override ReturnCode DoWork(TextReader inputReader, TextWriter outputWriter, TextWriter errorWriter) { ReturnCode retcode = ReturnCode.Okay; SetupProject(); var variety1 = new Variety("variety1"); var variety2 = new Variety("variety2"); Project.Varieties.Add(variety1); Project.Varieties.Add(variety2); Project.VarietyPairs.Add(new VarietyPair(variety1, variety2)); foreach (string line in ReadLines(inputReader)) { Meaning meaning = MeaningFactory.Create(); Project.Meanings.Add(meaning); string[] wordTexts = line.Split(' '); if (wordTexts.Length != 2) { Errors.Add(line, "Each line should have two space-separated words in it."); continue; } Word[] words = wordTexts.Select(wordText => ParseWord(wordText, meaning)).ToArray(); if (words.Length != 2 || words.Any(w => w == null)) { Errors.Add(line, "One or more of this line's words failed to parse. Successfully parsed words: {0}", string.Join(", ", words.Where(w => w != null).Select(w => w.StrRep))); continue; } variety1.Words.Add(words[0]); variety2.Words.Add(words[1]); } SegmentAll(); foreach (VarietyPair varietyPair in Project.VarietyPairs) { Compare(varietyPair); foreach (WordPair wordPair in varietyPair.WordPairs) { // Output format: "word1 word2 True/False score" where True means cognate and False means not cognate, // and score is a number between 0.0 and 1.0 outputWriter.WriteLine("{0} {1} {2} {3}", wordPair.Word1.StrRep, wordPair.Word2.StrRep, wordPair.Cognacy, wordPair.PredictedCognacyScore); } } return(retcode); }
protected override ReturnCode DoWork(TextReader inputReader, TextWriter outputWriter, TextWriter errorWriter) { ReturnCode retcode = ReturnCode.Okay; if (!RawScores && !NormalizedScores) { Warnings.Add("Neither raw scores nor normalized scores were selected. Defaulting to normalized."); RawScores = false; NormalizedScores = true; } if (RawScores && NormalizedScores) { Warnings.Add("Please specify either raw or normalized scores, but not both. Defaulting to normalized."); RawScores = false; NormalizedScores = true; } SetupProject(); Meaning meaning = MeaningFactory.Create(); IWordAligner wordAligner = Project.WordAligners["primary"]; foreach (string line in ReadLines(inputReader)) { string[] wordTexts = line.Split(' '); if (wordTexts.Length != 2) { Errors.Add(line, "Each line should have two space-separated words in it."); continue; } Word[] words = wordTexts.Select(wordText => ParseWordOnce(wordText, meaning, Project)).ToArray(); if (words.Length != 2 || words.Any(w => w == null)) { Errors.Add(line, "One or more of this line's words failed to parse. Successfully parsed words: {0}", string.Join(", ", words.Where(w => w != null).Select(w => w.StrRep))); continue; } IWordAlignerResult result = wordAligner.Compute(words[0], words[1]); Alignment <Word, ShapeNode> alignment = result.GetAlignments().First(); outputWriter.WriteLine("{0} {1} {2}", words[0].StrRep, words[1].StrRep, RawScores ? alignment.RawScore : alignment.NormalizedScore); if (Verbose) { outputWriter.Write(alignment.ToString(Enumerable.Empty <string>())); outputWriter.WriteLine(); } } return(retcode); }
public static IEnumerable <string> GetSynonyms(string word, List <string> invalid_synonyms, Microsoft.Office.Interop.Word.Application wordApp) { word = word.ToLower(); var found = new List <string>(); var theSynonyms = wordApp.get_SynonymInfo(word); foreach (var Meaning in theSynonyms.MeaningList as Array) { if (found.Count >= 4) { return(found); } var synonym = Meaning.ToString(); if (!IsSynonymTooSimilar(word, synonym, found)) { if (!invalid_synonyms.Contains(synonym)) { found.Add(synonym); } else { Debug.WriteLine("Synonym " + synonym + " was blocked because it was on the invalid list."); } } } for (int ii = 0; ii < found.Count; ii++) { theSynonyms = wordApp.SynonymInfo[found[ii]]; foreach (string synonym in theSynonyms.MeaningList as Array) { if (found.Count >= 4) { return(found); } if (IsSynonymTooSimilar(word, synonym, found)) { continue; } found.Add(synonym); } } return(found); }
public void CallDictionariesFactoryGetMeaningMethodWithValidDescriptionParameter_WhenThereIsSuchWordAndDictionaryPresent() { // arrange var dictionariesRepository = new Mock <IRepository <Dictionary> >(); var unitOfWork = new Mock <IUnitOfWork>(); var dictionariesFactory = new Mock <IDictionariesFactory>(); string dictionaryTitle = "SomeTitle"; string wordName = "SomeName"; string newMeaning = "Some Meaning To Add"; var targetWord = new Word() { Name = wordName }; var dictionary = new Dictionary(); dictionary.Words.Add(targetWord); dictionariesRepository.Setup(x => x.All(It.IsAny <Expression <Func <Dictionary, bool> > >())) .Returns(new List <Dictionary>() { dictionary }); var meaning = new Meaning() { Description = newMeaning }; dictionariesFactory .Setup(x => x.GetMeaning(newMeaning)) .Returns(meaning); var parameters = new List <string>() { dictionaryTitle, wordName, newMeaning }; var updateWordCommad = new UpdateWordCommand(dictionariesRepository.Object, unitOfWork.Object, dictionariesFactory.Object); // act updateWordCommad.Execute(parameters); // assert dictionariesFactory.Verify(x => x.GetMeaning(newMeaning), Times.Once); }
public void spawnParticles(Meaning meaning) { if (meaning.Equals(Meaning.WAR)) { warParticle.Play(); } else if (meaning.Equals(Meaning.PEACE)) { peaceParticle.Play(); } else if (meaning.Equals(Meaning.NEUTRAL)) { neutralParticle.Play(); } }
public WordPair ToWordPair(CogProject project, VarietyPair vp) { Meaning meaning = project.Meanings[Meaning]; Word word1 = vp.Variety1.Words[meaning].First(w => w.StrRep == Word1); Word word2 = vp.Variety2.Words[meaning].First(w => w.StrRep == Word2); var wp = new WordPair(word1, word2) { AreCognatePredicted = AreCognatePredicted, PhoneticSimilarityScore = PhoneticSimilarityScore, CognicityScore = CognicityScore }; wp.AlignmentNotes.AddRange(_alignmentNotes); return(wp); }
public async Task CreateMeanings(int wordId, IList <string> meanings) { foreach (string meaningContent in meanings) { Meaning meaning = new Meaning() { WordId = wordId, Content = meaningContent, CreatedOn = DateTime.Now, IsDeleted = false, }; await this.meanings.Add(meaning); } }
public ActionResult EditMeaning(Meaning meaning) { if (ModelState.IsValid) { repository.SaveMeaning(meaning); TempData["message"] = string.Format("{0} has been saved", meaning.Name); return(RedirectToAction("Index", "Home")); } else { // There is something wrong with the data values return(View(meaning)); } }
void EditMeaning() { if (_Meaning == null) { MessageBox.Show("Anlam Seçmelisiniz."); } else { _Meaning.MeaningWord = txtMeaning.Text; _Meaning = null; _meaningRepository.Update(_Meaning); btnAddMeaning.Text = "Ekle"; lblEditAlert2.Visible = false; MessageBox.Show("Anlam Düzenlendi."); } }
protected Word ParseWord(string wordText, Meaning meaning) { int stemStartIdx = wordText.IndexOf("|", StringComparison.Ordinal); int stemEndIdx = wordText.LastIndexOf("|", StringComparison.Ordinal) - 1; // -1 because we're going to remove the leading | if (stemStartIdx != -1 && stemEndIdx < stemStartIdx) { // Only way this can happen is if there was only a single "|" in the word throw new FormatException($"Words should have either 0 or 2 pipe characters representing word stems. Offending word: {wordText}"); } var word = (stemStartIdx == -1) ? new Word(wordText, meaning) : new Word(wordText.Replace("|", ""), stemStartIdx, stemEndIdx - stemStartIdx, meaning); return(word); }
public void SegmentWord() { var meaning = new Meaning("gloss", "category"); var word = new Word("called", 0, 4, meaning); _segmenter.Segment(word); Assert.That(word.Shape.Count, Is.EqualTo(6)); AssertShapeNodeEqual(word.Shape.First, "c", CogFeatureSystem.ConsonantType); AssertShapeNodeEqual(word.Shape.ElementAt(1), "a", CogFeatureSystem.VowelType); AssertShapeNodeEqual(word.Shape.ElementAt(4), "e", CogFeatureSystem.VowelType); AssertShapeNodeEqual(word.Shape.Last, "d", CogFeatureSystem.ConsonantType); Annotation<ShapeNode> stemAnn = word.Shape.Annotations.Single(a => a.Type() == CogFeatureSystem.StemType); Assert.That(stemAnn.Span, Is.EqualTo(_spanFactory.Create(word.Shape.First, word.Shape.ElementAt(3)))); Annotation<ShapeNode> suffixAnn = word.Shape.Annotations.Single(a => a.Type() == CogFeatureSystem.SuffixType); Assert.That(suffixAnn.Span, Is.EqualTo(_spanFactory.Create(word.Shape.ElementAt(4), word.Shape.Last))); }
/// <summary> /// Returns a <see cref="System.String"/> that represents this instance. /// </summary> /// <returns> /// A <see cref="System.String"/> that represents this instance. /// </returns> public override string ToString() { Func <string, object, string> f = (n, o) => string.Format(CultureInfo.InvariantCulture, "{0,40}: " + (o is byte? "0x{1:X2}" : "{1}"), n, o); var builder = new StringBuilder(); builder.AppendLine(string.Format(CultureInfo.InvariantCulture, "{0}", GetType().Name)); builder.AppendLine(f("TVR[0]", ByteOne)); builder.AppendLine(f("TVR[1]", ByteTwo)); builder.AppendLine(f("TVR[2]", ByteThree)); builder.AppendLine(f("TVR[3]", ByteFour)); builder.AppendLine(f("TVR[4]", ByteFive)); Meaning.ToString().Split(',').ForEach(x => builder.AppendLine(f("TVR", x.Trim()))); builder.AppendLine(f("Offline Approved", OfflineApproved)); return(builder.ToString()); }
public Meaning Get(string meaningWord) { if (!File.Exists(DbFile)) { return(null); } using (var cnn = SimpleDbConnection()) { cnn.Open(); Meaning result = cnn.Query <Meaning>( @"SELECT * FROM Meanings WHERE MeaningWord = @MeaningWord", new { MeaningWord = meaningWord }).FirstOrDefault(); return(result); } }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (Meaning != null) { result.AddRange(Meaning.Validate()); } if (Range != null) { result.AddRange(Range.Validate()); } return(result); }
private void UpdateBigAssDictionary(Meaning currentMeaning) { try { // When we add words, we also get their 'alternateWords' at the same time. // Those could be alternative spellings, other words with the same meaning, etc. // --> Pretty much, every word that will lead to this definition currentMeaning.AlternateWords = GetAlternateWords(currentMeaning).ToArray(); // Get definition for meaning List <Definition> definitions = GetDefinition(currentMeaning).ToList(); if (!definitions.Any()) { Messaging.Send(MessageLevel.Warn, $@"Weird, word {currentMeaning} has no definition"); return; } // Associate meaning --> definition into big ass dictionary bool added = _genericDictionary.AllWords.TryAdd(currentMeaning, definitions); if (!added) { Messaging.Send(MessageLevel.Error, $@"Could not add word {currentMeaning}"); } } catch (Exception ex) { Messaging.Send($@"Unknown error occured for word {currentMeaning}\n{ex.Message}\n{ex.StackTrace}\n\n"); } Interlocked.Increment(ref _wordsAdded); int wordsAdded = _wordsAdded; if (wordsAdded % 100 == 0) { if (_totalWordsToAdd.HasValue) { int percent = (int)(wordsAdded * 100.0 / _totalWordsToAdd); Messaging.Send(MessageLevel.Info, $@"Loading... {percent:000}% ({wordsAdded}/{_totalWordsToAdd} words loaded)"); } else { Messaging.Send(MessageLevel.Info, $@"Loading... {000}% ({wordsAdded} words loaded)"); } } }
public void SetUp() { _busyService = Substitute.For <IBusyService>(); _analysisService = Substitute.For <IAnalysisService>(); _meaning = new Meaning("gloss", "category"); _words = new ObservableList <WordViewModel> { new WordViewModel(_busyService, _analysisService, new Word("valid", _meaning)) { IsValid = true }, new WordViewModel(_busyService, _analysisService, new Word("invalid", _meaning)) { IsValid = false } }; _wordsViewModel = new WordsViewModel(_busyService, new ReadOnlyBindableList <WordViewModel>(_words)); }
public void SegmentWord() { var meaning = new Meaning("gloss", "category"); var word = new Word("called", 0, 4, meaning); _segmenter.Segment(word); Assert.That(word.Shape.Count, Is.EqualTo(6)); AssertShapeNodeEqual(word.Shape.First, "c", CogFeatureSystem.ConsonantType); AssertShapeNodeEqual(word.Shape.ElementAt(1), "a", CogFeatureSystem.VowelType); AssertShapeNodeEqual(word.Shape.ElementAt(4), "e", CogFeatureSystem.VowelType); AssertShapeNodeEqual(word.Shape.Last, "d", CogFeatureSystem.ConsonantType); Annotation <ShapeNode> stemAnn = word.Shape.Annotations.Single(a => a.Type() == CogFeatureSystem.StemType); Assert.That(stemAnn.Span, Is.EqualTo(_spanFactory.Create(word.Shape.First, word.Shape.ElementAt(3)))); Annotation <ShapeNode> suffixAnn = word.Shape.Annotations.Single(a => a.Type() == CogFeatureSystem.SuffixType); Assert.That(suffixAnn.Span, Is.EqualTo(_spanFactory.Create(word.Shape.ElementAt(4), word.Shape.Last))); }
private Word ReadSingleWord(XmlReader xmlReader, Dictionary targetDictionary) { bool isNameRead = false; bool isMeaningRead = false; bool isSpeechPartRead = false; Word word = new Word() { Dictionary = targetDictionary }; Meaning meaning = new Meaning(); while ((!isNameRead || !isMeaningRead || !isSpeechPartRead) && xmlReader.Read()) { if (xmlReader.IsStartElement() && xmlReader.Name == "name") { xmlReader.Read(); word.Name = xmlReader.Value; isNameRead = true; } if (xmlReader.IsStartElement() && xmlReader.Name == "speechPart") { xmlReader.Read(); word.SpeechPart = (SpeechPart)Enum.Parse(typeof(SpeechPart), xmlReader.Value); isSpeechPartRead = true; } if (xmlReader.IsStartElement() && xmlReader.Name == "meaning") { xmlReader.Read(); meaning.Description = xmlReader.Value; isMeaningRead = true; } } if (!isNameRead || !isMeaningRead || !isSpeechPartRead) { return(null); } word.Meanings.Add(meaning); return(word); }
private IEnumerable <string> GetAlternateWords(Meaning meaning) { const string querySameWords = @"SELECT * FROM entries e INNER JOIN headword_entries he ON he.entry_id = e.id INNER JOIN headwords h ON h.id = he.headword_id WHERE e.id = @entryId"; using (SQLiteConnection connection = new SQLiteConnection(_connectionString)) { connection.Open(); using (SQLiteCommand command = new SQLiteCommand(querySameWords, connection)) { command.Parameters.Add(new SQLiteParameter("entryId", meaning.Id)); using (SQLiteDataReader reader = command.ExecuteReader()) { while (reader.Read()) { NameValueCollection values = reader.GetValues(); string word = values.Get("headword"); // Clean stuff just in case word = HtmlToPlainText(word); if (word.Equals(meaning.Word, StringComparison.InvariantCultureIgnoreCase)) { continue; } yield return(word); } } } } }
private ObservableCollection <Meaning> ParseMeaningList(int SourceIndex, int table) { ObservableCollection <Meaning> list = new ObservableCollection <Meaning>(); for (int i = 0; list.Count != SourceIndex; i++) { int currentIndex = i + TurengHtmlXPaths.StarterXpathMeanningNumber; try { Meaning meaning = GetMeaning(table, currentIndex); list.Add(meaning); } catch { // ignored } } return(list); }
public bool CreateMeaning(WordDetail word, MeaningCreate model) { using (var ctx = new ApplicationDbContext()) { var entity = new Meaning() { WordName = word.WordName,// WordId = ctx.Words.Where(e => e.WordName == word.WordName).Select(e => e.WordId).FirstOrDefault(), Pronunciation = model.Pronunciation, Context = model.Context, Description = model.Description, RegionalDialect = (Data.Dialect)model.RegionalDialect, //CumulativeRating = null, }; ctx.Meanings.Add(entity); return(ctx.SaveChanges() == 1); } }
private IEnumerable <Meaning> GetAllWords(int limit = -1) { const string querySameWords = @"SELECT * FROM entries LIMIT @limit"; using (SQLiteConnection connection = new SQLiteConnection(_connectionString)) { connection.Open(); using (SQLiteCommand command = new SQLiteCommand(querySameWords, connection)) { command.Parameters.Add(new SQLiteParameter("limit", limit)); using (SQLiteDataReader reader = command.ExecuteReader()) { while (reader.Read()) { NameValueCollection values = reader.GetValues(); var entry = new Meaning { Id = int.Parse(values.Get("id")), Word = values.Get("entry"), AlternateWords = null, Syllable = values.Get("entry_rich"), PronounciationIpa = values.Get("pronunciation_ipa"), PronounciationSpell = values.Get("pronunciation_spell"), AudioFile = values.Get("audio_file") }; // Clean stuff just in case entry.Word = HtmlToPlainText(entry.Word); entry.Syllable = HtmlToPlainText(entry.Syllable); entry.PronounciationIpa = HtmlToPlainText(entry.PronounciationIpa); entry.PronounciationSpell = HtmlToPlainText(entry.PronounciationSpell); yield return(entry); } } } } }
public void GamePhase() { // Randomize race lastRace = Random.Range(0, 3); spaceShip.SetCurrentSprite(lastRace); // Set lastMeaning variable (that will be called by PhraseGenerator) var meanings = UtilitiesGen.GetEnumValues <Meaning>(); lastMeaning = meanings[Random.Range(0, meanings.Length - 1)]; //only war and peace intention // Get symbols and generate symbols class SymbolsEvents.ActivatePanel(PhraseEvents.GetPhrase().symbols); // Activate slider SliderEvents.SliderActivation(true); // Move space ship StartCoroutine(spaceShip.MoveToPosition(timeToReachEarth)); spaceShip.reset(); spaceShip.earthObject.GetComponent <EarthEnergyHandler>().reset(); // AUDIO if (lastRace == 0) { EventManager.Invoke(SoundManagerTopics.PlayEffect, AudioClipName.Cervelloni02); } else if (lastRace == 1) { EventManager.Invoke(SoundManagerTopics.PlayEffect, AudioClipName.RobotTalking); } else { EventManager.Invoke(SoundManagerTopics.PlayEffect, AudioClipName.Reptilian); } }
protected Word ParseWordOnce(string wordText, Meaning meaning, CogProject project) { Word word; // We expect to see a lot of duplicates in our input text; save time by memoizing if (_parsedWords.TryGetValue(wordText, out word)) { return(word); } try { word = ParseWord(wordText, meaning); } catch (FormatException e) { Errors.Add(e.Message); return(null); } project.Segmenter.Segment(word); _parsedWords.Add(wordText, word); return(word); }
private static void DebugPrintMeaning(IntentionGrid grid, Meaning meaning) { //Debug Console.WriteLine(meaning.ToString() + ": "); for (var y = 0; y < grid.Height; y++) { var str = ""; for (var x = 0; x < grid.Width; x++) { if (grid.Positions[x, y].Intentions.Any(i => i.Meaning == meaning)) { str = str + "X"; } else { str = str + "-"; } } Console.WriteLine(str); } Console.WriteLine(""); }
/// <summary> /// Uppdaterar en post i Meaning-tabellen. /// </summary> /// <param name="meaning">Meaning-objektet</param> public void UpdateMeaning(Meaning meaning) { using (var conn = CreateConnection()) { try { var cmd = new SqlCommand("appSchema.usp_UpdateMeaning", conn); cmd.Parameters.Add("@MeaningId", SqlDbType.SmallInt, 2); cmd.Parameters["@MeaningId"].Value = meaning.MeaningId; cmd.Parameters.Add("@WTypeId", SqlDbType.TinyInt, 1); cmd.Parameters["@WTypeId"].Value = meaning.WTypeId; cmd.Parameters.Add("@Word", SqlDbType.VarChar, 30); cmd.Parameters["@Word"].Value = meaning.Word; cmd.Parameters.Add("@Comment", SqlDbType.VarChar, 100); cmd.Parameters["@Comment"].Value = meaning.Comment; cmd.CommandType = CommandType.StoredProcedure; conn.Open(); cmd.ExecuteNonQuery(); } catch { throw new ApplicationException("Misslyckades med att uppdatera informationen i databasen."); } } }
public double value; // 基準との倍率 #endregion Fields #region Constructors /// <summary> /// 構造体にヒントのデータをセットします。 /// </summary> /// <param name="text">変換対象となる文字列</param> /// <param name="meaning">文字列の役割</param> /// <param name="value">基準との倍率</param> public Word(string text, Meaning meaning, double value) { this.text = text.ToCharArray(); this.length = text.Length; this.meaning = meaning; this.value = value; }
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); }