Beispiel #1
0
		public void BasicIPASymbolSetsDescription()
		{
			CheckDisposed();

			// initialize local variables
			bool fJustChangedDescription = false;
			XmlDocument myIPAMapperDocument = InitBasicIPAXMlMapperDocument();
			const string ksPEnglishDescription = "Voiceless bilabial plosive";
			const string ksPSpanishDescription = "Plosivo bilabial sordo";

			// create a new phoneme
			IPhPhoneme phone = new PhPhoneme();
			IPhPhonemeSet ps = Cache.LangProject.PhonologicalDataOA.PhonemeSetsOS.Append(new PhPhonemeSet());
			ps.PhonemesOC.Add(phone);


			//Put an unknown value in BasicIPASymbol
			phone.BasicIPASymbol.Text = "Nonexistent";
			// description is blank, so we should get the value from the mapper file
			fJustChangedDescription = phone.SetDescriptionBasedOnIPA(myIPAMapperDocument, fJustChangedDescription);
			CheckPhonemeDescriptionNewValues(phone, null, null, "description is blank, but there is nothing in the file for this symbol");
			Assert.IsFalse(fJustChangedDescription, "We did not change the description");

			//Put a known value in BasicIPASymbol
			phone.BasicIPASymbol.Text = "q";
			// description is blank, so we should get the value from the mapper file
			fJustChangedDescription = phone.SetDescriptionBasedOnIPA(myIPAMapperDocument, fJustChangedDescription);
			CheckPhonemeDescriptionNewValues(phone, "Voiceless uvular plosive", "Plosivo uvular sordo", "description is blank, so we should get the value from the mapper file");
			Assert.IsTrue(fJustChangedDescription, "We did just change the description");

			//Change value of symbol
			phone.BasicIPASymbol.Text = "p";
			// we have just changed it, so we should get the new value from the mapper file
			fJustChangedDescription = phone.SetDescriptionBasedOnIPA(myIPAMapperDocument, fJustChangedDescription);
			CheckPhonemeDescriptionNewValues(phone, ksPEnglishDescription, ksPSpanishDescription,"basic ipa symbol changed while still 'editting', so we should get the value from the mapper file");
			Assert.IsTrue(fJustChangedDescription, "We did just change the description");

			phone.BasicIPASymbol.Text = "q";
			// description is already set, so should not change.
			fJustChangedDescription = phone.SetDescriptionBasedOnIPA(myIPAMapperDocument, false);
			CheckPhonemeDescriptionNewValues(phone, ksPEnglishDescription, ksPSpanishDescription, "descriptions should not change");
			Assert.IsFalse(fJustChangedDescription, "We did not just change the description");

			// Set basicIPASymbol to blank
			phone.BasicIPASymbol.Text = "";
			// now the description should become blank
			fJustChangedDescription = phone.SetDescriptionBasedOnIPA(myIPAMapperDocument, true);
			CheckPhonemeDescriptionNewValues(phone, null, null, "description should be blank now");
			Assert.IsTrue(fJustChangedDescription, "We did just change the description");
		}
Beispiel #2
0
		public void BasicIPASymbolSetsFeatures()
		{
			CheckDisposed();

			const string ksConsonantal = "fPAConsonantal";
			const string ksConsonantalPositive = "vPAConsonantalPositive";
			const string ksConsonantalNegative = "vPAConsonantalNegative";
			const string ksSonorant = "fPASonorant";
			const string ksSonorantPositive = "vPASonorantPositive";
			const string ksSonorantNegative = "vPASonorantNegative";
			const string ksSyllabic = "fPASyllabic";
			const string ksSyllabicPositive = "vPASyllabicPositive";
			const string ksSyllabicNegative = "vPASyllabicNegative";

			// initialize local variables
			bool fJustChangedFeatures = false;
			XmlDocument myIPAMapperDocument = InitBasicIPAXMlMapperDocument();

			// create a new phoneme
			IPhPhoneme phone = new PhPhoneme();
			IPhPhonemeSet ps = Cache.LangProject.PhonologicalDataOA.PhonemeSetsOS.Append(new PhPhonemeSet());
			ps.PhonemesOC.Add(phone);

			//Put a known value in BasicIPASymbol
			phone.BasicIPASymbol.Text = "b";
			// no phonological features in system, so nothing should be added to phone.FeaturesOA
			fJustChangedFeatures = phone.SetFeaturesBasedOnIPA(myIPAMapperDocument, false);
			Assert.IsNull(phone.FeaturesOA, "no features in system, so adding doesn't do anything");
			Assert.IsFalse(fJustChangedFeatures, "We did not change any features");

			// Add some features to feature system
			IFsFeatureSystem featSystem = new FsFeatureSystem();
			Cache.LangProject.PhFeatureSystemOA = featSystem;
			XmlDocument phonFeatList = new XmlDocument();
			string sXmlFile = Path.Combine(DirectoryFinder.FWCodeDirectory, @"Language Explorer\MGA\GlossLists\PhonFeatsEticGlossList.xml");
			phonFeatList.Load(sXmlFile);
			CreateNewPhonFeature(featSystem, phonFeatList, ksConsonantal);
			CreateNewPhonFeature(featSystem, phonFeatList, ksSonorant);
			CreateNewPhonFeature(featSystem, phonFeatList, ksSyllabic);

			// now we should get some features
			fJustChangedFeatures = phone.SetFeaturesBasedOnIPA(myIPAMapperDocument, false);
			Assert.IsNotNull(phone.FeaturesOA, "have something now");
			Assert.AreEqual(3, phone.FeaturesOA.FeatureSpecsOC.Count, "expect three features to be added");
			CheckFeatureValues(phone, ksConsonantal, ksConsonantalPositive, ksSonorant, ksSonorantNegative, ksSyllabic, ksSyllabicNegative);
			Assert.IsTrue(fJustChangedFeatures, "We just did change features");


			//Change value of symbol
			phone.BasicIPASymbol.Text = "a";
			// we have just changed it, so we should get the new value from the mapper file
			fJustChangedFeatures = phone.SetFeaturesBasedOnIPA(myIPAMapperDocument, true);
			Assert.IsNotNull(phone.FeaturesOA, "have something now");
			Assert.AreEqual(3, phone.FeaturesOA.FeatureSpecsOC.Count, "expect three features to be added");
			CheckFeatureValues(phone, ksConsonantal, ksConsonantalNegative, ksSonorant, ksSonorantPositive, ksSyllabic, ksSyllabicPositive);
			Assert.IsTrue(fJustChangedFeatures, "We did just change the description");

			// Set basicIPASymbol to blank
			phone.BasicIPASymbol.Text = "";
			// now the description should become blank
			fJustChangedFeatures = phone.SetFeaturesBasedOnIPA(myIPAMapperDocument, true);
			Assert.IsNull(phone.FeaturesOA, "no features in system, so adding doesn't do anything");
			Assert.IsTrue(fJustChangedFeatures, "We did just change the description");
		}
Beispiel #3
0
		public void CreatePhPhonemeWithPhCode()
		{
			CheckDisposed();

			IPhPhoneme phone = new PhPhoneme();
			IPhPhonemeSet ps = Cache.LangProject.PhonologicalDataOA.PhonemeSetsOS.Append(new PhPhonemeSet());
			ps.PhonemesOC.Add(phone);
			Assert.IsTrue((phone.CodesOS != null) && (phone.CodesOS.Count > 0), "PhPhoneme should have at least one PhCode");
		}