예제 #1
0
		private static LiftMultiText MakeBasicLiftMultiText()
		{
			LiftMultiText forms = new LiftMultiText();
			forms.Add("ws-one", "uno");
			forms.Add("ws-two", "dos");
			return forms;
		}
예제 #2
0
        private static LiftMultiText MakeBasicLiftMultiText(string text)
        {
            LiftMultiText forms = new LiftMultiText();

            forms.Add("ws-one", text);
            forms.Add("ws-two", text + "-in-two");
            return(forms);
        }
예제 #3
0
        private static LiftMultiText MakeBasicLiftMultiText()
        {
            LiftMultiText forms = new LiftMultiText();

            forms.Add("ws-one", "uno");
            forms.Add("ws-two", "dos");
            return(forms);
        }
예제 #4
0
        public void NewEntryGetsLexemeForm()
        {
            LexEntry      e     = MakeSimpleEntry();
            LiftMultiText forms = new LiftMultiText();

            forms.Add("x", "hello");
            forms.Add("y", "bye");
            _builder.MergeInLexemeForm(e, forms);
            Assert.AreEqual(2, e.LexicalForm.Count);
        }
예제 #5
0
        public void EntryWithCitation()
        {
            LexEntry      entry = MakeSimpleEntry();
            LiftMultiText forms = new LiftMultiText();

            forms.Add("x", "hello");
            forms.Add("y", "bye");
            _builder.MergeInCitationForm(entry, forms);

            MultiText citation = entry.GetProperty <MultiText>(LexEntry.WellKnownProperties.Citation);

            Assert.AreEqual(2, citation.Forms.Length);
            Assert.AreEqual("hello", citation["x"]);
            Assert.AreEqual("bye", citation["y"]);
        }
예제 #6
0
        public void MultipleGlossesCombined()
        {
            LexSense sense = new LexSense();

            _builder.MergeInGloss(sense, MakeBasicLiftMultiText());
            LiftMultiText secondGloss = new LiftMultiText();

            secondGloss.Add("ws-one", "UNO");
            secondGloss.Add("ws-three", "tres");
            _builder.MergeInGloss(sense, secondGloss);

            //MultiText mt = sense.GetProperty<MultiText>(LexSense.WellKnownProperties.Note);
            Assert.AreEqual(3, sense.Gloss.Forms.Length);
            Assert.AreEqual("uno; UNO", sense.Gloss["ws-one"]);
        }
예제 #7
0
        public void ExampleTranslations_FreeFollowedByUnmarked()
        {
            LexEntry e     = MakeSimpleEntry();
            LexSense sense = new LexSense();

            e.Senses.Add(sense);
            LexExampleSentence ex = new LexExampleSentence();

            sense.ExampleSentences.Add(ex);

            LiftMultiText t2 = new LiftMultiText();

            t2.Add("aa", "freestuff");
            _builder.MergeInTranslationForm(ex,
                                            "Free translation",
                                            t2,
                                            "<translation type='free'><bogus/></translation>");
            LiftMultiText translation = new LiftMultiText();

            translation.Add("aa", "unmarked translation");
            _builder.MergeInTranslationForm(ex,
                                            "",
                                            translation,
                                            "<translation><bogusUnmarked/></translation>");
            _builder.FinishEntry(e);

            _liftWriter.Add(e);
            _liftWriter.End();
            AssertHasAtLeastOneMatch("//entry/sense/example/translation[not(@type)]/bogusUnmarked");
            AssertHasAtLeastOneMatch(
                "//entry/sense/example/translation[@type='Free translation']/form/text[text()='freestuff']");
        }
예제 #8
0
        public void ExampleTranslations_MultipleTypes()
        {
            LexEntry e     = MakeSimpleEntry();
            LexSense sense = new LexSense();

            e.Senses.Add(sense);
            LexExampleSentence ex = new LexExampleSentence();

            sense.ExampleSentences.Add(ex);
            LiftMultiText translation = new LiftMultiText();

            translation.Add("aa", "unmarked translation");
            _builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml");
            LiftMultiText t2 = new LiftMultiText();

            t2.Add("aa", "type2translation");
            _builder.MergeInTranslationForm(ex,
                                            "type2",
                                            t2,
                                            "<translation type='type2'><bogus/></translation>");
            _builder.FinishEntry(e);

            _liftWriter.Add(e);
            _liftWriter.End();
            AssertHasAtLeastOneMatch(
                "//entry/sense/example/translation[not(@type)]/form[@lang='aa']/text[text()='unmarked translation']");
            AssertHasAtLeastOneMatch("//entry/sense/example/translation[@type='type2']/bogus");
        }
