[FOray-commit] SF.net SVN: foray:[14943] trunk/foray/foray-orthograp hy/src
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2026-07-29 10:22:26
|
Revision: 14943
http://sourceforge.net/p/foray/code/14943
Author: victormote
Date: 2026-07-29 10:22:22 +0000 (Wed, 29 Jul 2026)
Log Message:
-----------
Convert last XML derivative-pattern to java classes.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml
trunk/foray/foray-orthography/src/test/resources/orthography-config.xml
Added Paths:
-----------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Factory.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_FactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Tests.java
Modified: trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml
===================================================================
--- trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml 2026-07-29 00:02:47 UTC (rev 14942)
+++ trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml 2026-07-29 10:22:22 UTC (rev 14943)
@@ -42,17 +42,6 @@
<match desc="A single capital letter, such as a person's initial">^[A-Z]$</match>
</match-rule-list>
- <derivative-pattern-list id="eng-Latn-derivative-patterns">
- <derivative-pattern desc="ends with /-iest/, root ends with /-y/">
- <match>^([a-zæœëéöA-ZÆŒ\-‘’ ]+)iest$</match>
- <replace>$1y</replace>
- <derivative-rule>
- <adjective><extensible/></adjective>
- <derivative-type type="superlative"/>
- </derivative-rule>
- </derivative-pattern>
- </derivative-pattern-list>
-
<derivative-pattern-list id="fre-Latn-derivative-patterns">
<derivative-pattern desc="ends with /-s/">
<match>^([a-zæœëéöA-ZÆŒ\-‘’ ]+)s$</match>
@@ -89,6 +78,7 @@
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_er_Factory"/>
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_er2_Factory"/>
+ <derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_iest_Factory"/>
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_2c_est_Factory"/>
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_est_Factory"/>
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_est2_Factory"/>
@@ -170,7 +160,6 @@
<orthography language-iso-3char="eng" script-iso-4char="Latn" country-iso-3char="USA">
<match-rules reference="eng-Latn-match-rules"/>
- <derivative-rules reference="eng-Latn-derivative-patterns"/>
<dictionary reference="org.foray.eng.Latn.USA"/>
<hyphenation-patterns reference="hyph-patterns-eng"/>
<derivative-factories reference="eng-Latn-derivatives"/>
@@ -178,7 +167,6 @@
<orthography language-iso-3char="eng" script-iso-4char="Latn" country-iso-3char="GBR">
<match-rules reference="eng-Latn-match-rules"/>
- <derivative-rules reference="eng-Latn-derivative-patterns"/>
<dictionary reference="org.foray.eng.Latn.GBR"/>
<hyphenation-patterns reference="hyph-patterns-eng"/>
<derivative-factories reference="eng-Latn-derivatives"/>
Added: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest.java 2026-07-29 10:22:22 UTC (rev 14943)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2026 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.orthography.inflection.eng;
+
+import org.foray.orthography.Word4a;
+import org.foray.orthography.WordSegment4a;
+import org.foray.orthography.inflection.InflectedWord;
+import org.foray.orthography.inflection.mods.Replace_y_by_i;
+
+import java.util.regex.Pattern;
+
+/**
+ * Wraps an adjective ending in "y", converting the "y" to "iest" make it comparatively greater than the lemma.
+ * For example, the English word "crazy" would be wrapped to make the word "craziest".
+ */
+public class EngLatnSuffix_iest extends InflectedWord {
+
+ /** The pattern to be matched by words with this inflection. */
+ public static final Pattern PATTERN = Pattern.compile("^(" + EngLatn.WORD_CHARS + "+)iest$");
+
+ /** Constant needed for serialization. */
+ private static final long serialVersionUID = 215291249289142549L;
+
+ /** The word segment that replaces the last word segment in the wrapped word. */
+ private WordSegment4a modifiedSegment;
+
+ /**
+ * Constructor.
+ * @param wrappedWord The wrapped word.
+ */
+ public EngLatnSuffix_iest(final Word4a wrappedWord) {
+ super(wrappedWord);
+ this.modifiedSegment = new Replace_y_by_i(wrappedWord.getLastWordSegment());
+ }
+
+ @Override
+ public WordSegment4a getAppendedSegment() {
+ return EngLatn.EST_SEGMENT;
+ }
+
+ @Override
+ public WordSegment4a getModifiedSegment() {
+ return this.modifiedSegment;
+ }
+
+}
Property changes on: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Factory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Factory.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Factory.java 2026-07-29 10:22:22 UTC (rev 14943)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2026 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.orthography.inflection.eng;
+
+import org.foray.orthography.Word4a;
+import org.foray.orthography.inflection.InflectionFactory;
+
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
+
+import java.util.regex.Matcher;
+
+/**
+ * Factory class for {@link EngLatnSuffix_iest}.
+ */
+public final class EngLatnSuffix_iest_Factory extends InflectionFactory<EngLatnSuffix_iest> {
+
+ /** The singleton instance. */
+ private static final EngLatnSuffix_iest_Factory THE_INSTANCE = new EngLatnSuffix_iest_Factory();
+
+ /**
+ * Private constructor for this singleton class.
+ */
+ private EngLatnSuffix_iest_Factory() { }
+
+ /**
+ * Returns the singleton instance.
+ * @return The singleton instance.
+ */
+ public static EngLatnSuffix_iest_Factory getInstance() {
+ return THE_INSTANCE;
+ }
+
+ @Override
+ public CharSequence findLemmaChars(final CharSequence chars) {
+ final Matcher matcher = EngLatnSuffix_iest.PATTERN.matcher(chars);
+ if (! matcher.matches()) {
+ return null;
+ }
+
+ final String lemmaChars = matcher.group(1) + "y";
+ return lemmaChars;
+ }
+
+ @Override
+ public boolean isValidLemma(final Word4a lemma) {
+ if (lemma.isOfQualifiedType(PartOfSpeech.ADJECTIVE, PosQualifier.EXTENSIBLE)) {
+ /*
+ <derivative-type type="superlative" desc="single-syllable root"/>
+ */
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected EngLatnSuffix_iest makeInstance(final Word4a lemma) {
+ return new EngLatnSuffix_iest(lemma);
+ }
+
+}
Property changes on: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Factory.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_FactoryTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_FactoryTests.java (rev 0)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_FactoryTests.java 2026-07-29 10:22:22 UTC (rev 14943)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2026 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.orthography.inflection.eng;
+
+import org.foray.orthography.Dictionary4a;
+import org.foray.orthography.StringWordTests;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.assertj.core.api.AssertionsForClassTypes;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+/**
+ * Tests of {@link EngLatnSuffix_iest_Factory}.
+ */
+public class EngLatnSuffix_iest_FactoryTests {
+
+ /** The object under test. */
+ private EngLatnSuffix_iest_Factory out;
+
+ /** A dictionary to use for these tests. */
+ private Dictionary4a dictionary;
+
+ /**
+ * Test setup.
+ */
+ @BeforeEach
+ public void before() {
+ this.out = EngLatnSuffix_iest_Factory.getInstance();
+ this.dictionary = Mockito.mock(Dictionary4a.class);
+ Mockito.when(dictionary.getWord("crazy")).thenReturn(StringWordTests.WORD_CRAZY);
+ }
+
+ /**
+ * Test of a String for which the factory should not be able to create an instance.
+ */
+ @Test
+ public void testInvalid() {
+ AssertionsForClassTypes.assertThat(out.makeInstance("crazier", this.dictionary)).isNull();
+ }
+
+ /**
+ * Test of a String for which the factory should be able to create an instance.
+ */
+ @Test
+ public void testValid() {
+ final EngLatnSuffix_iest word = out.makeInstance("craziest", this.dictionary);
+ /* Test for instance equality. */
+ AssertionsForClassTypes.assertThat(word.getWrappedWord()).isEqualTo(StringWordTests.WORD_CRAZY);
+ assertThat(word.getActualContent().toString()).isEqualTo("craziest");
+ }
+
+}
Property changes on: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_FactoryTests.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Tests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Tests.java (rev 0)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Tests.java 2026-07-29 10:22:22 UTC (rev 14943)
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2026 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.orthography.inflection.eng;
+
+import org.foray.orthography.StringWord;
+import org.foray.orthography.StringWordTests;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests of {@link EngLatnSuffix_iest}.
+ */
+public class EngLatnSuffix_iest_Tests {
+
+ /**
+ * Tests various aspects word ending in -iest.
+ */
+ @Test
+ public void test01() {
+ final StringWord word = StringWordTests.WORD_CRAZY;
+ final EngLatnSuffix_iest wrapper = new EngLatnSuffix_iest(word);
+
+ assertThat(wrapper.toString()).isEqualTo("cra-zi-est");
+ assertThat(wrapper.getNormalizedContent()).isEqualTo("crazy");
+ assertThat(wrapper.getActualContent().toString()).isEqualTo("craziest");
+ }
+
+}
Property changes on: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/inflection/eng/EngLatnSuffix_iest_Tests.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-orthography/src/test/resources/orthography-config.xml
===================================================================
--- trunk/foray/foray-orthography/src/test/resources/orthography-config.xml 2026-07-29 00:02:47 UTC (rev 14942)
+++ trunk/foray/foray-orthography/src/test/resources/orthography-config.xml 2026-07-29 10:22:22 UTC (rev 14943)
@@ -33,6 +33,7 @@
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_er_Factory"/>
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_er2_Factory"/>
+ <derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_iest_Factory"/>
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_2c_est_Factory"/>
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_est_Factory"/>
<derivative-factory class="org.foray.orthography.inflection.eng.EngLatnSuffix_est2_Factory"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|