示例#1
0
		public void SetGetSingleTsString()
		{
			CheckDisposed();

			m_inMemoryCache.InitializeLexDb();

			int[] morphTypeHVOs = Cache.LangProject.LexDbOA.MorphTypesOA.PossibilitiesOS.HvoArray;
			MoMorphType mmt = new MoMorphType(Cache, morphTypeHVOs[0]);

			// TEST WRITE
			mmt.Prefix = "*";

			// TEST READ
			Assert.AreEqual("*", mmt.Prefix);
		}
示例#2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes the attributes for a MoMorphType
		/// </summary>
		/// <param name="guid"></param>
		/// <param name="prefix"></param>
		/// <param name="postfix"></param>
		/// <param name="secondaryOrder"></param>
		/// <param name="morphType"></param>
		/// ------------------------------------------------------------------------------------
		private void InitMorphType(Guid guid, string prefix, string postfix, int secondaryOrder,
			MoMorphType morphType)
		{
			m_cacheBase.SetGuid(morphType.Hvo, (int)CmObjectFields.kflidCmObject_Guid, guid);
			morphType.Prefix = prefix;
			morphType.Postfix = postfix;
			morphType.SecondaryOrder = secondaryOrder;
		}
示例#3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="lexDb"></param>
		/// ------------------------------------------------------------------------------------
		private void AddMorphTypes(LexDb lexDb)
		{
			int hvoMorphTypesList = m_cacheBase.NewHvo(CmPossibilityList.kClassId);
			lexDb.MorphTypesOAHvo = hvoMorphTypesList;
			CmPossibilityList morphTypesList = new CmPossibilityList(Cache, hvoMorphTypesList);

			for (int i = 1; i <= MoMorphTypeCollection.kmtLimit; i++)
			{
				int hvoMorphType = m_cacheBase.NewHvo(MoMorphType.kClassId);
				MoMorphType morphType = new MoMorphType(Cache, hvoMorphType);
				switch (i)
				{
					case 1:
						InitMorphType(new Guid(MoMorphType.kguidMorphBoundRoot), "*", null, 2, morphType);
						break;
					case 2:
						InitMorphType(new Guid(MoMorphType.kguidMorphBoundStem), "*", null, 2, morphType);
						break;
					case 3:
						InitMorphType(new Guid(MoMorphType.kguidMorphCircumfix), null, null, 1, morphType);
						break;
					case 4:
						InitMorphType(new Guid(MoMorphType.kguidMorphEnclitic), "=", null, 7, morphType);
						break;
					case 5:
						InitMorphType(new Guid(MoMorphType.kguidMorphInfix), "-", "-", 5, morphType);
						break;
					case 6:
						InitMorphType(new Guid(MoMorphType.kguidMorphParticle), null, null, 1, morphType);
						break;
					case 7:
						InitMorphType(new Guid(MoMorphType.kguidMorphPrefix), null, "-", 3, morphType);
						break;
					case 8:
						InitMorphType(new Guid(MoMorphType.kguidMorphProclitic), null, "=", 4, morphType);
						break;
					case 9:
						InitMorphType(new Guid(MoMorphType.kguidMorphRoot), null, null, 1, morphType);
						break;
					case 10:
						InitMorphType(new Guid(MoMorphType.kguidMorphSimulfix), "=", "=", 5, morphType);
						break;
					case 11:
						InitMorphType(new Guid(MoMorphType.kguidMorphStem), null, null, 1, morphType);
						break;
					case 12:
						InitMorphType(new Guid(MoMorphType.kguidMorphSuffix), "-", null, 6, morphType);
						break;
					case 13:
						InitMorphType(new Guid(MoMorphType.kguidMorphSuprafix), "~", "~", 5, morphType);
						break;
					case 14:
						InitMorphType(new Guid(MoMorphType.kguidMorphInfixingInterfix), "-", "-", 0, morphType);
						break;
					case 15:
						InitMorphType(new Guid(MoMorphType.kguidMorphPrefixingInterfix), null, "-", 0, morphType);
						break;
					case 16:
						InitMorphType(new Guid(MoMorphType.kguidMorphSuffixingInterfix), "-", null, 0, morphType);
						break;
					case 17:
						InitMorphType(new Guid(MoMorphType.kguidMorphPhrase), null, null, 0, morphType);
						break;
					case 18:
						InitMorphType(new Guid(MoMorphType.kguidMorphDiscontiguousPhrase), null, null, 0, morphType);
						break;
					case 19:
						InitMorphType(new Guid(MoMorphType.kguidMorphClitic), null, null, 0, morphType);
						break;
				}
				m_cacheBase.SetBasicProps(hvoMorphType, hvoMorphTypesList, (int)MoMorphType.kClassId,
					(int)CmPossibilityList.CmPossibilityListTags.kflidPossibilities, i);
				m_cacheBase.AppendToFdoVector(hvoMorphTypesList,
					(int)CmPossibilityList.CmPossibilityListTags.kflidPossibilities, hvoMorphType);
			}
		}
		/// <summary>
		/// If Phrase and Discontiguous Phrase somehow missed getting added by data migration,
		/// add them now.  See LT-5567 for an occurrence of this problem.
		/// Actually, LTB-344 demonstrates that another morphtype might be missing for some
		/// reason, so this is a general fix for any number of missing morphtypes.
		/// </summary>
		/// <param name="morphTypes"></param>
		/// <param name="cache"></param>
		private static void AddMissingMorphTypes(List<IMoMorphType> morphTypes, FdoCache cache)
		{
			List<string> neededTypes = new List<string>(19);
			neededTypes.Add(MoMorphType.kguidMorphBoundRoot);
			neededTypes.Add(MoMorphType.kguidMorphBoundStem);
			neededTypes.Add(MoMorphType.kguidMorphCircumfix);
			neededTypes.Add(MoMorphType.kguidMorphClitic);
			neededTypes.Add(MoMorphType.kguidMorphDiscontiguousPhrase);
			neededTypes.Add(MoMorphType.kguidMorphEnclitic);
			neededTypes.Add(MoMorphType.kguidMorphInfix);
			neededTypes.Add(MoMorphType.kguidMorphInfixingInterfix);
			neededTypes.Add(MoMorphType.kguidMorphParticle);
			neededTypes.Add(MoMorphType.kguidMorphPhrase);
			neededTypes.Add(MoMorphType.kguidMorphPrefix);
			neededTypes.Add(MoMorphType.kguidMorphPrefixingInterfix);
			neededTypes.Add(MoMorphType.kguidMorphProclitic);
			neededTypes.Add(MoMorphType.kguidMorphRoot);
			neededTypes.Add(MoMorphType.kguidMorphSimulfix);
			neededTypes.Add(MoMorphType.kguidMorphStem);
			neededTypes.Add(MoMorphType.kguidMorphSuffix);
			neededTypes.Add(MoMorphType.kguidMorphSuffixingInterfix);
			neededTypes.Add(MoMorphType.kguidMorphSuprafix);
			foreach (IMoMorphType mmt in morphTypes)
			{
				foreach (string sGuid in neededTypes)
				{
					if (mmt.Guid.ToString().ToLowerInvariant() == sGuid.ToLowerInvariant())
					{
						neededTypes.Remove(sGuid);
						break;
					}
				}
			}
			int wsEn = cache.LanguageEncodings.GetWsFromIcuLocale("en");
			foreach (string sGuid in neededTypes)
			{
				MoMorphType mmt = new MoMorphType();
				cache.LangProject.LexDbOA.MorphTypesOA.PossibilitiesOS.Append(mmt);
				mmt.Guid = new Guid(sGuid);
				mmt.ForeColor = -1073741824;
				mmt.BackColor = -1073741824;
				mmt.UnderColor = -1073741824;
				mmt.IsProtected = true;
				switch (sGuid)
				{
					case MoMorphType.kguidMorphBoundRoot:
						mmt.Name.SetAlternative("bound root", wsEn);
						mmt.Abbreviation.SetAlternative("bd root", wsEn);
						mmt.Description.SetAlternative("A bound root is a root which cannot occur as a separate word apart from any other morpheme.", wsEn);
						mmt.Prefix = "*";
						mmt.SecondaryOrder = 10;
						break;
					case MoMorphType.kguidMorphBoundStem:
						mmt.Name.SetAlternative("bound stem", wsEn);
						mmt.Abbreviation.SetAlternative("bd stem", wsEn);
						mmt.Description.SetAlternative("A bound stem is a stem  which cannot occur as a separate word apart from any other morpheme.", wsEn);
						mmt.Prefix = "*";
						mmt.SecondaryOrder = 10;
						break;
					case MoMorphType.kguidMorphCircumfix:
						mmt.Name.SetAlternative("circumfix", wsEn);
						mmt.Abbreviation.SetAlternative("cfx", wsEn);
						mmt.Description.SetAlternative("A circumfix is an affix made up of two separate parts which surround and attach to a root or stem.", wsEn);
						break;
					case MoMorphType.kguidMorphClitic:
						mmt.Name.SetAlternative("clitic", wsEn);
						mmt.Abbreviation.SetAlternative("clit", wsEn);
						mmt.Description.SetAlternative("A clitic is a morpheme that has syntactic characteristics of a word, but shows evidence of being phonologically bound to another word. Orthographically, it stands alone.", wsEn);
						break;
					case MoMorphType.kguidMorphDiscontiguousPhrase:
						mmt.Name.SetAlternative("discontiguous phrase", wsEn);
						mmt.Abbreviation.SetAlternative("dis phr", wsEn);
						mmt.Description.SetAlternative("A discontiguous phrase has discontiguous constituents which (a) are separated from each other by one or more intervening constituents, and (b) are considered either (i) syntactically contiguous and unitary, or (ii) realizing the same, single meaning. An example is French ne...pas.", wsEn);
						break;
					case MoMorphType.kguidMorphEnclitic:
						mmt.Name.SetAlternative("enclitic", wsEn);
						mmt.Abbreviation.SetAlternative("enclit", wsEn);
						mmt.Description.SetAlternative("An enclitic is a clitic that is phonologically joined at the end of a preceding word to form a single unit. Orthographically, it may attach to the preceding word.", wsEn);
						mmt.Prefix = "=";
						mmt.SecondaryOrder = 80;
						break;
					case MoMorphType.kguidMorphInfix:
						mmt.Name.SetAlternative("infix", wsEn);
						mmt.Abbreviation.SetAlternative("ifx", wsEn);
						mmt.Description.SetAlternative("An infix is an affix that is inserted within a root or stem.", wsEn);
						mmt.Postfix = "-";
						mmt.Prefix = "-";
						mmt.SecondaryOrder = 40;
						break;
					case MoMorphType.kguidMorphInfixingInterfix:
						mmt.Name.SetAlternative("infixing interfix", wsEn);
						mmt.Abbreviation.SetAlternative("ifxnfx", wsEn);
						mmt.Description.SetAlternative("An infixing interfix is an infix that can occur between two roots or stems.", wsEn);
						mmt.Postfix = "-";
						mmt.Prefix = "-";
						break;
					case MoMorphType.kguidMorphParticle:
						mmt.Name.SetAlternative("particle", wsEn);
						mmt.Abbreviation.SetAlternative("part", wsEn);
						mmt.Description.SetAlternative("A particle is a word that does not belong to one of the main classes of words, is invariable in form, and typically has grammatical or pragmatic meaning.", wsEn);
						break;
					case MoMorphType.kguidMorphPhrase:
						mmt.Name.SetAlternative("phrase", wsEn);
						mmt.Abbreviation.SetAlternative("phr", wsEn);
						mmt.Description.SetAlternative("A phrase is a syntactic structure that consists of more than one word but lacks the subject-predicate organization of a clause.", wsEn);
						break;
					case MoMorphType.kguidMorphPrefix:
						mmt.Name.SetAlternative("prefix", wsEn);
						mmt.Abbreviation.SetAlternative("pfx", wsEn);
						mmt.Description.SetAlternative("A prefix is an affix that is joined before a root or stem.", wsEn);
						mmt.Postfix = "-";
						mmt.SecondaryOrder = 20;
						break;
					case MoMorphType.kguidMorphPrefixingInterfix:
						mmt.Name.SetAlternative("prefixing interfix", wsEn);
						mmt.Abbreviation.SetAlternative("pfxnfx", wsEn);
						mmt.Description.SetAlternative("A prefixing interfix is a prefix that can occur between two roots or stems.", wsEn);
						mmt.Postfix = "-";
						break;
					case MoMorphType.kguidMorphProclitic:
						mmt.Name.SetAlternative("proclitic", wsEn);
						mmt.Abbreviation.SetAlternative("proclit", wsEn);
						mmt.Description.SetAlternative("A proclitic is a clitic that precedes the word to which it is phonologically joined. Orthographically, it may attach to the following word.", wsEn);
						mmt.Postfix = "=";
						mmt.SecondaryOrder = 30;
						break;
					case MoMorphType.kguidMorphRoot:
						mmt.Name.SetAlternative("root", wsEn);
						mmt.Abbreviation.SetAlternative("ubd root", wsEn);
						mmt.Description.SetAlternative("A root is the portion of a word that (i) is common to a set of derived or inflected forms, if any, when all affixes are removed, (ii) is not further analyzable into meaningful elements, being morphologically simple, and, (iii) carries the principle portion of meaning of the words in which it functions.", wsEn);
						break;
					case MoMorphType.kguidMorphSimulfix:
						mmt.Name.SetAlternative("simulfix", wsEn);
						mmt.Abbreviation.SetAlternative("smfx", wsEn);
						mmt.Description.SetAlternative("A simulfix is a change or replacement of vowels or consonants (usually vowels) which changes the meaning of a word.  (Note: the parser does not currently handle simulfixes.)", wsEn);
						mmt.Postfix = "=";
						mmt.Prefix = "=";
						mmt.SecondaryOrder = 60;
						break;
					case MoMorphType.kguidMorphStem:
						mmt.Name.SetAlternative("stem", wsEn);
						mmt.Abbreviation.SetAlternative("ubd stem", wsEn);
						mmt.Description.SetAlternative("\"A stem is the root or roots of a word, together with any derivational affixes, to which inflectional affixes are added.\" (LinguaLinks Library).  A stem \"may consist solely of a single root morpheme (i.e. a 'simple' stem as in man), or of two root morphemes (e.g. a 'compound' stem, as in blackbird), or of a root morpheme plus a derivational affix (i.e. a 'complex' stem, as in manly, unmanly, manliness).  All have in common the notion that it is to the stem that inflectional affixes are attached.\" (Crystal, 1997:362)", wsEn);
						break;
					case MoMorphType.kguidMorphSuffix:
						mmt.Name.SetAlternative("suffix", wsEn);
						mmt.Abbreviation.SetAlternative("sfx", wsEn);
						mmt.Description.SetAlternative("A suffix is an affix that is attached to the end of a root or stem.", wsEn);
						mmt.Prefix = "-";
						mmt.SecondaryOrder = 70;
						break;
					case MoMorphType.kguidMorphSuffixingInterfix:
						mmt.Name.SetAlternative("suffixing interfix", wsEn);
						mmt.Abbreviation.SetAlternative("sfxnfx", wsEn);
						mmt.Description.SetAlternative("A suffixing interfix is an suffix that can occur between two roots or stems.", wsEn);
						mmt.Prefix = "-";
						break;
					case MoMorphType.kguidMorphSuprafix:
						mmt.Name.SetAlternative("suprafix", wsEn);
						mmt.Abbreviation.SetAlternative("spfx", wsEn);
						mmt.Description.SetAlternative("A suprafix is a kind of affix in which a suprasegmental is superimposed on one or more syllables of the root or stem, signalling a particular  morphosyntactic operation.  (Note: the parser does not currently handle suprafixes.)", wsEn);
						mmt.Postfix = "~";
						mmt.Prefix = "~";
						mmt.SecondaryOrder = 50;
						break;
				}
				morphTypes.Add(mmt);
			}
		}