예제 #9
0
        public void EntryGetsLexemeFormWithUnheardOfLanguage()
        {
            LexEntry      e     = MakeSimpleEntry();
            LiftMultiText forms = new LiftMultiText();

            forms.Add("x99", "hello");
            _builder.MergeInLexemeForm(e, forms);
            Assert.AreEqual("hello", e.LexicalForm["x99"]);
        }
예제 #10
0
		public void Create_LiftMultiTextWithOutSpansInForms_ReturnsMultiTextWithOutSpansInForms()
		{
			LiftString liftStringToConvert = new LiftString("No spans here!");

			LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText();
			liftMultiTextWithSpansInForms.Add("de", liftStringToConvert);

			MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms);
			Assert.AreEqual("No spans here!", multiText["de"]);
		}
예제 #11
0
        public void MergeInTranslationForm_NoType_GetContents()
        {
            LexExampleSentence ex          = new LexExampleSentence();
            LiftMultiText      translation = new LiftMultiText();

            translation.Add("aa", "aaaa");
            _builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml");
            Assert.AreEqual("aaaa", ex.Translation["aa"]);
            Assert.IsTrue(string.IsNullOrEmpty(ex.TranslationType));
        }
예제 #12
0
        public void MergeInTranslationForm_UnheardOfType_StillBecomesTranslation()
        {
            LexExampleSentence ex          = new LexExampleSentence();
            LiftMultiText      translation = new LiftMultiText();

            translation.Add("aa", "aaaa");
            _builder.MergeInTranslationForm(ex, "madeUpType", translation, "bogus raw xml");
            Assert.AreEqual("aaaa", ex.Translation["aa"]);
            Assert.AreEqual("madeUpType", ex.TranslationType);
        }
예제 #13
0
        public void MergeInTranslationForm_TypeFree_GetContentsAndSavesType()
        {
            LexExampleSentence ex          = new LexExampleSentence();
            LiftMultiText      translation = new LiftMultiText();

            translation.Add("aa", "aaaa");
            _builder.MergeInTranslationForm(ex, "Free translation", translation, "bogus raw xml");
            Assert.AreEqual("aaaa", ex.Translation["aa"]);
            Assert.AreEqual("Free translation", ex.TranslationType);
        }
예제 #14
0
        public void Create_LiftMultiTextWithOutSpansInForms_ReturnsMultiTextWithOutSpansInForms()
        {
            LiftString liftStringToConvert = new LiftString("No spans here!");

            LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText();

            liftMultiTextWithSpansInForms.Add("de", liftStringToConvert);

            MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms);

            Assert.AreEqual("No spans here!", multiText["de"]);
        }
예제 #15
0
		public void GetFormWithSpans_WritingSystemLinkedToFormWithSpans_ReturnsFormWithSpans()
		{
			LiftString liftStringToConvert = new LiftString("Text to Mark Up!");
			LiftSpan span1 = new LiftSpan(0, 4, "", "", "");
			liftStringToConvert.Spans.Add(span1);

			LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText();
			liftMultiTextWithSpansInForms.Add("de", liftStringToConvert);

			MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms);
			Assert.AreEqual("<span>Text</span> to Mark Up!", multiText["de"]);
		}
예제 #16
0
        public void GetFormWithSpans_WritingSystemLinkedToFormWithOutSpans_ReturnsFormWithOutSpans()
        {
            LiftString liftStringToConvert = new LiftString("No spans here!");

            LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText();

            liftMultiTextWithSpansInForms.Add("de", liftStringToConvert);

            MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms);

            Assert.AreEqual("No spans here!", multiText["de"]);
        }
예제 #17
0
        public void Create_LiftMultiTextWithSpansInForms_ReturnsMultiTextWithSpansInForms()
        {
            LiftString liftStringToConvert = new LiftString("Text to Mark Up!");
            LiftSpan   span1 = new LiftSpan(0, 4, "", "", "");

            liftStringToConvert.Spans.Add(span1);

            LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText();

            liftMultiTextWithSpansInForms.Add("de", liftStringToConvert);

            MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms);

            Assert.AreEqual("<span>Text</span> to Mark Up!", multiText["de"]);
        }
