Beispiel #1
0
        public void GetHeadword_LexemeForm_ReturnsCorrectAlternative()
        {
            LexEntry entry = new LexEntry();

            entry.LexicalForm.SetAlternative("c", "can");
            entry.LexicalForm.SetAlternative("a", "apple");
            entry.LexicalForm.SetAlternative("b", "bart");
            Assert.AreEqual("apple", entry.GetHeadWordForm("a"));
            Assert.AreEqual("bart", entry.GetHeadWordForm("b"));
            Assert.AreEqual(string.Empty, entry.GetHeadWordForm("donthave"));
        }
Beispiel #2
0
        public void GetHeadword_CitationFormHasAlternative_CorrectForm()
        {
            LexEntry entry = new LexEntry();

            entry.LexicalForm.SetAlternative("a", "apple");
            MultiText citation =
                entry.GetOrCreateProperty <MultiText>(LexEntry.WellKnownProperties.Citation);

            citation.SetAlternative("b", "barter");
            citation.SetAlternative("a", "applishus");
            Assert.AreEqual("applishus", entry.GetHeadWordForm("a"));
            Assert.AreEqual("barter", entry.GetHeadWordForm("b"));
            Assert.AreEqual(string.Empty, entry.GetHeadWordForm("donthave"));
        }
Beispiel #3
0
 public void CheckRelationOutput(LexEntry targetEntry, string relationName)
 {
     AssertHasAtLeastOneMatchWithArgs("lift/entry/relation/field[@type='headword-of-target']/form[@lang='{1}']/text[text() = '{2}']",
                                      relationName,
                                      HeadwordWritingSystem.Id,
                                      targetEntry.GetHeadWordForm(HeadwordWritingSystem.Id));
 }
Beispiel #4
0
        public void GetHeadword_CitationFormLacksAlternative_GetsFormFromLexemeForm()
        {
            LexEntry entry = new LexEntry();

            entry.LexicalForm.SetAlternative("a", "apple");
            MultiText citation =
                entry.GetOrCreateProperty <MultiText>(LexEntry.WellKnownProperties.Citation);

            citation.SetAlternative("b", "bater");
            Assert.AreEqual("apple", entry.GetHeadWordForm("a"));
        }
Beispiel #5
0
        private void WriteHeadWordField(LexEntry entry, string outputFieldName)
        {
            //                headword.SetAlternative(HeadWordWritingSystemId, entry.GetHeadWordForm(HeadWordWritingSystemId));

            var headword = new MultiText();

            foreach (string writingSystemId in _headwordWritingSystemIds)
            {
                headword.SetAlternative(writingSystemId, entry.GetHeadWordForm(writingSystemId));
            }
            WriteMultiTextAsArtificialField(outputFieldName, headword);
        }
Beispiel #6
0
        public void TwoHomographicEntries_HaveHomographs()
        {
            var entries = new List <LexEntry>();

            entries.Add(_entry);

            var secondOne = _repo.CreateItem();

            entries.Add(secondOne);
            secondOne.LexicalForm.SetAlternative("qaa-x-qaa", _entry.GetHeadWordForm("qaa-x-qaa"));

            var contents = GetXhtmlContents(entries);

            AssertHasAtLeastOneMatch(contents, "//span[@class='xhomographnumber' and text()='1']");
            AssertHasAtLeastOneMatch(contents, "//span[@class='xhomographnumber' and text()='2']");
        }
Beispiel #7
0
        private void WriteHeadWordFieldForRelation(LexEntry entry, string outputFieldName)
        {
            //                headword.SetAlternative(HeadWordWritingSystemId, entry.GetHeadWordForm(HeadWordWritingSystemId));

            var headword = new MultiText();

            foreach (string writingSystemId in _headwordWritingSystemIds)
            {
                var headWordForm = entry.GetHeadWordForm(writingSystemId);
                if (!string.IsNullOrEmpty(headWordForm))
                {
                    headword.SetAlternative(writingSystemId, headWordForm);
                    break;                    //we only want the first non-empty one
                }
            }
            WriteMultiTextAsArtificialField(outputFieldName, headword);
        }
Beispiel #8
0
		public void GetHeadword_CitationFormLacksAlternative_GetsFormFromLexemeForm()
		{
			LexEntry entry = new LexEntry();
			entry.LexicalForm.SetAlternative("a", "apple");
			MultiText citation =
					entry.GetOrCreateProperty<MultiText>(LexEntry.WellKnownProperties.Citation);
			citation.SetAlternative("b", "bater");
			Assert.AreEqual("apple", entry.GetHeadWordForm("a"));
		}
Beispiel #9
0
		public void GetHeadword_CitationFormHasAlternative_CorrectForm()
		{
			LexEntry entry = new LexEntry();
			entry.LexicalForm.SetAlternative("a", "apple");
			MultiText citation =
					entry.GetOrCreateProperty<MultiText>(LexEntry.WellKnownProperties.Citation);
			citation.SetAlternative("b", "barter");
			citation.SetAlternative("a", "applishus");
			Assert.AreEqual("applishus", entry.GetHeadWordForm("a"));
			Assert.AreEqual("barter", entry.GetHeadWordForm("b"));
			Assert.AreEqual(string.Empty, entry.GetHeadWordForm("donthave"));
		}
Beispiel #10
0
		public void GetHeadword_LexemeForm_ReturnsCorrectAlternative()
		{
			LexEntry entry = new LexEntry();
			entry.LexicalForm.SetAlternative("c", "can");
			entry.LexicalForm.SetAlternative("a", "apple");
			entry.LexicalForm.SetAlternative("b", "bart");
			Assert.AreEqual("apple", entry.GetHeadWordForm("a"));
			Assert.AreEqual("bart", entry.GetHeadWordForm("b"));
			Assert.AreEqual(string.Empty, entry.GetHeadWordForm("donthave"));
		}
Beispiel #11
0
		public void GetHeadword_EmptyEverything_ReturnsEmptyString()
		{
			LexEntry entry = new LexEntry();
			Assert.AreEqual(string.Empty, entry.GetHeadWordForm("a"));
		}
Beispiel #12
0
        public void GetHeadword_EmptyEverything_ReturnsEmptyString()
        {
            LexEntry entry = new LexEntry();

            Assert.AreEqual(string.Empty, entry.GetHeadWordForm("a"));
        }