예제 #18
0
        public void ExampleTranslation_OneWithNoType()
        {
            LexEntry e     = MakeSimpleEntry();
            LexSense sense = new LexSense();

            e.Senses.Add(sense);
            LexExampleSentence ex = new LexExampleSentence();

            sense.ExampleSentences.Add(ex);
            LiftMultiText translation = new LiftMultiText();

            translation.Add("aa", "aaaa");
            _builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml");
            _builder.FinishEntry(e);
            _liftWriter.Add(e);
            _liftWriter.End();
            AssertHasAtLeastOneMatch("//entry/sense/example/translation[not(@type)]/form[@lang='aa']");
        }
		public void MergeInTranslationForm_UnheardOfType_StillBecomesTranslation()
		{
			LexExampleSentence ex = new LexExampleSentence();
			LiftMultiText translation = new LiftMultiText();
			translation.Add("aa", "aaaa");
			_builder.MergeInTranslationForm(ex, "madeUpType", translation, "bogus raw xml");
			Assert.AreEqual("aaaa", ex.Translation["aa"]);
			Assert.AreEqual("madeUpType",ex.TranslationType);
		}
		public void MergeInTranslationForm_TypeFree_GetContentsAndSavesType()
		{
			LexExampleSentence ex = new LexExampleSentence();
			LiftMultiText translation = new LiftMultiText();
			translation.Add("aa", "aaaa");
			_builder.MergeInTranslationForm(ex, "Free translation", translation, "bogus raw xml");
			Assert.AreEqual("aaaa", ex.Translation["aa"]);
			Assert.AreEqual("Free translation", ex.TranslationType);
		}
		public void EntryWithCitation()
		{
			LexEntry entry = MakeSimpleEntry();
			LiftMultiText forms = new LiftMultiText();
			forms.Add("x", "hello");
			forms.Add("y", "bye");
			_builder.MergeInCitationForm(entry, forms);

			MultiText citation = entry.GetProperty<MultiText>(LexEntry.WellKnownProperties.Citation);
			Assert.AreEqual(2, citation.Forms.Length);
			Assert.AreEqual("hello", citation["x"]);
			Assert.AreEqual("bye", citation["y"]);
		}
		public void NewEntryGetsLexemeForm()
		{
			LexEntry e = MakeSimpleEntry();
			LiftMultiText forms = new LiftMultiText();
			forms.Add("x", "hello");
			forms.Add("y", "bye");
			_builder.MergeInLexemeForm(e, forms);
			Assert.AreEqual(2, e.LexicalForm.Count);
		}
		public void EntryGetsLexemeFormWithUnheardOfLanguage()
		{
			LexEntry e = MakeSimpleEntry();
			LiftMultiText forms = new LiftMultiText();
			forms.Add("x99", "hello");
			_builder.MergeInLexemeForm(e, forms);
			Assert.AreEqual("hello", e.LexicalForm["x99"]);
		}
		private static LiftMultiText MakeBasicLiftMultiText(string text)
		{
			LiftMultiText forms = new LiftMultiText();
			forms.Add("ws-one", text);
			forms.Add("ws-two", text+"-in-two");
			return forms;
		}
		public void MultipleGlossesCombined()
		{
			LexSense sense = new LexSense();
			_builder.MergeInGloss(sense, MakeBasicLiftMultiText());
			LiftMultiText secondGloss = new LiftMultiText();
			secondGloss.Add("ws-one", "UNO");
			secondGloss.Add("ws-three", "tres");
			_builder.MergeInGloss(sense, secondGloss);

			//MultiText mt = sense.GetProperty<MultiText>(LexSense.WellKnownProperties.Note);
			Assert.AreEqual(3, sense.Gloss.Forms.Length);
			Assert.AreEqual("uno; UNO", sense.Gloss["ws-one"]);
		}
예제 #26
0
		public void GetFormWithSpans_WritingSystemLinkedToFormWithOutSpans_ReturnsFormWithOutSpans()
		{
			LiftString liftStringToConvert = new LiftString("No spans here!");

			LiftMultiText liftMultiTextWithSpansInForms = new LiftMultiText();
			liftMultiTextWithSpansInForms.Add("de", liftStringToConvert);

			MultiText multiText = MultiText.Create(liftMultiTextWithSpansInForms);
			Assert.AreEqual("No spans here!", multiText["de"]);
		}
예제 #27
0
		public void ExampleTranslation_OneWithNoType()
		{
			LexEntry e = MakeSimpleEntry();
			LexSense sense = new LexSense();
			e.Senses.Add(sense);
			LexExampleSentence ex = new LexExampleSentence();
			sense.ExampleSentences.Add(ex);
			LiftMultiText translation = new LiftMultiText();
			translation.Add("aa", "aaaa");
			_builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml");
			_builder.FinishEntry(e);
			_exporter.Add(e);
			_exporter.End();
			AssertXPathNotNull("//entry/sense/example/translation[not(@type)]/form[@lang='aa']");
		}
예제 #28
0
		public void ExampleTranslations_MultipleTypes()
		{
			LexEntry e = MakeSimpleEntry();
			LexSense sense = new LexSense();
			e.Senses.Add(sense);
			LexExampleSentence ex = new LexExampleSentence();
			sense.ExampleSentences.Add(ex);
			LiftMultiText translation = new LiftMultiText();
			translation.Add("aa", "unmarked translation");
			_builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml");
			LiftMultiText t2 = new LiftMultiText();
			t2.Add("aa", "type2translation");
			_builder.MergeInTranslationForm(ex,
										   "type2",
										   t2,
										   "<translation type='type2'><bogus/></translation>");
			_builder.FinishEntry(e);

			_exporter.Add(e);
			_exporter.End();
			AssertXPathNotNull(
					"//entry/sense/example/translation[not(@type)]/form[@lang='aa']/text[text()='unmarked translation']");
			AssertXPathNotNull("//entry/sense/example/translation[@type='type2']/bogus");
		}
예제 #29
0
		public void ExampleTranslations_FreeThenUnmarked()
		{
			LexEntry e = MakeSimpleEntry();
			LexSense sense = new LexSense();
			e.Senses.Add(sense);
			LexExampleSentence ex = new LexExampleSentence();
			sense.ExampleSentences.Add(ex);

			LiftMultiText t2 = new LiftMultiText();
			t2.Add("aa", "freestuff");
			_builder.MergeInTranslationForm(ex,
										   "free",
										   t2,
										   "<translation type='free'><bogus/></translation>");
			LiftMultiText translation = new LiftMultiText();
			translation.Add("aa", "unmarked translation");
			_builder.MergeInTranslationForm(ex,
										   "",
										   translation,
										   "<translation><bogusUnmarked/></translation>");
			_builder.FinishEntry(e);

			_exporter.Add(e);
			_exporter.End();
			AssertXPathNotNull("//entry/sense/example/translation[not(@type)]/bogusUnmarked");
			AssertXPathNotNull(
					"//entry/sense/example/translation[@type='free']/form/text[text()='freestuff']");
		}
		public void MergeInTranslationForm_NoType_GetContents()
		{
			LexExampleSentence ex = new LexExampleSentence();
			LiftMultiText translation = new LiftMultiText();
			translation.Add("aa", "aaaa");
			_builder.MergeInTranslationForm(ex, "", translation, "bogus raw xml");
			Assert.AreEqual("aaaa", ex.Translation["aa"]);
			Assert.IsTrue(string.IsNullOrEmpty(ex.TranslationType));
		}
예제 #31
0
		public void MultipleNotesCombined()
		{
			LexSense sense = new LexSense();
			_builder.MergeInNote(sense, null, MakeBasicLiftMultiText());
			LiftMultiText secondNote = new LiftMultiText();
			secondNote.Add("ws-one", "UNO");
			secondNote.Add("ws-three", "tres");
			_builder.MergeInNote(sense, null, secondNote);

			MultiText mt = sense.GetProperty<MultiText>(WeSayDataObject.WellKnownProperties.Note);
			Assert.AreEqual(3, mt.Forms.Length);
			Assert.AreEqual("uno || UNO", mt["ws-one"]);
		}
예제 #32
0
		public void FirstValueOfSimpleMultiText()
		{
			LiftMultiText t = new LiftMultiText();
			LiftString s1 = new LiftString();
			s1.Text = "1";
			t.Add("x", s1);
			LiftString s2 = new LiftString();
			s2.Text = "2";
			t.Add("y", s2);
			Assert.AreEqual("x", t.FirstValue.Key);
			Assert.AreEqual("1", t.FirstValue.Value.Text);
		}
예제 #33
0
		public void ExampleTranslations_FreeFollowedByUnmarked()
		{
			LexEntry e = MakeSimpleEntry();
			LexSense sense = new LexSense();
			e.Senses.Add(sense);
			LexExampleSentence ex = new LexExampleSentence();
			sense.ExampleSentences.Add(ex);

			LiftMultiText t2 = new LiftMultiText();
			t2.Add("aa", "freestuff");
			_builder.MergeInTranslationForm(ex,
											"Free translation",
											t2,
											"<translation type='free'><bogus/></translation>");
			LiftMultiText translation = new LiftMultiText();
			translation.Add("aa", "unmarked translation");
			_builder.MergeInTranslationForm(ex,
											"",
											translation,
											"<translation><bogusUnmarked/></translation>");
			_builder.FinishEntry(e);

			_liftWriter.Add(e);
			_liftWriter.End();
			AssertHasAtLeastOneMatch("//entry/sense/example/translation[not(@type)]/bogusUnmarked");
			AssertHasAtLeastOneMatch(
				"//entry/sense/example/translation[@type='Free translation']/form/text[text()='freestuff']");
		}