foray-commit Mailing List for FOray (Page 74)
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(139) |
Apr
(98) |
May
(250) |
Jun
(394) |
Jul
(84) |
Aug
(13) |
Sep
(420) |
Oct
(186) |
Nov
(1) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(108) |
Feb
(202) |
Mar
(291) |
Apr
(247) |
May
(374) |
Jun
(227) |
Jul
(231) |
Aug
(60) |
Sep
(31) |
Oct
(45) |
Nov
(18) |
Dec
|
| 2008 |
Jan
(38) |
Feb
(71) |
Mar
(142) |
Apr
|
May
(59) |
Jun
(6) |
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
(12) |
Feb
(4) |
Mar
(88) |
Apr
(121) |
May
(17) |
Jun
(30) |
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2010 |
Jan
(11) |
Feb
(76) |
Mar
(11) |
Apr
|
May
(11) |
Jun
|
Jul
|
Aug
(44) |
Sep
(14) |
Oct
(7) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(9) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(10) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(168) |
| 2017 |
Jan
(77) |
Feb
(11) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(88) |
Mar
(118) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(141) |
| 2021 |
Jan
(170) |
Feb
(20) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(62) |
Nov
(189) |
Dec
(162) |
| 2022 |
Jan
(201) |
Feb
(118) |
Mar
(8) |
Apr
|
May
(2) |
Jun
(47) |
Jul
(19) |
Aug
(14) |
Sep
(3) |
Oct
|
Nov
(28) |
Dec
(235) |
| 2023 |
Jan
(112) |
Feb
(23) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(70) |
Sep
(92) |
Oct
(20) |
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
(14) |
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(10) |
Feb
(29) |
Mar
|
Apr
(162) |
May
(245) |
Jun
(83) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(4) |
Dec
|
|
From: <vic...@us...> - 2021-11-12 18:37:57
|
Revision: 12051
http://sourceforge.net/p/foray/code/12051
Author: victormote
Date: 2021-11-12 18:37:54 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Conform to aXSL changes: Clean up Orthography API, clarifying why there are two hyphenation methods.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-12 17:21:29 UTC (rev 12050)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-12 18:37:54 UTC (rev 12051)
@@ -36,7 +36,6 @@
import org.axsl.font.FontConsumer;
import org.axsl.linebreak.LineBreakControl;
import org.axsl.orthography.Orthography;
-import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.OrthographyServer;
import org.axsl.orthography.Word;
import org.axsl.text.TextException;
@@ -412,12 +411,9 @@
// Extract the word that should be evaluated by the hyphenation system.
final int wordSize = wordSize(this.currentChars, actualWordStart);
// See if there are discretionary hyphenation points.
- Word hyph = null;
- try {
- hyph = orthographyConfig.hyphenate(this.currentChars, actualWordStart, wordSize);
- } catch (final OrthographyException e) {
- /* Log the exception and continue. */
- this.getLogger().error("Hyphenation error", e);
+ Word hyph = orthographyConfig.recognizeWord(this.currentChars, actualWordStart, wordSize, null, null);
+ if (hyph == null) {
+ hyph = orthographyConfig.hyphenateUnrecognizedWord(this.currentChars, actualWordStart, wordSize);
}
// If none, the word cannot be hyphenated.
if (hyph == null) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 17:21:29 UTC (rev 12050)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 18:37:54 UTC (rev 12051)
@@ -261,15 +261,17 @@
}
@Override
- public Word getWord(final CharSequence wordChars, final Word.PartOfSpeech pos,
- final List<Dictionary> adhocDictionaries) {
+ public Word recognizeWord(final CharSequence wordChars, final int offset, final int length,
+ final Word.PartOfSpeech pos, final List<Dictionary> adhocDictionaries) {
// TODO Auto-generated method stub
return null;
}
@Override
- public boolean isValidWord(final CharSequence wordChars, final Word.PartOfSpeech pos,
- final List<Dictionary> adhocDictionaries) {
+ public boolean isRecognizedWord(final CharSequence wordCharsIn, final int offset, final int length,
+ final Word.PartOfSpeech pos, final List<Dictionary> adhocDictionaries) {
+ /* TODO: For performance and memory, try to eliminate the following conversion. */
+ final CharSequence wordChars = wordCharsIn.subSequence(offset, offset + length);
if (wordChars.length() < 1) {
return false;
}
@@ -301,7 +303,8 @@
final String[] components = this.compoundWordBreaker.split(wordChars);
final boolean[] componentsValid = new boolean[components.length];
for (int index = 0; index < components.length; index ++) {
- componentsValid[index] = isValidWord(components[index], pos, adhocDictionaries);
+ final String component = components[index];
+ componentsValid[index] = isRecognizedWord(component, 0, component.length(), pos, adhocDictionaries);
}
if (BooleanUtils.allTrue(componentsValid)) {
return true;
@@ -337,7 +340,7 @@
if (Character.isUpperCase(wordChars.charAt(0))) {
final StringBuilder builder = new StringBuilder(wordChars);
builder.setCharAt(0, Character.toLowerCase(wordChars.charAt(0)));
- return isValidWord(builder, pos, adhocDictionaries);
+ return isRecognizedWord(builder, offset, length, pos, adhocDictionaries);
}
return false;
@@ -358,7 +361,7 @@
}
@Override
- public Word hyphenate(final CharSequence word, final int offset, final int length) {
+ public Word hyphenateUnrecognizedWord(final CharSequence word, final int offset, final int length) {
/* The character sequence containing the characters in the word that we are looking for. */
final CharSequence chars = word.subSequence(offset, offset + length);
Word hyphenatedWord = null;
@@ -421,8 +424,11 @@
parseInterwordContent(wordSequence, chunk);
} else {
/* Chunk is a word. */
- Word word = hyphenate(chunk, 0, chunk.length());
+ Word word = recognizeWord(chunk, 0, chunk.length(), null, null);
if (word == null) {
+ word = hyphenateUnrecognizedWord(chunk, 0, chunk.length());
+ }
+ if (word == null) {
word = new StringWord(0, chunk);
}
wordSequence.add(word);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 17:21:29 UTC (rev 12050)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 18:37:54 UTC (rev 12051)
@@ -465,7 +465,7 @@
return;
}
- if (this.currentOrthographyConfig.isValidWord(word, null, this.currentDictionaries)) {
+ if (this.currentOrthographyConfig.isRecognizedWord(word, 0, word.length(), null, this.currentDictionaries)) {
return;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 17:21:29 UTC (rev 12050)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 18:37:54 UTC (rev 12051)
@@ -143,7 +143,7 @@
if (word.length() < 1) {
return;
}
- if (this.currentOrthographyConfig.isValidWord(word, null, this.currentDictionaries)) {
+ if (this.currentOrthographyConfig.isRecognizedWord(word, 0, word.length(), null, this.currentDictionaries)) {
this.output.println("Found: " + word);
return;
} else {
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 17:21:29 UTC (rev 12050)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 18:37:54 UTC (rev 12051)
@@ -143,7 +143,7 @@
throw new OrthographyException("Test of \"hyphenation\" has invalid input.");
}
final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
- final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
+ final Word hyphenation = orthography.hyphenateUnrecognizedWord(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(3, hyphenation.getQtyHyphenationPoints());
Assert.assertEquals(2, hyphenation.getHyphenationPointOffset(0));
@@ -184,7 +184,7 @@
throw new OrthographyException("Test of \"obligatory\" has invalid input.");
}
final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
- final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
+ final Word hyphenation = orthography.hyphenateUnrecognizedWord(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(4, hyphenation.getQtyHyphenationPoints());
Assert.assertEquals(2, hyphenation.getHyphenationPointOffset(0));
@@ -203,7 +203,7 @@
public void testEnInvalidCharacter() throws OrthographyException {
final String testWord = "table8";
final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
- final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
+ final Word hyphenation = orthography.hyphenateUnrecognizedWord(testWord, 0, testWord.length());
Assert.assertNull(hyphenation);
}
@@ -216,7 +216,7 @@
public void testTimes() throws OrthographyException {
final String testWord = "times";
final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
- final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
+ final Word hyphenation = orthography.hyphenateUnrecognizedWord(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals("times", hyphenation.toString());
Assert.assertEquals("time", hyphenation.getNormalizedContent());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 17:21:32
|
Revision: 12050
http://sourceforge.net/p/foray/code/12050
Author: victormote
Date: 2021-11-12 17:21:29 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Rename Lexer classes for clarity and consistency.
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/Lexer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerDefault.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerLatin1.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerLatin1Tests.java
Removed Paths:
-------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerDefault.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerLatin1.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.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 2021-11-12 17:05:59 UTC (rev 12049)
+++ trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml 2021-11-12 17:21:29 UTC (rev 12050)
@@ -196,7 +196,7 @@
<dictionary reference="dictionary-eng-moby"/>
<hyphenation-patterns reference="hyph-patterns-eng"/>
<derivative-factories reference="eng-999-derivatives"/>
- <lexer class="org.foray.orthography.WordBreakerLatin1"/>
+ <lexer class="org.foray.orthography.LexerLatin1"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Latn"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Zyyy"/>
<orthography language-iso-3char="eng" country-iso-3char="999" script-iso-4char="Latn"/>
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java (from rev 12048, trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java 2021-11-12 17:21:29 UTC (rev 12050)
@@ -0,0 +1,268 @@
+/*
+ * Copyright 2019 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;
+
+import org.foray.common.sequence.IntArray;
+import org.foray.common.sequence.IntArrayBuilder;
+
+import org.axsl.orthography.optional.Lexer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Implementations know how to break a character sequence into words and interword content.
+ */
+public abstract class Lexer4a implements Lexer {
+
+ /**
+ * Enumeration of possible character types, as they relate to word-breaking.
+ * This enumeration is useful for some subclasses.
+ */
+ public enum CharType {
+
+ /** Character is always part of a word. */
+ ALWAYS_WORD_CHAR,
+
+ /** Character is never part of a word. */
+ NEVER_WORD_CHAR,
+
+ /** Character may be part of a word, depending on context. */
+ SOMETIMES_WORD_CHAR;
+
+ }
+
+ /**
+ * Returns the word and interword content of a given character sequence.
+ * Even-numbered indexes in the array always contain a word, and odd-numbered indexes always contain interword
+ * content.
+ * In the case that the sequence actually starts with interword content (instead of the more normal case of starting
+ * with a word), element 0 will contain an empty string.
+ * @param sequence The character sequence to be parsed.
+ * @return The list of word and interword content parsed from {@code sequence}.
+ */
+ public List<CharSequence> tokenize(final CharSequence sequence) {
+ final IntArray wordBreaks = findWordBreaks(sequence);
+ final List<CharSequence> wordChunks = new ArrayList<CharSequence>(wordBreaks.length());
+ if (wordBreaks.length() < 1) {
+ return wordChunks;
+ }
+ for (int index = 0; index < wordBreaks.length() - 1; index ++) {
+ final int start = Math.max(0, wordBreaks.intAt(index));
+ final int end = wordBreaks.intAt(index + 1);
+ final CharSequence wordChunk = sequence.subSequence(start, end);
+ wordChunks.add(wordChunk);
+ }
+ final int finalStart = wordBreaks.lastInt();
+ final int finalEnd = sequence.length();
+ final CharSequence finalWordChunk = sequence.subSequence(finalStart, finalEnd);
+ wordChunks.add(finalWordChunk);
+ return wordChunks;
+ }
+
+ /**
+ * Records the index to the beginning of each word and interword area in an integer array.
+ * Even-numbered indexes in the array always point to the beginning of a word, and odd-numbered indexes always point
+ * to interword content.
+ * In the normal case that the sequence starts with a word, element 0 will always be 0.
+ * In the case that the sequence actually starts with interword content, element 0 will always be -1,
+ * element 1 will always be 0 to mark the beginning of the leading interword content, and element 2 will always mark
+ * the beginning of the first word.
+ * The element at index n+1 will always be greater than the element at index n.
+ * All content in the sequence is accounted for.
+ * @param sequence The character sequence to be parsed.
+ * @return An array of integers that marks the beginning of each word and interword item.
+ */
+ public IntArray findWordBreaks(final CharSequence sequence) {
+ final IntArrayBuilder builder = new IntArrayBuilder();
+ boolean inWord = false;
+
+ for (int index = 0; index < sequence.length(); index++) {
+ final boolean isWordChar = isWordChar(sequence, index);
+ switch (index) {
+ case 0: {
+ if (isWordChar) {
+ inWord = true;
+ builder.append(index);
+ } else {
+ builder.append(-1);
+ builder.append(index);
+ }
+ break;
+ }
+ default: {
+ if (isWordChar) {
+ if (! inWord) {
+ inWord = true;
+ builder.append(index);
+ }
+ } else {
+ if (inWord) {
+ inWord = false;
+ builder.append(index);
+ }
+ }
+
+ }
+ }
+ }
+
+ return builder.toIntArray();
+ }
+
+ /**
+ * Indicates whether a given character in a sequence should be treated as a word character or not, taking the
+ * context into consideration where necessary.
+ * @param sequence The character sequence.
+ * @param index The index to the item in {@code sequence} that is being tested.
+ * @return True if and only if the char at {@code index} should be treated as a word character.
+ */
+ public boolean isWordChar(final CharSequence sequence, final int index) {
+ if (index < 0
+ || index >= sequence.length()) {
+ return false;
+ }
+ final char c = sequence.charAt(index);
+ final CharType charType = isWordChar(c);
+ switch (charType) {
+ case ALWAYS_WORD_CHAR: {
+ return true;
+ }
+ case NEVER_WORD_CHAR: {
+ return false;
+ }
+ case SOMETIMES_WORD_CHAR: {
+ return resolveSometimesCase(sequence, index);
+ }
+ default: {
+ throw new IllegalStateException("Unexpected isWordChar value: " + charType);
+ }
+ }
+ }
+
+ /**
+ * Indicates whether a given character is a word character.
+ * Subclasses should override this as needed.
+ * @param c The character being tested.
+ * @return Indication of whether {@code c} is always a word character, never one, or sometimes one.
+ */
+ public CharType isWordChar(final char c) {
+ final int type = Character.getType(c);
+
+ switch (type) {
+ /* Ordered by expected frequency of use, for performance. */
+ case Character.LOWERCASE_LETTER:
+ case Character.UPPERCASE_LETTER:
+ case Character.TITLECASE_LETTER:
+ case Character.MODIFIER_LETTER:
+ case Character.OTHER_LETTER:
+ case Character.DECIMAL_DIGIT_NUMBER:
+ case Character.CURRENCY_SYMBOL:
+ case Character.MATH_SYMBOL:
+ case Character.LETTER_NUMBER:
+ case Character.OTHER_NUMBER:
+ case Character.OTHER_SYMBOL: {
+ return CharType.ALWAYS_WORD_CHAR;
+ }
+ /* Comment out the "false" values, for performance. */
+// case Character.COMBINING_SPACING_MARK:
+// case Character.CONNECTOR_PUNCTUATION:
+// case Character.CONTROL:
+// case Character.DASH_PUNCTUATION:
+// case Character.ENCLOSING_MARK:
+// case Character.END_PUNCTUATION:
+// case Character.FINAL_QUOTE_PUNCTUATION:
+// case Character.FORMAT:
+// case Character.INITIAL_QUOTE_PUNCTUATION:
+// case Character.LINE_SEPARATOR:
+// case Character.MODIFIER_SYMBOL:
+// case Character.NON_SPACING_MARK:
+// case Character.OTHER_PUNCTUATION:
+// case Character.PARAGRAPH_SEPARATOR:
+// case Character.PRIVATE_USE:
+// case Character.SPACE_SEPARATOR:
+// case Character.START_PUNCTUATION:
+// case Character.SURROGATE:
+// case Character.UNASSIGNED: {
+// return false;
+// }
+ default: {
+ break;
+ }
+ }
+
+ if (isSometimesWordChar(c)) {
+ return CharType.SOMETIMES_WORD_CHAR;
+ }
+ return CharType.NEVER_WORD_CHAR;
+ }
+
+ /**
+ * Indicates whether a char is a possible word character, depending on context.
+ * For example, in English, a single quote or typographic apostrophe could be the end of a quotation (not a word
+ * character), or mark a contraction or possession (is a word character).
+ * @param c The character to be tested.
+ * @return True if and only if {@code c} is sometimes (but not always) a word character.
+ */
+ public abstract boolean isSometimesWordChar(char c);
+
+ /**
+ * Indicates whether a given character, which should have already been identified as being
+ * {@link CharType#SOMETIMES_WORD_CHAR} a word character, should be treated as a word character, taking context
+ * into consideration.
+ * @param sequence The entire sequence under examination.
+ * @param index The index of the character being tested.
+ * @return True if and only if the character at {@code index} should be considered a word character in this
+ * context.
+ */
+ public abstract boolean resolveSometimesCase(CharSequence sequence, int index);
+
+ /**
+ * Index-safe query into a specific char in a sequence, indicating whether it is always a word char or not.
+ * A return value of false does <em>not</em> mean that the char should not be treated as a word char in this case,
+ * only that it might not be.
+ * This is a convenience method that helps subclasses see other characters in the context of the entire sequence.
+ * For example, if the index "i" being tested in {@link #isWordChar(char)} contains a "sometimes" char, this method
+ * can be used to easily determine if the previous char is always a word char: isAlwaysWordChar(sequence, n - 1).
+ * @param sequence The sequence to be tested.
+ * @param index The index to the char in {@code sequence} that is being tested.
+ * If this index is an out-of-bounds value, this method will return false.
+ * @return True if and only if the char at {@code index} is always a word char.
+ */
+ public boolean isAlwaysWordChar(final CharSequence sequence, final int index) {
+ if (index < 0
+ || index >= sequence.length()) {
+ return false;
+ }
+ final char c = sequence.charAt(index);
+ final CharType charType = isWordChar(c);
+ return charType == CharType.ALWAYS_WORD_CHAR;
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerDefault.java (from rev 12032, trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerDefault.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerDefault.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerDefault.java 2021-11-12 17:21:29 UTC (rev 12050)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2019 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;
+
+/**
+ * A default Lexer implementation that uses only the Unicode character information to determine whether a given
+ * character in a sequence is part of a word or not.
+ */
+public class LexerDefault extends Lexer4a {
+
+ @Override
+ public boolean isSometimesWordChar(final char c) {
+ return false;
+ }
+
+ @Override
+ public boolean resolveSometimesCase(final CharSequence sequence, final int index) {
+ return false;
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerLatin1.java (from rev 12032, trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerLatin1.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerLatin1.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerLatin1.java 2021-11-12 17:21:29 UTC (rev 12050)
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2019 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;
+
+import org.foray.common.primitive.CharacterUtils;
+
+/**
+ * A {@link Lexer4a} implementation that is intended for general use for Latin writing systems.
+ */
+public class LexerLatin1 extends Lexer4a {
+
+ @Override
+ public CharType isWordChar(final char c) {
+ switch (c) {
+ case '-': return CharType.ALWAYS_WORD_CHAR;
+ default: return super.isWordChar(c);
+ }
+ }
+
+ @Override
+ public boolean isSometimesWordChar(final char c) {
+ switch (c) {
+ /* Typographic apostrophe. */
+ case CharacterUtils.SINGLE_CLOSE_QUOTATION_MARK:
+ case '\'': {
+ return true;
+ }
+ default: {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public boolean resolveSometimesCase(final CharSequence sequence, final int index) {
+ boolean returnValue = false;
+ final char c = sequence.charAt(index);
+// final boolean previousIsAlwaysWordChar = isAlwaysWordChar(sequence, index - 1);
+ final boolean nextIsAlwaysWordChar = isAlwaysWordChar(sequence, index + 1);
+
+ switch (c) {
+ case CharacterUtils.SINGLE_CLOSE_QUOTATION_MARK: {
+ if (nextIsAlwaysWordChar) {
+ /* Looks like a contraction (like can't or 'tis) or possessive (like Harold's). */
+ returnValue = true;
+ }
+ /* TODO: Add logic checking whether this is a closing single quotation mark. */
+ break;
+ }
+ case '\'': {
+ /* Similar to single quotation mark, but this character can also act as an opening quotation mark. */
+ if (nextIsAlwaysWordChar) {
+ /* Looks like a contraction (like can't or 'tis) or possessive (like Harold's). */
+ returnValue = true;
+ }
+ /* TODO: Add logic checking whether this is a closing single quotation mark. */
+ break;
+ }
+ default: {
+ returnValue = false;
+ }
+ }
+ return returnValue;
+ }
+
+}
Deleted: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java 2021-11-12 17:05:59 UTC (rev 12049)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java 2021-11-12 17:21:29 UTC (rev 12050)
@@ -1,268 +0,0 @@
-/*
- * Copyright 2019 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;
-
-import org.foray.common.sequence.IntArray;
-import org.foray.common.sequence.IntArrayBuilder;
-
-import org.axsl.orthography.optional.Lexer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Implementations know how to break a character sequence into words and interword content.
- */
-public abstract class WordBreaker implements Lexer {
-
- /**
- * Enumeration of possible character types, as they relate to word-breaking.
- * This enumeration is useful for some subclasses.
- */
- public enum CharType {
-
- /** Character is always part of a word. */
- ALWAYS_WORD_CHAR,
-
- /** Character is never part of a word. */
- NEVER_WORD_CHAR,
-
- /** Character may be part of a word, depending on context. */
- SOMETIMES_WORD_CHAR;
-
- }
-
- /**
- * Returns the word and interword content of a given character sequence.
- * Even-numbered indexes in the array always contain a word, and odd-numbered indexes always contain interword
- * content.
- * In the case that the sequence actually starts with interword content (instead of the more normal case of starting
- * with a word), element 0 will contain an empty string.
- * @param sequence The character sequence to be parsed.
- * @return The list of word and interword content parsed from {@code sequence}.
- */
- public List<CharSequence> tokenize(final CharSequence sequence) {
- final IntArray wordBreaks = findWordBreaks(sequence);
- final List<CharSequence> wordChunks = new ArrayList<CharSequence>(wordBreaks.length());
- if (wordBreaks.length() < 1) {
- return wordChunks;
- }
- for (int index = 0; index < wordBreaks.length() - 1; index ++) {
- final int start = Math.max(0, wordBreaks.intAt(index));
- final int end = wordBreaks.intAt(index + 1);
- final CharSequence wordChunk = sequence.subSequence(start, end);
- wordChunks.add(wordChunk);
- }
- final int finalStart = wordBreaks.lastInt();
- final int finalEnd = sequence.length();
- final CharSequence finalWordChunk = sequence.subSequence(finalStart, finalEnd);
- wordChunks.add(finalWordChunk);
- return wordChunks;
- }
-
- /**
- * Records the index to the beginning of each word and interword area in an integer array.
- * Even-numbered indexes in the array always point to the beginning of a word, and odd-numbered indexes always point
- * to interword content.
- * In the normal case that the sequence starts with a word, element 0 will always be 0.
- * In the case that the sequence actually starts with interword content, element 0 will always be -1,
- * element 1 will always be 0 to mark the beginning of the leading interword content, and element 2 will always mark
- * the beginning of the first word.
- * The element at index n+1 will always be greater than the element at index n.
- * All content in the sequence is accounted for.
- * @param sequence The character sequence to be parsed.
- * @return An array of integers that marks the beginning of each word and interword item.
- */
- public IntArray findWordBreaks(final CharSequence sequence) {
- final IntArrayBuilder builder = new IntArrayBuilder();
- boolean inWord = false;
-
- for (int index = 0; index < sequence.length(); index++) {
- final boolean isWordChar = isWordChar(sequence, index);
- switch (index) {
- case 0: {
- if (isWordChar) {
- inWord = true;
- builder.append(index);
- } else {
- builder.append(-1);
- builder.append(index);
- }
- break;
- }
- default: {
- if (isWordChar) {
- if (! inWord) {
- inWord = true;
- builder.append(index);
- }
- } else {
- if (inWord) {
- inWord = false;
- builder.append(index);
- }
- }
-
- }
- }
- }
-
- return builder.toIntArray();
- }
-
- /**
- * Indicates whether a given character in a sequence should be treated as a word character or not, taking the
- * context into consideration where necessary.
- * @param sequence The character sequence.
- * @param index The index to the item in {@code sequence} that is being tested.
- * @return True if and only if the char at {@code index} should be treated as a word character.
- */
- public boolean isWordChar(final CharSequence sequence, final int index) {
- if (index < 0
- || index >= sequence.length()) {
- return false;
- }
- final char c = sequence.charAt(index);
- final CharType charType = isWordChar(c);
- switch (charType) {
- case ALWAYS_WORD_CHAR: {
- return true;
- }
- case NEVER_WORD_CHAR: {
- return false;
- }
- case SOMETIMES_WORD_CHAR: {
- return resolveSometimesCase(sequence, index);
- }
- default: {
- throw new IllegalStateException("Unexpected isWordChar value: " + charType);
- }
- }
- }
-
- /**
- * Indicates whether a given character is a word character.
- * Subclasses should override this as needed.
- * @param c The character being tested.
- * @return Indication of whether {@code c} is always a word character, never one, or sometimes one.
- */
- public CharType isWordChar(final char c) {
- final int type = Character.getType(c);
-
- switch (type) {
- /* Ordered by expected frequency of use, for performance. */
- case Character.LOWERCASE_LETTER:
- case Character.UPPERCASE_LETTER:
- case Character.TITLECASE_LETTER:
- case Character.MODIFIER_LETTER:
- case Character.OTHER_LETTER:
- case Character.DECIMAL_DIGIT_NUMBER:
- case Character.CURRENCY_SYMBOL:
- case Character.MATH_SYMBOL:
- case Character.LETTER_NUMBER:
- case Character.OTHER_NUMBER:
- case Character.OTHER_SYMBOL: {
- return CharType.ALWAYS_WORD_CHAR;
- }
- /* Comment out the "false" values, for performance. */
-// case Character.COMBINING_SPACING_MARK:
-// case Character.CONNECTOR_PUNCTUATION:
-// case Character.CONTROL:
-// case Character.DASH_PUNCTUATION:
-// case Character.ENCLOSING_MARK:
-// case Character.END_PUNCTUATION:
-// case Character.FINAL_QUOTE_PUNCTUATION:
-// case Character.FORMAT:
-// case Character.INITIAL_QUOTE_PUNCTUATION:
-// case Character.LINE_SEPARATOR:
-// case Character.MODIFIER_SYMBOL:
-// case Character.NON_SPACING_MARK:
-// case Character.OTHER_PUNCTUATION:
-// case Character.PARAGRAPH_SEPARATOR:
-// case Character.PRIVATE_USE:
-// case Character.SPACE_SEPARATOR:
-// case Character.START_PUNCTUATION:
-// case Character.SURROGATE:
-// case Character.UNASSIGNED: {
-// return false;
-// }
- default: {
- break;
- }
- }
-
- if (isSometimesWordChar(c)) {
- return CharType.SOMETIMES_WORD_CHAR;
- }
- return CharType.NEVER_WORD_CHAR;
- }
-
- /**
- * Indicates whether a char is a possible word character, depending on context.
- * For example, in English, a single quote or typographic apostrophe could be the end of a quotation (not a word
- * character), or mark a contraction or possession (is a word character).
- * @param c The character to be tested.
- * @return True if and only if {@code c} is sometimes (but not always) a word character.
- */
- public abstract boolean isSometimesWordChar(char c);
-
- /**
- * Indicates whether a given character, which should have already been identified as being
- * {@link CharType#SOMETIMES_WORD_CHAR} a word character, should be treated as a word character, taking context
- * into consideration.
- * @param sequence The entire sequence under examination.
- * @param index The index of the character being tested.
- * @return True if and only if the character at {@code index} should be considered a word character in this
- * context.
- */
- public abstract boolean resolveSometimesCase(CharSequence sequence, int index);
-
- /**
- * Index-safe query into a specific char in a sequence, indicating whether it is always a word char or not.
- * A return value of false does <em>not</em> mean that the char should not be treated as a word char in this case,
- * only that it might not be.
- * This is a convenience method that helps subclasses see other characters in the context of the entire sequence.
- * For example, if the index "i" being tested in {@link #isWordChar(char)} contains a "sometimes" char, this method
- * can be used to easily determine if the previous char is always a word char: isAlwaysWordChar(sequence, n - 1).
- * @param sequence The sequence to be tested.
- * @param index The index to the char in {@code sequence} that is being tested.
- * If this index is an out-of-bounds value, this method will return false.
- * @return True if and only if the char at {@code index} is always a word char.
- */
- public boolean isAlwaysWordChar(final CharSequence sequence, final int index) {
- if (index < 0
- || index >= sequence.length()) {
- return false;
- }
- final char c = sequence.charAt(index);
- final CharType charType = isWordChar(c);
- return charType == CharType.ALWAYS_WORD_CHAR;
- }
-
-}
Deleted: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerDefault.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerDefault.java 2021-11-12 17:05:59 UTC (rev 12049)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerDefault.java 2021-11-12 17:21:29 UTC (rev 12050)
@@ -1,47 +0,0 @@
-/*
- * Copyright 2019 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;
-
-/**
- * A default implementation of that uses only the Unicode character information to determine whether a given character
- * in a sequence is part of a word or not.
- */
-public class WordBreakerDefault extends WordBreaker {
-
- @Override
- public boolean isSometimesWordChar(final char c) {
- return false;
- }
-
- @Override
- public boolean resolveSometimesCase(final CharSequence sequence, final int index) {
- return false;
- }
-
-}
Deleted: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerLatin1.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerLatin1.java 2021-11-12 17:05:59 UTC (rev 12049)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerLatin1.java 2021-11-12 17:21:29 UTC (rev 12050)
@@ -1,92 +0,0 @@
-/*
- * Copyright 2019 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;
-
-import org.foray.common.primitive.CharacterUtils;
-
-/**
- * A {@link WordBreaker} implementation that is intended for general use for Latin writing systems.
- */
-public class WordBreakerLatin1 extends WordBreaker {
-
- @Override
- public CharType isWordChar(final char c) {
- switch (c) {
- case '-': return CharType.ALWAYS_WORD_CHAR;
- default: return super.isWordChar(c);
- }
- }
-
- @Override
- public boolean isSometimesWordChar(final char c) {
- switch (c) {
- /* Typographic apostrophe. */
- case CharacterUtils.SINGLE_CLOSE_QUOTATION_MARK:
- case '\'': {
- return true;
- }
- default: {
- return false;
- }
- }
- }
-
- @Override
- public boolean resolveSometimesCase(final CharSequence sequence, final int index) {
- boolean returnValue = false;
- final char c = sequence.charAt(index);
-// final boolean previousIsAlwaysWordChar = isAlwaysWordChar(sequence, index - 1);
- final boolean nextIsAlwaysWordChar = isAlwaysWordChar(sequence, index + 1);
-
- switch (c) {
- case CharacterUtils.SINGLE_CLOSE_QUOTATION_MARK: {
- if (nextIsAlwaysWordChar) {
- /* Looks like a contraction (like can't or 'tis) or possessive (like Harold's). */
- returnValue = true;
- }
- /* TODO: Add logic checking whether this is a closing single quotation mark. */
- break;
- }
- case '\'': {
- /* Similar to single quotation mark, but this character can also act as an opening quotation mark. */
- if (nextIsAlwaysWordChar) {
- /* Looks like a contraction (like can't or 'tis) or possessive (like Harold's). */
- returnValue = true;
- }
- /* TODO: Add logic checking whether this is a closing single quotation mark. */
- break;
- }
- default: {
- returnValue = false;
- }
- }
- return returnValue;
- }
-
-}
Copied: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerLatin1Tests.java (from rev 12048, trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.java)
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerLatin1Tests.java (rev 0)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerLatin1Tests.java 2021-11-12 17:21:29 UTC (rev 12050)
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2019 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;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.List;
+
+/**
+ * Tests of {@link LexerLatin1}.
+ */
+public class LexerLatin1Tests {
+
+ /** The object under test. */
+ private LexerLatin1 out;
+
+ /**
+ * Setup the test.
+ */
+ @Before
+ public void setupTest() {
+ this.out = new LexerLatin1();
+ }
+
+ /**
+ * A simple test of {@link LexerLatin1#breakIntoWords(CharSequence)}.
+ */
+ @Test
+ public void testBreakSimple() {
+ final String testString = "Beware the ides of March.";
+ final List<CharSequence> actual = this.out.tokenize(testString);
+ Assert.assertEquals(10, actual.size());
+ Assert.assertEquals("Beware", actual.get(0));
+ Assert.assertEquals(" ", actual.get(1));
+ Assert.assertEquals("the", actual.get(2));
+ Assert.assertEquals(" ", actual.get(3));
+ Assert.assertEquals("ides", actual.get(4));
+ Assert.assertEquals(" ", actual.get(5));
+ Assert.assertEquals("of", actual.get(6));
+ Assert.assertEquals(" ", actual.get(7));
+ Assert.assertEquals("March", actual.get(8));
+ Assert.assertEquals(".", actual.get(9));
+ }
+
+ /**
+ * A more complicated test of {@link LexerLatin1#breakIntoWords(CharSequence)}.
+ */
+ @Test
+ public void testMedium() {
+ final String testString = "39. It was the best of times. It was the worst of times. <----";
+ final List<CharSequence> actual = this.out.tokenize(testString);
+ Assert.assertEquals(27, actual.size());
+ Assert.assertEquals("39", actual.get(0));
+ Assert.assertEquals(". ", actual.get(1));
+ Assert.assertEquals("It", actual.get(2));
+ Assert.assertEquals(" ", actual.get(3));
+ Assert.assertEquals("was", actual.get(4));
+ Assert.assertEquals(" ", actual.get(5));
+ Assert.assertEquals("the", actual.get(6));
+ Assert.assertEquals(" ", actual.get(7));
+ Assert.assertEquals("best", actual.get(8));
+ Assert.assertEquals(" ", actual.get(9));
+ Assert.assertEquals("of", actual.get(10));
+ Assert.assertEquals(" ", actual.get(11));
+ Assert.assertEquals("times", actual.get(12));
+ Assert.assertEquals(". ", actual.get(13));
+ Assert.assertEquals("It", actual.get(14));
+ Assert.assertEquals(" ", actual.get(15));
+ Assert.assertEquals("was", actual.get(16));
+ Assert.assertEquals(" ", actual.get(17));
+ Assert.assertEquals("the", actual.get(18));
+ Assert.assertEquals(" ", actual.get(19));
+ Assert.assertEquals("worst", actual.get(20));
+ Assert.assertEquals(" ", actual.get(21));
+ Assert.assertEquals("of", actual.get(22));
+ Assert.assertEquals(" ", actual.get(23));
+ Assert.assertEquals("times", actual.get(24));
+ Assert.assertEquals(". ", actual.get(25));
+ Assert.assertEquals("<----", actual.get(26));
+ }
+
+ /**
+ * Test of {@link LexerLatin1#breakIntoWords(CharSequence)} with a compound word.
+ */
+ @Test
+ public void testWithCompoundWord() {
+ /* Spoken by Juliet, Romeo & Juliet, Act 3 Scene 2. */
+ final String testString = "Gallop apace, you fiery-footed steeds,";
+ final List<CharSequence> actual = this.out.tokenize(testString);
+
+ /* Compound word "fiery-footed" treated as one word. */
+ Assert.assertEquals(10, actual.size());
+ Assert.assertEquals("Gallop", actual.get(0));
+ Assert.assertEquals(" ", actual.get(1));
+ Assert.assertEquals("apace", actual.get(2));
+ Assert.assertEquals(", ", actual.get(3));
+ Assert.assertEquals("you", actual.get(4));
+ Assert.assertEquals(" ", actual.get(5));
+ Assert.assertEquals("fiery-footed", actual.get(6));
+ Assert.assertEquals(" ", actual.get(7));
+ Assert.assertEquals("steeds", actual.get(8));
+ Assert.assertEquals(",", actual.get(9));
+ }
+
+ /**
+ * Test of {@link LexerLatin1#breakIntoWords(CharSequence)} with a mid-word contraction.
+ */
+ @Test
+ public void testWithMidWordContractionApostrophe() {
+ /* Spoken by Hamlet, Hamlet, Act 2, Scene 2. */
+ final String testString = "The play's the thing";
+ final List<CharSequence> actual = this.out.tokenize(testString);
+ Assert.assertEquals(7, actual.size());
+ Assert.assertEquals("The", actual.get(0));
+ Assert.assertEquals(" ", actual.get(1));
+ Assert.assertEquals("play's", actual.get(2));
+ Assert.assertEquals(" ", actual.get(3));
+ Assert.assertEquals("the", actual.get(4));
+ Assert.assertEquals(" ", actual.get(5));
+ Assert.assertEquals("thing", actual.get(6));
+ }
+
+}
Deleted: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.java 2021-11-12 17:05:59 UTC (rev 12049)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.java 2021-11-12 17:21:29 UTC (rev 12050)
@@ -1,151 +0,0 @@
-/*
- * Copyright 2019 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;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.List;
-
-/**
- * Tests of {@link WordBreakerLatin1}.
- */
-public class WordBreakerLatin1Tests {
-
- /** The object under test. */
- private WordBreakerLatin1 out;
-
- /**
- * Setup the test.
- */
- @Before
- public void setupTest() {
- this.out = new WordBreakerLatin1();
- }
-
- /**
- * A simple test of {@link WordBreakerLatin1#breakIntoWords(CharSequence)}.
- */
- @Test
- public void testBreakSimple() {
- final String testString = "Beware the ides of March.";
- final List<CharSequence> actual = this.out.tokenize(testString);
- Assert.assertEquals(10, actual.size());
- Assert.assertEquals("Beware", actual.get(0));
- Assert.assertEquals(" ", actual.get(1));
- Assert.assertEquals("the", actual.get(2));
- Assert.assertEquals(" ", actual.get(3));
- Assert.assertEquals("ides", actual.get(4));
- Assert.assertEquals(" ", actual.get(5));
- Assert.assertEquals("of", actual.get(6));
- Assert.assertEquals(" ", actual.get(7));
- Assert.assertEquals("March", actual.get(8));
- Assert.assertEquals(".", actual.get(9));
- }
-
- /**
- * A more complicated test of {@link WordBreakerLatin1#breakIntoWords(CharSequence)}.
- */
- @Test
- public void testMedium() {
- final String testString = "39. It was the best of times. It was the worst of times. <----";
- final List<CharSequence> actual = this.out.tokenize(testString);
- Assert.assertEquals(27, actual.size());
- Assert.assertEquals("39", actual.get(0));
- Assert.assertEquals(". ", actual.get(1));
- Assert.assertEquals("It", actual.get(2));
- Assert.assertEquals(" ", actual.get(3));
- Assert.assertEquals("was", actual.get(4));
- Assert.assertEquals(" ", actual.get(5));
- Assert.assertEquals("the", actual.get(6));
- Assert.assertEquals(" ", actual.get(7));
- Assert.assertEquals("best", actual.get(8));
- Assert.assertEquals(" ", actual.get(9));
- Assert.assertEquals("of", actual.get(10));
- Assert.assertEquals(" ", actual.get(11));
- Assert.assertEquals("times", actual.get(12));
- Assert.assertEquals(". ", actual.get(13));
- Assert.assertEquals("It", actual.get(14));
- Assert.assertEquals(" ", actual.get(15));
- Assert.assertEquals("was", actual.get(16));
- Assert.assertEquals(" ", actual.get(17));
- Assert.assertEquals("the", actual.get(18));
- Assert.assertEquals(" ", actual.get(19));
- Assert.assertEquals("worst", actual.get(20));
- Assert.assertEquals(" ", actual.get(21));
- Assert.assertEquals("of", actual.get(22));
- Assert.assertEquals(" ", actual.get(23));
- Assert.assertEquals("times", actual.get(24));
- Assert.assertEquals(". ", actual.get(25));
- Assert.assertEquals("<----", actual.get(26));
- }
-
- /**
- * Test of {@link WordBreakerLatin1#breakIntoWords(CharSequence)} with a compound word.
- */
- @Test
- public void testWithCompoundWord() {
- /* Spoken by Juliet, Romeo & Juliet, Act 3 Scene 2. */
- final String testString = "Gallop apace, you fiery-footed steeds,";
- final List<CharSequence> actual = this.out.tokenize(testString);
-
- /* Compound word "fiery-footed" treated as one word. */
- Assert.assertEquals(10, actual.size());
- Assert.assertEquals("Gallop", actual.get(0));
- Assert.assertEquals(" ", actual.get(1));
- Assert.assertEquals("apace", actual.get(2));
- Assert.assertEquals(", ", actual.get(3));
- Assert.assertEquals("you", actual.get(4));
- Assert.assertEquals(" ", actual.get(5));
- Assert.assertEquals("fiery-footed", actual.get(6));
- Assert.assertEquals(" ", actual.get(7));
- Assert.assertEquals("steeds", actual.get(8));
- Assert.assertEquals(",", actual.get(9));
- }
-
- /**
- * Test of {@link WordBreakerLatin1#breakIntoWords(CharSequence)} with a mid-word contraction.
- */
- @Test
- public void testWithMidWordContractionApostrophe() {
- /* Spoken by Hamlet, Hamlet, Act 2, Scene 2. */
- final String testString = "The play's the thing";
- final List<CharSequence> actual = this.out.tokenize(testString);
- Assert.assertEquals(7, actual.size());
- Assert.assertEquals("The", actual.get(0));
- Assert.assertEquals(" ", actual.get(1));
- Assert.assertEquals("play's", actual.get(2));
- Assert.assertEquals(" ", actual.get(3));
- Assert.assertEquals("the", actual.get(4));
- Assert.assertEquals(" ", actual.get(5));
- Assert.assertEquals("thing", actual.get(6));
- }
-
-}
Modified: trunk/foray/foray-orthography/src/test/resources/orthography-config.xml
===================================================================
--- trunk/foray/foray-orthography/src/test/resources/orthography-config.xml 2021-11-12 17:05:59 UTC (rev 12049)
+++ trunk/foray/foray-orthography/src/test/resources/orthography-config.xml 2021-11-12 17:21:29 UTC (rev 12050)
@@ -129,7 +129,7 @@
<dictionary reference="dictionary-eng-moby"/>
<hyphenation-patterns reference="hyph-patterns-eng"/>
<derivative-factories reference="derivatives-eng"/>
- <lexer class="org.foray.orthography.WordBreakerLatin1"/>
+ <lexer class="org.foray.orthography.LexerLatin1"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Latn"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Zyyy"/>
</configuration>
@@ -136,43 +136,43 @@
<configuration>
<hyphenation-patterns reference="hyph-patterns-fin"/>
- <lexer class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.LexerDefault"/>
<orthography language-iso-3char="fin" country-iso-3char="FIN" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-hun"/>
- <lexer class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.LexerDefault"/>
<orthography language-iso-3char="hun" country-iso-3char="HUN" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-ita"/>
- <lexer class="org.foray.orthography.WordBreakerLatin1"/>
+ <lexer class="org.foray.orthography.LexerLatin1"/>
<orthography language-iso-3char="ita" country-iso-3char="ITA" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-pol"/>
- <lexer class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.LexerDefault"/>
<orthography language-iso-3char="pol" country-iso-3char="POL" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-por"/>
- <lexer class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.LexerDefault"/>
<orthography language-iso-3char="por" country-iso-3char="PRT" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-rus"/>
- <lexer class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.LexerDefault"/>
<orthography language-iso-3char="rus" country-iso-3char="RUS" script-iso-4char="Cyrl"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-spa"/>
- <lexer class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.LexerDefault"/>
<orthography language-iso-3char="spa" country-iso-3char="ESP" script-iso-4char="Latn"/>
</configuration>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 17:06:02
|
Revision: 12049
http://sourceforge.net/p/foray/code/12049
Author: victormote
Date: 2021-11-12 17:05:59 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Conform to aXSL change: Move Dictionary to the "optional" package.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativePattern.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapperFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPast1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural2WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive2WordFactoryTests.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativePattern.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativePattern.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativePattern.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -28,8 +28,8 @@
package org.foray.orthography;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Word;
+import org.axsl.orthography.optional.Dictionary;
import java.util.List;
import java.util.regex.Pattern;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -38,9 +38,9 @@
import org.foray.orthography.wrapper.UppercaseWord;
import org.axsl.common.para.ParaConfig;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Orthography;
import org.axsl.orthography.Word;
+import org.axsl.orthography.optional.Dictionary;
import org.axsl.orthography.optional.Lexer;
import java.util.ArrayList;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -30,9 +30,9 @@
import org.foray.common.data.TernaryTreeMap;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Word.PartOfSpeech;
import org.axsl.orthography.Word.PosQualifier;
+import org.axsl.orthography.optional.Dictionary;
import java.util.Arrays;
import java.util.HashMap;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapperFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapperFactory.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapperFactory.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -28,7 +28,7 @@
package org.foray.orthography;
-import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.optional.Dictionary;
/**
* Factory that knows how to create an instance of a {@link WordWrapper}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -41,8 +41,8 @@
import org.foray.orthography.SegmentDictionary;
import org.axsl.common.i18n.WritingSystem;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.OrthographyException;
+import org.axsl.orthography.optional.Dictionary;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -34,8 +34,8 @@
import org.foray.orthography.OrthographyServerConfig;
import org.foray.orthography.SegmentDictionary;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.OrthographyException;
+import org.axsl.orthography.optional.Dictionary;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Word;
+import org.axsl.orthography.optional.Dictionary;
/**
* Factory class for {@link LatinPast1Word}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Word;
+import org.axsl.orthography.optional.Dictionary;
/**
* Factory class for {@link LatinPlural1Word}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Word;
+import org.axsl.orthography.optional.Dictionary;
/**
* Factory class for {@link LatinPlural2Word}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Word;
+import org.axsl.orthography.optional.Dictionary;
/**
* Factory class for {@link LatinPossessive1Word}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Word;
+import org.axsl.orthography.optional.Dictionary;
/**
* Factory class for {@link LatinPossessive2Word}.
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPast1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPast1WordFactoryTests.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPast1WordFactoryTests.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -30,7 +30,7 @@
import org.foray.orthography.StringWordTests;
-import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.optional.Dictionary;
import org.junit.Assert;
import org.junit.Before;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural1WordFactoryTests.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural1WordFactoryTests.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -30,7 +30,7 @@
import org.foray.orthography.StringWordTests;
-import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.optional.Dictionary;
import org.junit.Assert;
import org.junit.Before;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural2WordFactoryTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural2WordFactoryTests.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural2WordFactoryTests.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -30,7 +30,7 @@
import org.foray.orthography.StringWordTests;
-import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.optional.Dictionary;
import org.junit.Assert;
import org.junit.Before;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive1WordFactoryTests.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive1WordFactoryTests.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -30,7 +30,7 @@
import org.foray.orthography.StringWordTests;
-import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.optional.Dictionary;
import org.junit.Assert;
import org.junit.Before;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive2WordFactoryTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive2WordFactoryTests.java 2021-11-12 16:43:31 UTC (rev 12048)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive2WordFactoryTests.java 2021-11-12 17:05:59 UTC (rev 12049)
@@ -30,7 +30,7 @@
import org.foray.orthography.StringWordTests;
-import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.optional.Dictionary;
import org.junit.Assert;
import org.junit.Before;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 16:43:34
|
Revision: 12048
http://sourceforge.net/p/foray/code/12048
Author: victormote
Date: 2021-11-12 16:43:31 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Tie in with new optional aXSL interface Lexer.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.java
trunk/foray/foray-orthography/src/test/resources/orthography-config.xml
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 2021-11-12 13:23:32 UTC (rev 12047)
+++ trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml 2021-11-12 16:43:31 UTC (rev 12048)
@@ -196,7 +196,7 @@
<dictionary reference="dictionary-eng-moby"/>
<hyphenation-patterns reference="hyph-patterns-eng"/>
<derivative-factories reference="eng-999-derivatives"/>
- <word-breaker class="org.foray.orthography.WordBreakerLatin1"/>
+ <lexer class="org.foray.orthography.WordBreakerLatin1"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Latn"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Zyyy"/>
<orthography language-iso-3char="eng" country-iso-3char="999" script-iso-4char="Latn"/>
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 13:23:32 UTC (rev 12047)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 16:43:31 UTC (rev 12048)
@@ -41,6 +41,7 @@
import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Orthography;
import org.axsl.orthography.Word;
+import org.axsl.orthography.optional.Lexer;
import java.util.ArrayList;
import java.util.List;
@@ -67,8 +68,8 @@
/** The list of word wrapper factories for this orthography. */
private List<WordWrapperFactory<?>> wordWrapperFactories = new ArrayList<WordWrapperFactory<?>>();
- /** The word breaker for this orthography. */
- private WordBreaker wordBreaker;
+ /** The lexer for this orthography. */
+ private Lexer lexer;
/** The parent hyphenation server. */
private OrthographyServer4a server;
@@ -178,19 +179,19 @@
}
/**
- * Returns the word breaker.
- * @return The word breaker.
+ * Returns the lexer.
+ * @return The lexer.
*/
- public WordBreaker getWordBreaker() {
- return this.wordBreaker;
+ public Lexer getLexer() {
+ return this.lexer;
}
/**
- * Sets the word breaker.
- * @param wordBreaker The word breaker to set.
+ * Sets the lexer.
+ * @param lexer The lexer to set.
*/
- public void setWordBreaker(final WordBreaker wordBreaker) {
- this.wordBreaker = wordBreaker;
+ public void setLexer(final Lexer lexer) {
+ this.lexer = lexer;
}
/**
@@ -407,8 +408,7 @@
final ParaConfig paraConfig) {
final ParaBranch4a wordSequence = new ParaBranch4a(paraConfig);
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
- final WordBreaker wordBreaker = getWordBreaker();
- final List<CharSequence> chunks = wordBreaker.breakIntoWords(sequence);
+ final List<CharSequence> chunks = this.lexer.tokenize(sequence);
for (int chunkIndex = 0; chunkIndex < chunks.size(); chunkIndex ++) {
final CharSequence chunk = chunks.get(chunkIndex);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java 2021-11-12 13:23:32 UTC (rev 12047)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java 2021-11-12 16:43:31 UTC (rev 12048)
@@ -31,6 +31,8 @@
import org.foray.common.sequence.IntArray;
import org.foray.common.sequence.IntArrayBuilder;
+import org.axsl.orthography.optional.Lexer;
+
import java.util.ArrayList;
import java.util.List;
@@ -37,7 +39,7 @@
/**
* Implementations know how to break a character sequence into words and interword content.
*/
-public abstract class WordBreaker {
+public abstract class WordBreaker implements Lexer {
/**
* Enumeration of possible character types, as they relate to word-breaking.
@@ -65,7 +67,7 @@
* @param sequence The character sequence to be parsed.
* @return The list of word and interword content parsed from {@code sequence}.
*/
- public List<CharSequence> breakIntoWords(final CharSequence sequence) {
+ public List<CharSequence> tokenize(final CharSequence sequence) {
final IntArray wordBreaks = findWordBreaks(sequence);
final List<CharSequence> wordChunks = new ArrayList<CharSequence>(wordBreaks.length());
if (wordBreaks.length() < 1) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 13:23:32 UTC (rev 12047)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 16:43:31 UTC (rev 12048)
@@ -44,7 +44,6 @@
import org.foray.orthography.Orthography4a;
import org.foray.orthography.OrthographyServer4a;
import org.foray.orthography.PosUtils;
-import org.foray.orthography.WordBreaker;
import org.foray.orthography.WordWrapperFactory;
import org.axsl.orthography.OrthographyException;
@@ -52,6 +51,7 @@
import org.axsl.orthography.Word.DerivativeType;
import org.axsl.orthography.Word.PartOfSpeech;
import org.axsl.orthography.Word.PosQualifier;
+import org.axsl.orthography.optional.Lexer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -293,13 +293,13 @@
this.currentDerivateFactoryList.add(factory);
return;
}
- case "word-breaker": {
+ case "lexer": {
final String className = attributes.getValue("class");
- final WordBreaker breaker = instantiate(className, WordBreaker.class);
- if (breaker == null) {
+ final Lexer lexer = instantiate(className, Lexer.class);
+ if (lexer == null) {
return;
}
- this.currentOrthographyConfig.setWordBreaker(breaker);
+ this.currentOrthographyConfig.setLexer(lexer);
return;
}
case "exclusion": {
@@ -619,7 +619,7 @@
case "derivative-factory": {
return;
}
- case "word-breaker": {
+ case "lexer": {
return;
}
case "exclusion": {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 13:23:32 UTC (rev 12047)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 16:43:31 UTC (rev 12048)
@@ -398,7 +398,7 @@
List<CharSequence> words = null;
if (this.currentOrthographyConfig != null) {
- words = this.currentOrthographyConfig.getWordBreaker().breakIntoWords(this.charBuffer);
+ words = this.currentOrthographyConfig.getLexer().tokenize(this.charBuffer);
}
checkWords(words);
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.java 2021-11-12 13:23:32 UTC (rev 12047)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.java 2021-11-12 16:43:31 UTC (rev 12048)
@@ -56,7 +56,7 @@
@Test
public void testBreakSimple() {
final String testString = "Beware the ides of March.";
- final List<CharSequence> actual = this.out.breakIntoWords(testString);
+ final List<CharSequence> actual = this.out.tokenize(testString);
Assert.assertEquals(10, actual.size());
Assert.assertEquals("Beware", actual.get(0));
Assert.assertEquals(" ", actual.get(1));
@@ -76,7 +76,7 @@
@Test
public void testMedium() {
final String testString = "39. It was the best of times. It was the worst of times. <----";
- final List<CharSequence> actual = this.out.breakIntoWords(testString);
+ final List<CharSequence> actual = this.out.tokenize(testString);
Assert.assertEquals(27, actual.size());
Assert.assertEquals("39", actual.get(0));
Assert.assertEquals(". ", actual.get(1));
@@ -114,7 +114,7 @@
public void testWithCompoundWord() {
/* Spoken by Juliet, Romeo & Juliet, Act 3 Scene 2. */
final String testString = "Gallop apace, you fiery-footed steeds,";
- final List<CharSequence> actual = this.out.breakIntoWords(testString);
+ final List<CharSequence> actual = this.out.tokenize(testString);
/* Compound word "fiery-footed" treated as one word. */
Assert.assertEquals(10, actual.size());
@@ -137,7 +137,7 @@
public void testWithMidWordContractionApostrophe() {
/* Spoken by Hamlet, Hamlet, Act 2, Scene 2. */
final String testString = "The play's the thing";
- final List<CharSequence> actual = this.out.breakIntoWords(testString);
+ final List<CharSequence> actual = this.out.tokenize(testString);
Assert.assertEquals(7, actual.size());
Assert.assertEquals("The", actual.get(0));
Assert.assertEquals(" ", actual.get(1));
Modified: trunk/foray/foray-orthography/src/test/resources/orthography-config.xml
===================================================================
--- trunk/foray/foray-orthography/src/test/resources/orthography-config.xml 2021-11-12 13:23:32 UTC (rev 12047)
+++ trunk/foray/foray-orthography/src/test/resources/orthography-config.xml 2021-11-12 16:43:31 UTC (rev 12048)
@@ -129,7 +129,7 @@
<dictionary reference="dictionary-eng-moby"/>
<hyphenation-patterns reference="hyph-patterns-eng"/>
<derivative-factories reference="derivatives-eng"/>
- <word-breaker class="org.foray.orthography.WordBreakerLatin1"/>
+ <lexer class="org.foray.orthography.WordBreakerLatin1"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Latn"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Zyyy"/>
</configuration>
@@ -136,43 +136,43 @@
<configuration>
<hyphenation-patterns reference="hyph-patterns-fin"/>
- <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="fin" country-iso-3char="FIN" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-hun"/>
- <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="hun" country-iso-3char="HUN" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-ita"/>
- <word-breaker class="org.foray.orthography.WordBreakerLatin1"/>
+ <lexer class="org.foray.orthography.WordBreakerLatin1"/>
<orthography language-iso-3char="ita" country-iso-3char="ITA" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-pol"/>
- <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="pol" country-iso-3char="POL" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-por"/>
- <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="por" country-iso-3char="PRT" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-rus"/>
- <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="rus" country-iso-3char="RUS" script-iso-4char="Cyrl"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-spa"/>
- <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
+ <lexer class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="spa" country-iso-3char="ESP" script-iso-4char="Latn"/>
</configuration>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 13:23:35
|
Revision: 12047
http://sourceforge.net/p/foray/code/12047
Author: victormote
Date: 2021-11-12 13:23:32 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Conform to aXSL changes: Move Word-related enums inside the Word interface.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/AmbiguousWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativeRule.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PosUtils.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PosUtilsTests.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/AmbiguousWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/AmbiguousWord.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/AmbiguousWord.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -30,7 +30,7 @@
import org.foray.common.primitive.CharSequenceUtils;
-import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.Word;
/**
* Container for words that are spelled the same, but that have different hyphenation, depending on part-of-speech.
@@ -79,7 +79,7 @@
* @return The first alternative matching {@code pos}, or the first alternative if {@code pos} is null or not
* matched.
*/
- public T getBest(final PartOfSpeech pos) {
+ public T getBest(final Word.PartOfSpeech pos) {
if (pos == null) {
return this.alternatives[0];
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativeRule.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativeRule.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativeRule.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -28,10 +28,8 @@
package org.foray.orthography;
-import org.axsl.orthography.DerivativeType;
-import org.axsl.orthography.PartOfSpeech;
-import org.axsl.orthography.PosQualifier;
import org.axsl.orthography.Word;
+import org.axsl.orthography.Word.DerivativeType;
import java.util.ArrayList;
import java.util.Collections;
@@ -43,19 +41,20 @@
public class DerivativeRule {
/** The part of speech to which the root must belong. */
- private PartOfSpeech rootPos;
+ private Word.PartOfSpeech rootPos;
/** The qualifier that must be true for {@link #rootPos} for this rule to apply. */
- private PosQualifier qualifier;
+ private Word.PosQualifier qualifier;
/** The (unmodifiable) list of derivative types which this rule applies.
* In other words, if this rule applies, identifies the types of derivative that the derivative could be. */
- private List<DerivativeType> types;
+ private List<Word.DerivativeType> types;
- public DerivativeRule(final PartOfSpeech rootPos, final PosQualifier qualifier, final List<DerivativeType> types) {
+ public DerivativeRule(final Word.PartOfSpeech rootPos, final Word.PosQualifier qualifier,
+ final List<Word.DerivativeType> types) {
this.rootPos = rootPos;
this.qualifier = qualifier;
- final List<DerivativeType> defensiveCopy = new ArrayList<DerivativeType>(types.size());
+ final List<Word.DerivativeType> defensiveCopy = new ArrayList<Word.DerivativeType>(types.size());
Collections.copy(types, defensiveCopy);
this.types = Collections.unmodifiableList(defensiveCopy);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -40,7 +40,6 @@
import org.axsl.common.para.ParaConfig;
import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Orthography;
-import org.axsl.orthography.PartOfSpeech;
import org.axsl.orthography.Word;
import java.util.ArrayList;
@@ -261,7 +260,7 @@
}
@Override
- public Word getWord(final CharSequence wordChars, final PartOfSpeech pos,
+ public Word getWord(final CharSequence wordChars, final Word.PartOfSpeech pos,
final List<Dictionary> adhocDictionaries) {
// TODO Auto-generated method stub
return null;
@@ -268,7 +267,7 @@
}
@Override
- public boolean isValidWord(final CharSequence wordChars, final PartOfSpeech pos,
+ public boolean isValidWord(final CharSequence wordChars, final Word.PartOfSpeech pos,
final List<Dictionary> adhocDictionaries) {
if (wordChars.length() < 1) {
return false;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PosUtils.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PosUtils.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PosUtils.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -28,8 +28,8 @@
package org.foray.orthography;
-import org.axsl.orthography.PartOfSpeech;
-import org.axsl.orthography.PosQualifier;
+import org.axsl.orthography.Word.PartOfSpeech;
+import org.axsl.orthography.Word.PosQualifier;
import org.xml.sax.Attributes;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -31,8 +31,8 @@
import org.foray.common.data.TernaryTreeMap;
import org.axsl.orthography.Dictionary;
-import org.axsl.orthography.PartOfSpeech;
-import org.axsl.orthography.PosQualifier;
+import org.axsl.orthography.Word.PartOfSpeech;
+import org.axsl.orthography.Word.PosQualifier;
import java.util.Arrays;
import java.util.HashMap;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -28,8 +28,6 @@
package org.foray.orthography;
-import org.axsl.orthography.PartOfSpeech;
-import org.axsl.orthography.PosQualifier;
import org.axsl.orthography.Word;
import org.axsl.orthography.WordSegment;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -30,9 +30,6 @@
import org.foray.common.primitive.CharSequenceUtils;
-import org.axsl.orthography.PartOfSpeech;
-import org.axsl.orthography.PosQualifier;
-
/**
* A word implementation that wraps a set of {@link StringWordSegmentUtf16}, a thin wrapper around a {@link String}.
* Instances of this class are immutable.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -28,8 +28,6 @@
package org.foray.orthography;
-import org.axsl.orthography.PartOfSpeech;
-import org.axsl.orthography.PosQualifier;
import org.axsl.orthography.Word;
import org.axsl.orthography.WordSegment;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -47,10 +47,11 @@
import org.foray.orthography.WordBreaker;
import org.foray.orthography.WordWrapperFactory;
-import org.axsl.orthography.DerivativeType;
import org.axsl.orthography.OrthographyException;
-import org.axsl.orthography.PartOfSpeech;
-import org.axsl.orthography.PosQualifier;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.Word.DerivativeType;
+import org.axsl.orthography.Word.PartOfSpeech;
+import org.axsl.orthography.Word.PosQualifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -107,7 +108,7 @@
private List<DerivativeRule> currentDerivativeRuleList;
/** Component of: derivative-rule. */
- private PartOfSpeech currentPartOfSpeech;
+ private Word.PartOfSpeech currentPartOfSpeech;
/** Component of: derivative-rule. */
private PosQualifier currentQualifier;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -41,7 +41,7 @@
import org.foray.orthography.StringWordSegmentLatin1Factory;
import org.foray.orthography.StringWordSegmentUtf16Factory;
-import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.Word.PartOfSpeech;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PosUtilsTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PosUtilsTests.java 2021-11-12 12:55:52 UTC (rev 12046)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PosUtilsTests.java 2021-11-12 13:23:32 UTC (rev 12047)
@@ -28,8 +28,8 @@
package org.foray.orthography;
-import org.axsl.orthography.PartOfSpeech;
-import org.axsl.orthography.PosQualifier;
+import org.axsl.orthography.Word.PartOfSpeech;
+import org.axsl.orthography.Word.PosQualifier;
import org.junit.Assert;
import org.junit.Test;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 12:55:55
|
Revision: 12046
http://sourceforge.net/p/foray/code/12046
Author: victormote
Date: 2021-11-12 12:55:52 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Conform to aXSL changes: Delete OrthographyConsumer, moving its remaining functionality to Orthography.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
Removed Paths:
-------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -134,7 +134,7 @@
import org.axsl.font.FontUse;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicServer;
-import org.axsl.orthography.OrthographyConsumer;
+import org.axsl.orthography.OrthographyServer;
import org.axsl.speech.SpeechException;
import org.axsl.speech.SpeechServer;
import org.axsl.speech.Voice;
@@ -3888,11 +3888,11 @@
}
/**
- * Returns the hyphenation consumer.
- * @return The hyphenation consumer.
+ * Returns the orthography server.
+ * @return The orthography server.
*/
- public OrthographyConsumer getHyphenationConsumer() {
- return getParent().getHyphenationConsumer();
+ public OrthographyServer getOrthographyServer() {
+ return getParent().getOrthographyServer();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -42,7 +42,7 @@
import org.axsl.fo.FoTreeListener;
import org.axsl.font.FontConsumer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.orthography.OrthographyConsumer;
+import org.axsl.orthography.OrthographyServer;
import org.axsl.speech.SpeechServer;
import org.axsl.text.TextServer;
@@ -102,8 +102,8 @@
/** The speech server. */
private SpeechServer speechServer;
- /** The hyphenation consumer for this document. */
- private OrthographyConsumer hyphenationConsumer;
+ /** The orthography server for this document. */
+ private OrthographyServer orthographyServer;
/** The paths to search when looking for graphics. */
private URL[] graphicSearchPath;
@@ -534,13 +534,13 @@
}
@Override
- public void setHyphenationConsumer(final OrthographyConsumer hyphenationConsumer) {
- this.hyphenationConsumer = hyphenationConsumer;
+ public void setOrthographyServer(final OrthographyServer orthographyServer) {
+ this.orthographyServer = orthographyServer;
}
@Override
- public OrthographyConsumer getHyphenationConsumer() {
- return this.hyphenationConsumer;
+ public OrthographyServer getOrthographyServer() {
+ return this.orthographyServer;
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -284,7 +284,7 @@
this.getLogger());
foTreeBuilder.setGraphicServer(this.graphicServer);
foTreeBuilder.setTextServer(this.textServer);
- foTreeBuilder.setHyphenationConsumer(this.orthographyServer.makeConsumer());
+ foTreeBuilder.setOrthographyServer(this.orthographyServer);
foTreeBuilder.setGraphicSearchPath(this.graphicSearchPath);
foTreeBuilder.setCachingGraphics(this.cachingGraphics);
return foTreeBuilder;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -37,7 +37,8 @@
import org.axsl.common.value.TextTransform;
import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.fo.FoContext;
-import org.axsl.orthography.OrthographyConsumer;
+import org.axsl.orthography.Orthography;
+import org.axsl.orthography.OrthographyServer;
import java.util.ArrayList;
import java.util.List;
@@ -57,11 +58,12 @@
*/
public FoWordSequence(final FoObj parent, final CharSequence content) {
super(parent);
- final OrthographyConsumer hyphenationConsumer = getHyphenationConsumer();
+ final OrthographyServer orthographyServer = getOrthographyServer();
final ParaConfig4a config = new ParaConfig4a(getPrimaryFont(null), inlineFontSize(), inlineWritingSystem(),
parent.traitWordSpacingMax(null), parent.traitWordSpacingMin(null));
+ final Orthography orthography = orthographyServer.getOrthography(getWritingSystem());
final ParaBranch wordSequence =
- hyphenationConsumer.parseWordSequence(content, 0, content.length(), config);
+ orthography.parseWordSequence(content, 0, content.length(), config);
this.content = new ArrayList<FoWordSequenceContent>(wordSequence.getQtyParaNodeChildren());
for (int index = 0; index < wordSequence.getQtyParaNodeChildren(); index ++) {
final ParaNode wordSequenceContent = wordSequence.getParaNodeChild(index);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -39,7 +39,7 @@
import org.axsl.fo.FoTreeException;
import org.axsl.fo.ProxyFactory;
import org.axsl.font.FontUse;
-import org.axsl.orthography.OrthographyConsumer;
+import org.axsl.orthography.OrthographyServer;
import org.slf4j.Logger;
@@ -511,8 +511,8 @@
}
@Override
- public OrthographyConsumer getHyphenationConsumer() {
- return this.treeBuilder.getHyphenationConsumer();
+ public OrthographyServer getOrthographyServer() {
+ return this.treeBuilder.getOrthographyServer();
}
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -32,7 +32,7 @@
import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.para.ParaBranch4a;
import org.foray.common.para.ParaConfig4a;
-import org.foray.orthography.HyphenationConsumer4a;
+import org.foray.orthography.Orthography4a;
import org.foray.orthography.OrthographyServer4a;
import org.foray.orthography.OrthographyServerConfig;
import org.foray.orthography.StringWord;
@@ -70,8 +70,8 @@
"was bored she took a golden ball, and threw it up on high and caught it; and this ball was her favorite " +
"plaything.";
- /** The hyphenation consumer doing the basic parsing. */
- private HyphenationConsumer4a hyphenationConsumer;
+ /** The orthography server doing the basic parsing. */
+ private OrthographyServer4a orthographyServer;
/** The paragraph configuration to be used for these tests. */
private ParaConfig paraConfig;
@@ -84,8 +84,7 @@
@Before
public void setup() throws IOException, OrthographyException {
final OrthographyServerConfig config = LbTestUtilities.createHyphenationServerConfig();
- final OrthographyServer4a hyphenationServer = new OrthographyServer4a(config);
- this.hyphenationConsumer = hyphenationServer.makeConsumer();
+ this.orthographyServer = new OrthographyServer4a(config);
final Font font = LbTestUtilities.createMonotypeFont();
final FontUse fontUse = Mockito.mock(FontUse.class);
@@ -99,8 +98,10 @@
@Test
public void bestFitTest1() {
/* TODO: THE CLASS BEING TESTED IS VERY INCOMPLETE, AND SO IS THIS TEST !!!!!! */
+ final Orthography4a orthography = this.orthographyServer.getOrthography(this.paraConfig.getWritingSystem());
+
final ParaBranch4a paragraph =
- this.hyphenationConsumer.parseWordSequence(TEST_STRING_01, 0, TEST_STRING_01.length(), paraConfig);
+ orthography.parseWordSequence(TEST_STRING_01, 0, TEST_STRING_01.length(), paraConfig);
/* Make manual changes to get the paragraph features identical to our baseline paragraph, as documented
* in the Knuth-Plass article. These are all cases where the native hyphenation opportunies violate the
Deleted: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -1,124 +0,0 @@
-/*
- * Copyright 2016 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;
-
-import org.foray.common.para.ParaBranch4a;
-import org.foray.common.primitive.CharacterUtils;
-import org.foray.common.primitive.NumberUtils;
-
-import org.axsl.common.para.ParaConfig;
-import org.axsl.orthography.OrthographyConsumer;
-import org.axsl.orthography.Word;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-/**
- * FOray implementation of {@link OrthographyConsumer}.
- */
-public class HyphenationConsumer4a implements OrthographyConsumer {
-
- /** The logger. */
- private Logger logger = LoggerFactory.getLogger(this.getClass());
-
- /** The parent server. */
- private OrthographyServer4a server;
-
- /**
- * Constructor.
- * @param server The parent server.
- */
- public HyphenationConsumer4a(final OrthographyServer4a server) {
- this.server = server;
- }
-
- /**
- * Returns the parent server.
- * @return The parent server.
- */
- public OrthographyServer4a getServer() {
- return this.server;
- }
-
- @Override
- public ParaBranch4a parseWordSequence(final CharSequence characters, final int startIndex, final int length,
- final ParaConfig paraConfig) {
- final ParaBranch4a wordSequence = new ParaBranch4a(paraConfig);
- final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
- final Orthography4a orthographyConfig = this.server.getOrthography(paraConfig.getWritingSystem());
- if (orthographyConfig == null) {
- this.logger.error("Orthography not configured for: " + paraConfig.getWritingSystem());
- }
- final WordBreaker wordBreaker = orthographyConfig.getWordBreaker();
- final List<CharSequence> chunks = wordBreaker.breakIntoWords(sequence);
-
- for (int chunkIndex = 0; chunkIndex < chunks.size(); chunkIndex ++) {
- final CharSequence chunk = chunks.get(chunkIndex);
- if (chunk.length() < 1) {
- continue;
- }
- final boolean isChunkIndexOdd = NumberUtils.isOdd(chunkIndex);
- if (isChunkIndexOdd) {
- /* Chunk is interword content. */
- parseInterwordContent(wordSequence, chunk);
- } else {
- /* Chunk is a word. */
- Word word = orthographyConfig.hyphenate(chunk, 0, chunk.length());
- if (word == null) {
- word = new StringWord(0, chunk);
- }
- wordSequence.add(word);
- }
- }
- return wordSequence;
- }
-
- private void parseInterwordContent(final ParaBranch4a wordSequence, final CharSequence interword) {
- int index = 0;
- while (index < interword.length()) {
- if (CharacterUtils.isPunctuation(interword.charAt(index))) {
- final Punctuation4a punctuation = Punctuation4a.findInstance(interword.subSequence(index, index + 1));
- wordSequence.add(punctuation);
- index ++;
- } else if (Character.isWhitespace(interword.charAt(index))) {
- final Whitespace4a whitespace = Whitespace4a.findInstance(interword.subSequence(index, index + 1));
- wordSequence.add(whitespace);
- index ++;
- } else {
- final Interword4a unknown = Interword4a.findInstance(interword.subSequence(index, index + 1));
- wordSequence.add(unknown);
- index ++;
- }
- }
-
- }
-
-}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -28,12 +28,16 @@
package org.foray.orthography;
+import org.foray.common.para.ParaBranch4a;
import org.foray.common.primitive.BooleanUtils;
import org.foray.common.primitive.CharSequenceUtils;
+import org.foray.common.primitive.CharacterUtils;
+import org.foray.common.primitive.NumberUtils;
import org.foray.orthography.wrapper.CapitalizedWord;
import org.foray.orthography.wrapper.ExactWord;
import org.foray.orthography.wrapper.UppercaseWord;
+import org.axsl.common.para.ParaConfig;
import org.axsl.orthography.Dictionary;
import org.axsl.orthography.Orthography;
import org.axsl.orthography.PartOfSpeech;
@@ -399,4 +403,53 @@
return hyphenatedWord;
}
+ @Override
+ public ParaBranch4a parseWordSequence(final CharSequence characters, final int startIndex, final int length,
+ final ParaConfig paraConfig) {
+ final ParaBranch4a wordSequence = new ParaBranch4a(paraConfig);
+ final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
+ final WordBreaker wordBreaker = getWordBreaker();
+ final List<CharSequence> chunks = wordBreaker.breakIntoWords(sequence);
+
+ for (int chunkIndex = 0; chunkIndex < chunks.size(); chunkIndex ++) {
+ final CharSequence chunk = chunks.get(chunkIndex);
+ if (chunk.length() < 1) {
+ continue;
+ }
+ final boolean isChunkIndexOdd = NumberUtils.isOdd(chunkIndex);
+ if (isChunkIndexOdd) {
+ /* Chunk is interword content. */
+ parseInterwordContent(wordSequence, chunk);
+ } else {
+ /* Chunk is a word. */
+ Word word = hyphenate(chunk, 0, chunk.length());
+ if (word == null) {
+ word = new StringWord(0, chunk);
+ }
+ wordSequence.add(word);
+ }
+ }
+ return wordSequence;
+ }
+
+ private void parseInterwordContent(final ParaBranch4a wordSequence, final CharSequence interword) {
+ int index = 0;
+ while (index < interword.length()) {
+ if (CharacterUtils.isPunctuation(interword.charAt(index))) {
+ final Punctuation4a punctuation = Punctuation4a.findInstance(interword.subSequence(index, index + 1));
+ wordSequence.add(punctuation);
+ index ++;
+ } else if (Character.isWhitespace(interword.charAt(index))) {
+ final Whitespace4a whitespace = Whitespace4a.findInstance(interword.subSequence(index, index + 1));
+ wordSequence.add(whitespace);
+ index ++;
+ } else {
+ final Interword4a unknown = Interword4a.findInstance(interword.subSequence(index, index + 1));
+ wordSequence.add(unknown);
+ index ++;
+ }
+ }
+
+ }
+
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -260,11 +260,6 @@
return nl;
}
- @Override
- public HyphenationConsumer4a makeConsumer() {
- return new HyphenationConsumer4a(this);
- }
-
/**
* Returns the EntityResolver for this server.
* @return The EntityResolver.
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 12:17:39 UTC (rev 12045)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 12:55:52 UTC (rev 12046)
@@ -55,7 +55,7 @@
private static ParaConfig paraConfig = new ParaConfig4a(null, 0, WritingSystem4a.USA, 0, 0);
/** The object under test. */
- private HyphenationConsumer4a consumer;
+ private Orthography4a consumer;
/**
@@ -75,7 +75,7 @@
*/
@Before
public void before() {
- this.consumer = new HyphenationConsumer4a(server);
+ this.consumer = server.getOrthography(WritingSystem4a.USA);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 12:17:42
|
Revision: 12045
http://sourceforge.net/p/foray/code/12045
Author: victormote
Date: 2021-11-12 12:17:39 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Rename OrthographyConfig4a to Orthography4a, for consistency and clarity.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
Added Paths:
-----------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java
Removed Paths:
-------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 12:04:06 UTC (rev 12044)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 12:17:39 UTC (rev 12045)
@@ -73,7 +73,7 @@
final ParaConfig paraConfig) {
final ParaBranch4a wordSequence = new ParaBranch4a(paraConfig);
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
- final OrthographyConfig4a orthographyConfig = this.server.getOrthography(paraConfig.getWritingSystem());
+ final Orthography4a orthographyConfig = this.server.getOrthography(paraConfig.getWritingSystem());
if (orthographyConfig == null) {
this.logger.error("Orthography not configured for: " + paraConfig.getWritingSystem());
}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java (from rev 12044, trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Orthography4a.java 2021-11-12 12:17:39 UTC (rev 12045)
@@ -0,0 +1,402 @@
+/*
+ * Copyright 2019 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;
+
+import org.foray.common.primitive.BooleanUtils;
+import org.foray.common.primitive.CharSequenceUtils;
+import org.foray.orthography.wrapper.CapitalizedWord;
+import org.foray.orthography.wrapper.ExactWord;
+import org.foray.orthography.wrapper.UppercaseWord;
+
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.Orthography;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.Word;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * The resources (dictionaries, word wrappers, hyphenation patterns, etc.) that should be used by a given orthography.
+ */
+public class Orthography4a implements Orthography {
+
+ /** The list of ids to lists of regex patterns, which, for this orthography, signal a valid word if matched. */
+ private List<String> matchRuleListIds = new ArrayList<String>();
+
+ /** The list of ids to lists of derivative rules, which, for this orthography, can compute derivative words. */
+ private List<String> derivativeRuleListIds = new ArrayList<String>();
+
+ /** The dictionary for this orthography.*/
+ private DictionaryResource dictionaryResource;
+
+ /** The hyphenation patterns for this orthography. */
+ private HyphenationPatternsResource hyphenationPatternsResource;
+
+ /** The list of word wrapper factories for this orthography. */
+ private List<WordWrapperFactory<?>> wordWrapperFactories = new ArrayList<WordWrapperFactory<?>>();
+
+ /** The word breaker for this orthography. */
+ private WordBreaker wordBreaker;
+
+ /** The parent hyphenation server. */
+ private OrthographyServer4a server;
+
+ /* TODO: Following orthography-specific config needs to be moved to XML or subclass. */
+ /** Character delimiting a compound word. NB: This variable may be orthography specific, and may therefore need to
+ * be moved to the orthography configuration. However, we have found no evidence yet for that need. */
+ private char compoundWordMarker = '-';
+
+ /** Regex pattern used to break compound words into their components. */
+ private Pattern compoundWordBreaker = Pattern.compile(Character.toString(compoundWordMarker));
+
+ /**
+ * Constructor.
+ * @param server The parent hyphenation server.
+ */
+ public Orthography4a(final OrthographyServer4a server) {
+ this.server = server;
+ }
+
+ /**
+ * Returns the list of match rule Ids.
+ * @return The list of match rule Ids.
+ */
+ public List<String> getMatchRuleListIds() {
+ return this.matchRuleListIds;
+ }
+
+ /**
+ * Adds a match rule list Id to this configuration.
+ * @param matchRuleListId The new match rule list Id.
+ */
+ public void registerMatchRuleListId(final String matchRuleListId) {
+ if (this.matchRuleListIds.contains(matchRuleListId)) {
+ throw new IllegalArgumentException(
+ "Match Rule List already configured for this orthography: " + matchRuleListId);
+ }
+ this.matchRuleListIds.add(matchRuleListId);
+ }
+
+ /**
+ * Returns the list of derivative rule Ids.
+ * @return The list of derivative rule Ids.
+ */
+ public List<String> getDerivativeRuleListIds() {
+ return this.derivativeRuleListIds;
+ }
+
+ /**
+ * Adds a derivative rule list Id to this configuration.
+ * @param derivativeRuleListId The new derivative rule list Id.
+ */
+ public void registerDerivativeRuleListId(final String derivativeRuleListId) {
+ if (this.derivativeRuleListIds.contains(derivativeRuleListId)) {
+ throw new IllegalArgumentException(
+ "Derivative Rule List already configured for this orthography: " + derivativeRuleListId);
+ }
+ this.derivativeRuleListIds.add(derivativeRuleListId);
+ }
+
+ /**
+ * Returns the dictionary resource.
+ * @return The dictionary resource.
+ */
+ public DictionaryResource getDictionaryResource() {
+ return this.dictionaryResource;
+ }
+
+ /**
+ * Sets the dictionary resource.
+ * @param dictionaryResource The dictionaryResource to set.
+ */
+ public void setDictionaryResource(final DictionaryResource dictionaryResource) {
+ this.dictionaryResource = dictionaryResource;
+ }
+
+ /**
+ * Returns the hyphenation patterns resource.
+ * @return The hyphenation patterns resource
+ */
+ public HyphenationPatternsResource getHyphenationPatternsResource() {
+ return this.hyphenationPatternsResource;
+ }
+
+ /**
+ * Sets the hyphenation patterns resource.
+ * @param hyphenationPatternsResource The hyphenation patterns resource to set.
+ */
+ public void setHyphenationPatternsResource(final HyphenationPatternsResource hyphenationPatternsResource) {
+ this.hyphenationPatternsResource = hyphenationPatternsResource;
+ }
+
+ /**
+ * Returns the list of word wrapper factories.
+ * @return The list of word wrapper factories.
+ */
+ public List<WordWrapperFactory<?>> getWordWrapperFactories() {
+ return this.wordWrapperFactories;
+ }
+
+ /**
+ * Sets the list of word wrapper factories.
+ * @param wordWrapperFactories The word wrapper factories to set.
+ */
+ public void setWordWrapperFactories(final List<WordWrapperFactory<?>> wordWrapperFactories) {
+ this.wordWrapperFactories = wordWrapperFactories;
+ }
+
+ /**
+ * Returns the word breaker.
+ * @return The word breaker.
+ */
+ public WordBreaker getWordBreaker() {
+ return this.wordBreaker;
+ }
+
+ /**
+ * Sets the word breaker.
+ * @param wordBreaker The word breaker to set.
+ */
+ public void setWordBreaker(final WordBreaker wordBreaker) {
+ this.wordBreaker = wordBreaker;
+ }
+
+ /**
+ * Returns the dictionary.
+ * @return The dictionary, or null if one is not configured or cannot be obtained.
+ */
+ public SegmentDictionary getDictionary() {
+ if (this.dictionaryResource == null) {
+ return null;
+ } else {
+ return this.dictionaryResource.getResource();
+ }
+ }
+
+ /**
+ * Returns the hyphenation patterns.
+ * @return The hyphenation patterns.
+ */
+ public PatternTree getHyphenationPatterns() {
+ if (this.hyphenationPatternsResource == null) {
+ return null;
+ } else {
+ return this.hyphenationPatternsResource.getResource();
+ }
+ }
+
+ /**
+ * Searches the configured word wrapper factories for a match that would create a word derived from a dictionary
+ * word.
+ * @param chars The word to test.
+ * @return A word wrapper if {@code chars} matches a word wrapper factory, or null if not.
+ */
+ public WordWrapper findDerivatives(final CharSequence chars) {
+ /* TODO: For now, this returns the first item that matches. This may need to be expanded to allow nested wrapped
+ * words. */
+ WordWrapper word = null;
+ final Dictionary dictionary = getDictionary();
+ for (int index = 0; index < this.wordWrapperFactories.size(); index ++) {
+ final WordWrapperFactory<?> factory = this.wordWrapperFactories.get(index);
+ word = factory.makeInstance(chars, dictionary);
+ if (word != null) {
+ return word;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Indicates whether a given word is found in the match rules for this orthography, i.e. rules looking for
+ * non-dictionary items such as numbers, currency, etc.
+ * @param wordChars The word to be tested.
+ * @return True if and only if {@code word} matches at least one match rule for this orthography.
+ */
+ public boolean foundInMatchRules(final CharSequence wordChars) {
+ for (int idIndex = 0; idIndex < getMatchRuleListIds().size(); idIndex ++) {
+ final String ruleListId = matchRuleListIds.get(idIndex);
+ final List<Pattern> validWordPatterns = server.getMatchRules(ruleListId);
+ for (int index = 0; index < validWordPatterns.size(); index ++) {
+ final Pattern pattern = validWordPatterns.get(index);
+ final Matcher matcher = pattern.matcher(wordChars);
+ if (matcher.matches()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Word getWord(final CharSequence wordChars, final PartOfSpeech pos,
+ final List<Dictionary> adhocDictionaries) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isValidWord(final CharSequence wordChars, final PartOfSpeech pos,
+ final List<Dictionary> adhocDictionaries) {
+ if (wordChars.length() < 1) {
+ return false;
+ }
+
+ /* 1. Check exact matches in adhoc dictionaries. */
+ if (adhocDictionaries != null) {
+ for (int index = 0; index < adhocDictionaries.size(); index ++) {
+ final Dictionary adhocDictionary = adhocDictionaries.get(index);
+ if (adhocDictionary.getWord(wordChars, 0) != null) {
+ return true;
+ }
+ }
+ }
+
+ /* 2. Check exact matches in standard dictionaries for the orthography. */
+ final Dictionary orthoDictionary = getDictionary();
+ if (orthoDictionary != null
+ && orthoDictionary.getWord(wordChars, 0) != null) {
+ return true;
+ }
+
+ /* 3. Check the match rules. */
+ if (foundInMatchRules(wordChars)) {
+ return true;
+ }
+
+ /* 4. Check for compound word. */
+ if (CharSequenceUtils.contains(wordChars, '-')) {
+ final String[] components = this.compoundWordBreaker.split(wordChars);
+ final boolean[] componentsValid = new boolean[components.length];
+ for (int index = 0; index < components.length; index ++) {
+ componentsValid[index] = isValidWord(components[index], pos, adhocDictionaries);
+ }
+ if (BooleanUtils.allTrue(componentsValid)) {
+ return true;
+ }
+ }
+
+ /* 5. Check derivative matches in adhoc dictionaries. */
+ if (adhocDictionaries != null) {
+ for (int dictIndex = 0; dictIndex < adhocDictionaries.size(); dictIndex ++) {
+ final Dictionary adhocDictionary = adhocDictionaries.get(dictIndex);
+ if (isDerivativeFound(adhocDictionary, wordChars)) {
+ return true;
+ }
+ }
+ }
+
+ /* 6. Check derivative matches in standard dictionaries for the orthography. */
+ if (orthoDictionary != null) {
+ if (isDerivativeFound(orthoDictionary, wordChars)) {
+ return true;
+ }
+ }
+
+ /* Not found in any dictionary. */
+ /* If the first character is uppercase, convert to lowercase and try again. Discussion: For English at least, we
+ * do not want the opposite effect, i.e. to convert words starting with lowercase have the first char converted
+ * to uppercase. If the word is in the dictionary as a proper noun, we should treat a failure to capitalize it
+ * as a spelling error. Also, we do not want to generally convert the entire word to lowercase, as capital
+ * letters in the middle of the word should normally be treated as a spelling error. For exceptions to this
+ * last rule, users should enter the oddly-capitalized word into a dictionary in that form.
+ * TODO: This capability should be included in the orthography configuration instead of being hard-coded
+ * here. */
+ if (Character.isUpperCase(wordChars.charAt(0))) {
+ final StringBuilder builder = new StringBuilder(wordChars);
+ builder.setCharAt(0, Character.toLowerCase(wordChars.charAt(0)));
+ return isValidWord(builder, pos, adhocDictionaries);
+ }
+
+ return false;
+ }
+
+ private boolean isDerivativeFound(final Dictionary dictionary, final CharSequence wordChars) {
+ for (int listIndex = 0; listIndex < this.derivativeRuleListIds.size(); listIndex ++) {
+ final String ruleListKey = this.derivativeRuleListIds.get(listIndex);
+ final List<DerivativePattern> patternList = this.server.getDerivativePatterns(ruleListKey);
+ for (int patternIndex = 0; patternIndex < patternList.size(); patternIndex ++) {
+ final DerivativePattern pattern = patternList.get(patternIndex);
+ if (pattern.findFirstApplicableRule(wordChars, dictionary) != null) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Word hyphenate(final CharSequence word, final int offset, final int length) {
+ /* The character sequence containing the characters in the word that we are looking for. */
+ final CharSequence chars = word.subSequence(offset, offset + length);
+ Word hyphenatedWord = null;
+
+ /* Look in the dictionary first, as it should be more accurate. */
+ final SegmentDictionary dictionary = getDictionary();
+ if (dictionary != null) {
+ hyphenatedWord = dictionary.getWord(chars.toString().toLowerCase(), 0);
+ if (hyphenatedWord == null) {
+ hyphenatedWord = findDerivatives(chars);
+ }
+ }
+
+
+ if (hyphenatedWord == null) {
+ /* The word was not found in the dictionary. Try the hyphenation patterns. */
+ final PatternTree patternTree = getHyphenationPatterns();
+ if (patternTree == null) {
+ return null;
+ }
+ hyphenatedWord = patternTree.hyphenate(chars, 0, length);
+ }
+
+ if (hyphenatedWord == null) {
+ return null;
+ }
+
+ final boolean capitalized = CharSequenceUtils.equalToCapitalized(hyphenatedWord.getNormalizedContent(), chars);
+ if (capitalized) {
+ return new CapitalizedWord(hyphenatedWord);
+ }
+ final boolean uppercase = CharSequenceUtils.equalToUppercase(hyphenatedWord.getNormalizedContent(), chars);
+ if (uppercase) {
+ return new UppercaseWord(hyphenatedWord);
+ }
+
+ if (CharSequenceUtils.hasAnyUppercase(chars)) {
+ /* There is unexpected capitalization. */
+ return new ExactWord(hyphenatedWord, chars.toString());
+ }
+
+ return hyphenatedWord;
+ }
+
+}
Deleted: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java 2021-11-12 12:04:06 UTC (rev 12044)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java 2021-11-12 12:17:39 UTC (rev 12045)
@@ -1,402 +0,0 @@
-/*
- * Copyright 2019 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;
-
-import org.foray.common.primitive.BooleanUtils;
-import org.foray.common.primitive.CharSequenceUtils;
-import org.foray.orthography.wrapper.CapitalizedWord;
-import org.foray.orthography.wrapper.ExactWord;
-import org.foray.orthography.wrapper.UppercaseWord;
-
-import org.axsl.orthography.Dictionary;
-import org.axsl.orthography.Orthography;
-import org.axsl.orthography.PartOfSpeech;
-import org.axsl.orthography.Word;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * The resources (dictionaries, word wrappers, hyphenation patterns, etc.) that should be used by a given orthography.
- */
-public class OrthographyConfig4a implements Orthography {
-
- /** The list of ids to lists of regex patterns, which, for this orthography, signal a valid word if matched. */
- private List<String> matchRuleListIds = new ArrayList<String>();
-
- /** The list of ids to lists of derivative rules, which, for this orthography, can compute derivative words. */
- private List<String> derivativeRuleListIds = new ArrayList<String>();
-
- /** The dictionary for this orthography.*/
- private DictionaryResource dictionaryResource;
-
- /** The hyphenation patterns for this orthography. */
- private HyphenationPatternsResource hyphenationPatternsResource;
-
- /** The list of word wrapper factories for this orthography. */
- private List<WordWrapperFactory<?>> wordWrapperFactories = new ArrayList<WordWrapperFactory<?>>();
-
- /** The word breaker for this orthography. */
- private WordBreaker wordBreaker;
-
- /** The parent hyphenation server. */
- private OrthographyServer4a server;
-
- /* TODO: Following orthography-specific config needs to be moved to XML or subclass. */
- /** Character delimiting a compound word. NB: This variable may be orthography specific, and may therefore need to
- * be moved to the orthography configuration. However, we have found no evidence yet for that need. */
- private char compoundWordMarker = '-';
-
- /** Regex pattern used to break compound words into their components. */
- private Pattern compoundWordBreaker = Pattern.compile(Character.toString(compoundWordMarker));
-
- /**
- * Constructor.
- * @param server The parent hyphenation server.
- */
- public OrthographyConfig4a(final OrthographyServer4a server) {
- this.server = server;
- }
-
- /**
- * Returns the list of match rule Ids.
- * @return The list of match rule Ids.
- */
- public List<String> getMatchRuleListIds() {
- return this.matchRuleListIds;
- }
-
- /**
- * Adds a match rule list Id to this configuration.
- * @param matchRuleListId The new match rule list Id.
- */
- public void registerMatchRuleListId(final String matchRuleListId) {
- if (this.matchRuleListIds.contains(matchRuleListId)) {
- throw new IllegalArgumentException(
- "Match Rule List already configured for this orthography: " + matchRuleListId);
- }
- this.matchRuleListIds.add(matchRuleListId);
- }
-
- /**
- * Returns the list of derivative rule Ids.
- * @return The list of derivative rule Ids.
- */
- public List<String> getDerivativeRuleListIds() {
- return this.derivativeRuleListIds;
- }
-
- /**
- * Adds a derivative rule list Id to this configuration.
- * @param derivativeRuleListId The new derivative rule list Id.
- */
- public void registerDerivativeRuleListId(final String derivativeRuleListId) {
- if (this.derivativeRuleListIds.contains(derivativeRuleListId)) {
- throw new IllegalArgumentException(
- "Derivative Rule List already configured for this orthography: " + derivativeRuleListId);
- }
- this.derivativeRuleListIds.add(derivativeRuleListId);
- }
-
- /**
- * Returns the dictionary resource.
- * @return The dictionary resource.
- */
- public DictionaryResource getDictionaryResource() {
- return this.dictionaryResource;
- }
-
- /**
- * Sets the dictionary resource.
- * @param dictionaryResource The dictionaryResource to set.
- */
- public void setDictionaryResource(final DictionaryResource dictionaryResource) {
- this.dictionaryResource = dictionaryResource;
- }
-
- /**
- * Returns the hyphenation patterns resource.
- * @return The hyphenation patterns resource
- */
- public HyphenationPatternsResource getHyphenationPatternsResource() {
- return this.hyphenationPatternsResource;
- }
-
- /**
- * Sets the hyphenation patterns resource.
- * @param hyphenationPatternsResource The hyphenation patterns resource to set.
- */
- public void setHyphenationPatternsResource(final HyphenationPatternsResource hyphenationPatternsResource) {
- this.hyphenationPatternsResource = hyphenationPatternsResource;
- }
-
- /**
- * Returns the list of word wrapper factories.
- * @return The list of word wrapper factories.
- */
- public List<WordWrapperFactory<?>> getWordWrapperFactories() {
- return this.wordWrapperFactories;
- }
-
- /**
- * Sets the list of word wrapper factories.
- * @param wordWrapperFactories The word wrapper factories to set.
- */
- public void setWordWrapperFactories(final List<WordWrapperFactory<?>> wordWrapperFactories) {
- this.wordWrapperFactories = wordWrapperFactories;
- }
-
- /**
- * Returns the word breaker.
- * @return The word breaker.
- */
- public WordBreaker getWordBreaker() {
- return this.wordBreaker;
- }
-
- /**
- * Sets the word breaker.
- * @param wordBreaker The word breaker to set.
- */
- public void setWordBreaker(final WordBreaker wordBreaker) {
- this.wordBreaker = wordBreaker;
- }
-
- /**
- * Returns the dictionary.
- * @return The dictionary, or null if one is not configured or cannot be obtained.
- */
- public SegmentDictionary getDictionary() {
- if (this.dictionaryResource == null) {
- return null;
- } else {
- return this.dictionaryResource.getResource();
- }
- }
-
- /**
- * Returns the hyphenation patterns.
- * @return The hyphenation patterns.
- */
- public PatternTree getHyphenationPatterns() {
- if (this.hyphenationPatternsResource == null) {
- return null;
- } else {
- return this.hyphenationPatternsResource.getResource();
- }
- }
-
- /**
- * Searches the configured word wrapper factories for a match that would create a word derived from a dictionary
- * word.
- * @param chars The word to test.
- * @return A word wrapper if {@code chars} matches a word wrapper factory, or null if not.
- */
- public WordWrapper findDerivatives(final CharSequence chars) {
- /* TODO: For now, this returns the first item that matches. This may need to be expanded to allow nested wrapped
- * words. */
- WordWrapper word = null;
- final Dictionary dictionary = getDictionary();
- for (int index = 0; index < this.wordWrapperFactories.size(); index ++) {
- final WordWrapperFactory<?> factory = this.wordWrapperFactories.get(index);
- word = factory.makeInstance(chars, dictionary);
- if (word != null) {
- return word;
- }
- }
- return null;
- }
-
- /**
- * Indicates whether a given word is found in the match rules for this orthography, i.e. rules looking for
- * non-dictionary items such as numbers, currency, etc.
- * @param wordChars The word to be tested.
- * @return True if and only if {@code word} matches at least one match rule for this orthography.
- */
- public boolean foundInMatchRules(final CharSequence wordChars) {
- for (int idIndex = 0; idIndex < getMatchRuleListIds().size(); idIndex ++) {
- final String ruleListId = matchRuleListIds.get(idIndex);
- final List<Pattern> validWordPatterns = server.getMatchRules(ruleListId);
- for (int index = 0; index < validWordPatterns.size(); index ++) {
- final Pattern pattern = validWordPatterns.get(index);
- final Matcher matcher = pattern.matcher(wordChars);
- if (matcher.matches()) {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public Word getWord(final CharSequence wordChars, final PartOfSpeech pos,
- final List<Dictionary> adhocDictionaries) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isValidWord(final CharSequence wordChars, final PartOfSpeech pos,
- final List<Dictionary> adhocDictionaries) {
- if (wordChars.length() < 1) {
- return false;
- }
-
- /* 1. Check exact matches in adhoc dictionaries. */
- if (adhocDictionaries != null) {
- for (int index = 0; index < adhocDictionaries.size(); index ++) {
- final Dictionary adhocDictionary = adhocDictionaries.get(index);
- if (adhocDictionary.getWord(wordChars, 0) != null) {
- return true;
- }
- }
- }
-
- /* 2. Check exact matches in standard dictionaries for the orthography. */
- final Dictionary orthoDictionary = getDictionary();
- if (orthoDictionary != null
- && orthoDictionary.getWord(wordChars, 0) != null) {
- return true;
- }
-
- /* 3. Check the match rules. */
- if (foundInMatchRules(wordChars)) {
- return true;
- }
-
- /* 4. Check for compound word. */
- if (CharSequenceUtils.contains(wordChars, '-')) {
- final String[] components = this.compoundWordBreaker.split(wordChars);
- final boolean[] componentsValid = new boolean[components.length];
- for (int index = 0; index < components.length; index ++) {
- componentsValid[index] = isValidWord(components[index], pos, adhocDictionaries);
- }
- if (BooleanUtils.allTrue(componentsValid)) {
- return true;
- }
- }
-
- /* 5. Check derivative matches in adhoc dictionaries. */
- if (adhocDictionaries != null) {
- for (int dictIndex = 0; dictIndex < adhocDictionaries.size(); dictIndex ++) {
- final Dictionary adhocDictionary = adhocDictionaries.get(dictIndex);
- if (isDerivativeFound(adhocDictionary, wordChars)) {
- return true;
- }
- }
- }
-
- /* 6. Check derivative matches in standard dictionaries for the orthography. */
- if (orthoDictionary != null) {
- if (isDerivativeFound(orthoDictionary, wordChars)) {
- return true;
- }
- }
-
- /* Not found in any dictionary. */
- /* If the first character is uppercase, convert to lowercase and try again. Discussion: For English at least, we
- * do not want the opposite effect, i.e. to convert words starting with lowercase have the first char converted
- * to uppercase. If the word is in the dictionary as a proper noun, we should treat a failure to capitalize it
- * as a spelling error. Also, we do not want to generally convert the entire word to lowercase, as capital
- * letters in the middle of the word should normally be treated as a spelling error. For exceptions to this
- * last rule, users should enter the oddly-capitalized word into a dictionary in that form.
- * TODO: This capability should be included in the orthography configuration instead of being hard-coded
- * here. */
- if (Character.isUpperCase(wordChars.charAt(0))) {
- final StringBuilder builder = new StringBuilder(wordChars);
- builder.setCharAt(0, Character.toLowerCase(wordChars.charAt(0)));
- return isValidWord(builder, pos, adhocDictionaries);
- }
-
- return false;
- }
-
- private boolean isDerivativeFound(final Dictionary dictionary, final CharSequence wordChars) {
- for (int listIndex = 0; listIndex < this.derivativeRuleListIds.size(); listIndex ++) {
- final String ruleListKey = this.derivativeRuleListIds.get(listIndex);
- final List<DerivativePattern> patternList = this.server.getDerivativePatterns(ruleListKey);
- for (int patternIndex = 0; patternIndex < patternList.size(); patternIndex ++) {
- final DerivativePattern pattern = patternList.get(patternIndex);
- if (pattern.findFirstApplicableRule(wordChars, dictionary) != null) {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public Word hyphenate(final CharSequence word, final int offset, final int length) {
- /* The character sequence containing the characters in the word that we are looking for. */
- final CharSequence chars = word.subSequence(offset, offset + length);
- Word hyphenatedWord = null;
-
- /* Look in the dictionary first, as it should be more accurate. */
- final SegmentDictionary dictionary = getDictionary();
- if (dictionary != null) {
- hyphenatedWord = dictionary.getWord(chars.toString().toLowerCase(), 0);
- if (hyphenatedWord == null) {
- hyphenatedWord = findDerivatives(chars);
- }
- }
-
-
- if (hyphenatedWord == null) {
- /* The word was not found in the dictionary. Try the hyphenation patterns. */
- final PatternTree patternTree = getHyphenationPatterns();
- if (patternTree == null) {
- return null;
- }
- hyphenatedWord = patternTree.hyphenate(chars, 0, length);
- }
-
- if (hyphenatedWord == null) {
- return null;
- }
-
- final boolean capitalized = CharSequenceUtils.equalToCapitalized(hyphenatedWord.getNormalizedContent(), chars);
- if (capitalized) {
- return new CapitalizedWord(hyphenatedWord);
- }
- final boolean uppercase = CharSequenceUtils.equalToUppercase(hyphenatedWord.getNormalizedContent(), chars);
- if (uppercase) {
- return new UppercaseWord(hyphenatedWord);
- }
-
- if (CharSequenceUtils.hasAnyUppercase(chars)) {
- /* There is unexpected capitalization. */
- return new ExactWord(hyphenatedWord, chars.toString());
- }
-
- return hyphenatedWord;
- }
-
-}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java 2021-11-12 12:04:06 UTC (rev 12044)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java 2021-11-12 12:17:39 UTC (rev 12045)
@@ -77,9 +77,9 @@
/** An EntityResolver to be used by XML parsers (for handling DTD catalogs, etc.). */
private EntityResolver entityResolver = null;
- /** Map of orthographies and their configurations to be used by this server. */
- private Map<WritingSystem, OrthographyConfig4a> orthographyConfigurations =
- new HashMap<WritingSystem, OrthographyConfig4a>();
+ /** Map of writing systems and their orthographies. */
+ private Map<WritingSystem, Orthography4a> orthographyMap =
+ new HashMap<WritingSystem, Orthography4a>();
/** The map of match rule lists, keyed by id. */
private Map<String, List<Pattern>> matchRuleLists = new HashMap<String, List<Pattern>>();
@@ -283,16 +283,16 @@
/**
* Registers a configuration for a given orthography.
- * @param orthography The orthography for which the configuration should be registered.
- * @param config The configuration for {@code orthography}.
+ * @param writingSystem The orthography for which the configuration should be registered.
+ * @param orthography The configuration for {@code orthography}.
*/
- public void registerOrthographyConfig(final WritingSystem orthography, final OrthographyConfig4a config) {
- this.orthographyConfigurations.put(orthography, config);
+ public void registerOrthography(final WritingSystem writingSystem, final Orthography4a orthography) {
+ this.orthographyMap.put(writingSystem, orthography);
}
@Override
- public OrthographyConfig4a getOrthography(final WritingSystem orthography) {
- return this.orthographyConfigurations.get(orthography);
+ public Orthography4a getOrthography(final WritingSystem writingSystem) {
+ return this.orthographyMap.get(writingSystem);
}
/**
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 12:04:06 UTC (rev 12044)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 12:17:39 UTC (rev 12045)
@@ -41,7 +41,7 @@
import org.foray.orthography.DerivativeRule;
import org.foray.orthography.DictionaryResource;
import org.foray.orthography.HyphenationPatternsResource;
-import org.foray.orthography.OrthographyConfig4a;
+import org.foray.orthography.Orthography4a;
import org.foray.orthography.OrthographyServer4a;
import org.foray.orthography.PosUtils;
import org.foray.orthography.WordBreaker;
@@ -134,7 +134,7 @@
private StringBuilder textAccumulator = new StringBuilder();
/** Stateful variable tracking the current orthography configuration. */
- private transient OrthographyConfig4a currentOrthographyConfig;
+ private transient Orthography4a currentOrthographyConfig;
// /** The map of match rule lists, keyed by id. */
// private Map<String, List<Pattern>> matchRuleLists = new HashMap<String, List<Pattern>>();
@@ -400,7 +400,7 @@
return;
}
case "configuration": {
- this.currentOrthographyConfig = new OrthographyConfig4a(this.hyphenationServer);
+ this.currentOrthographyConfig = new Orthography4a(this.hyphenationServer);
return;
}
case "orthography": {
@@ -497,7 +497,7 @@
this.logger.error("Unable to find script for: {}_{}_{}", languageString, countryString, scriptString);
this.logger.error(getContextMessage());
}
- this.hyphenationServer.registerOrthographyConfig(orthography, this.currentOrthographyConfig);
+ this.hyphenationServer.registerOrthography(orthography, this.currentOrthographyConfig);
}
/**
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 12:04:06 UTC (rev 12044)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 12:17:39 UTC (rev 12045)
@@ -35,7 +35,7 @@
import org.foray.common.primitive.ObjectUtils;
import org.foray.common.primitive.StringUtils;
import org.foray.common.primitive.XmlUtils;
-import org.foray.orthography.OrthographyConfig4a;
+import org.foray.orthography.Orthography4a;
import org.foray.orthography.OrthographyServer4a;
import org.foray.orthography.OrthographyServerConfig;
import org.foray.orthography.SegmentDictionary;
@@ -99,7 +99,7 @@
private WritingSystem writingSystem;
/** The orthography configuration for this element, only if {@link #writingSystem} is not null. */
- private OrthographyConfig4a orthographyConfig;
+ private Orthography4a orthographyConfig;
/**
* Checks whether a set of element descriptor items match this instance.
@@ -160,7 +160,7 @@
private Stack<Element> elementStack = new Stack<Element>();
/** The current orthography configuration. */
- private OrthographyConfig4a currentOrthographyConfig;
+ private Orthography4a currentOrthographyConfig;
/** The logger. */
private Logger logger = LoggerFactory.getLogger(SpellChecker.class);
@@ -367,7 +367,7 @@
countryString, script.getAlphaCode());
this.output.println(message + locationString());
} else {
- final OrthographyConfig4a config = this.server.getOrthography(element.writingSystem);
+ final Orthography4a config = this.server.getOrthography(element.writingSystem);
if (config == null) {
final String message = String.format(
"Unconfigured orthography. Language: %1$s, Country: %2$s, Script: %3$s ",
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 12:04:06 UTC (rev 12044)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 12:17:39 UTC (rev 12045)
@@ -29,7 +29,7 @@
package org.foray.orthography.util;
import org.foray.common.i18n.WritingSystem4a;
-import org.foray.orthography.OrthographyConfig4a;
+import org.foray.orthography.Orthography4a;
import org.foray.orthography.OrthographyServer4a;
import org.foray.orthography.OrthographyServerConfig;
import org.foray.orthography.SegmentDictionary;
@@ -85,7 +85,7 @@
// private Logger logger = LoggerFactory.getLogger(WordChecker.class);
/** The current orthography configuration. */
- private OrthographyConfig4a currentOrthographyConfig;
+ private Orthography4a currentOrthographyConfig;
/** The Hyphenation server. */
private OrthographyServer4a server;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 12:04:06 UTC (rev 12044)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 12:17:39 UTC (rev 12045)
@@ -142,7 +142,7 @@
if (! testWord.toLowerCase().equals("hyphenation")) {
throw new OrthographyException("Test of \"hyphenation\" has invalid input.");
}
- final OrthographyConfig4a orthography = server.getOrthography(WritingSystem4a.USA);
+ final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(3, hyphenation.getQtyHyphenationPoints());
@@ -183,7 +183,7 @@
if (! testWord.toLowerCase().equals("obligatory")) {
throw new OrthographyException("Test of \"obligatory\" has invalid input.");
}
- final OrthographyConfig4a orthography = server.getOrthography(WritingSystem4a.USA);
+ final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(4, hyphenation.getQtyHyphenationPoints());
@@ -202,7 +202,7 @@
@Test
public void testEnInvalidCharacter() throws OrthographyException {
final String testWord = "table8";
- final OrthographyConfig4a orthography = server.getOrthography(WritingSystem4a.USA);
+ final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNull(hyphenation);
}
@@ -215,7 +215,7 @@
@Test
public void testTimes() throws OrthographyException {
final String testWord = "times";
- final OrthographyConfig4a orthography = server.getOrthography(WritingSystem4a.USA);
+ final Orthography4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals("times", hyphenation.toString());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 12:04:09
|
Revision: 12044
http://sourceforge.net/p/foray/code/12044
Author: victormote
Date: 2021-11-12 12:04:06 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Rename HyphenationServer4a and HyphenationServerConfig to OrthographyServer4a and OrthographyServerConfig, for consistency and clarity.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/util/NaturalLanguageTests.java
Added Paths:
-----------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServerConfig.java
Removed Paths:
-------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServerConfig.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -36,7 +36,7 @@
import org.foray.font.FontServer4a;
import org.foray.fotree.FoTreeServer4a;
import org.foray.graphic.GraphicServer4a;
-import org.foray.orthography.HyphenationServerConfig;
+import org.foray.orthography.OrthographyServerConfig;
import org.foray.pioneer.PioneerFactory;
import org.foray.ps.PsServer4a;
import org.foray.speech.SpeechServer4a;
@@ -165,7 +165,7 @@
* @throws ForayException For errors creating the hyphenation server.
*/
public static OrthographyServer makeHyphenationServer(final SessionConfig configuration) throws ForayException {
- final HyphenationServerConfig config = new HyphenationServerConfig();
+ final OrthographyServerConfig config = new OrthographyServerConfig();
config.setOrthographyConfigurationLocation(configuration.optionOrthographyConfiguration());
config.setWordListsBaseDirectory(configuration.optionDictionariesBaseDirectory());
config.setSerializedDictionariesBaseDirectory(configuration.optionSerializedDictionariesBaseDirectory());
@@ -175,7 +175,7 @@
config.setNaturalLanguagesBaseDirectory(configuration.optionNaturalLanguageBaseDirectory());
try {
- return new org.foray.orthography.HyphenationServer4a(config);
+ return new org.foray.orthography.OrthographyServer4a(config);
} catch (final OrthographyException e) {
throw new ForayException(e);
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -31,7 +31,7 @@
import org.foray.common.Environment;
import org.foray.common.sequence.IntArrayBuilder;
import org.foray.font.util.MockFont;
-import org.foray.orthography.HyphenationServerConfig;
+import org.foray.orthography.OrthographyServerConfig;
import org.axsl.font.Font;
@@ -136,7 +136,7 @@
* @return the hyphenation server configuration.
* @throws IOException For errors creating the URLs.
*/
- public static HyphenationServerConfig createHyphenationServerConfig() throws IOException {
+ public static OrthographyServerConfig createHyphenationServerConfig() throws IOException {
final Properties buildProperties = Environment.getBuildProperties();
final String foraySandbox = buildProperties.getProperty("foray.sandbox");
@@ -157,7 +157,7 @@
final URL parsedPatterns = new URL("file", null, serializedPatternsDirString);
final URL naturalLanguageDir = new URL("file", null, naturalLanguageDirString);
- final HyphenationServerConfig config = new HyphenationServerConfig();
+ final OrthographyServerConfig config = new OrthographyServerConfig();
config.setOrthographyConfigurationLocation(orthographyFile);
config.setWordListsBaseDirectory(rawDictionary);
config.setSerializedDictionariesBaseDirectory(parsedDictionary);
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -33,8 +33,8 @@
import org.foray.common.para.ParaBranch4a;
import org.foray.common.para.ParaConfig4a;
import org.foray.orthography.HyphenationConsumer4a;
-import org.foray.orthography.HyphenationServer4a;
-import org.foray.orthography.HyphenationServerConfig;
+import org.foray.orthography.OrthographyServer4a;
+import org.foray.orthography.OrthographyServerConfig;
import org.foray.orthography.StringWord;
import org.axsl.common.para.DiscretionaryHyphen;
@@ -83,8 +83,8 @@
*/
@Before
public void setup() throws IOException, OrthographyException {
- final HyphenationServerConfig config = LbTestUtilities.createHyphenationServerConfig();
- final HyphenationServer4a hyphenationServer = new HyphenationServer4a(config);
+ final OrthographyServerConfig config = LbTestUtilities.createHyphenationServerConfig();
+ final OrthographyServer4a hyphenationServer = new OrthographyServer4a(config);
this.hyphenationConsumer = hyphenationServer.makeConsumer();
final Font font = LbTestUtilities.createMonotypeFont();
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -50,13 +50,13 @@
private Logger logger = LoggerFactory.getLogger(this.getClass());
/** The parent server. */
- private HyphenationServer4a server;
+ private OrthographyServer4a server;
/**
* Constructor.
* @param server The parent server.
*/
- public HyphenationConsumer4a(final HyphenationServer4a server) {
+ public HyphenationConsumer4a(final OrthographyServer4a server) {
this.server = server;
}
@@ -64,7 +64,7 @@
* Returns the parent server.
* @return The parent server.
*/
- public HyphenationServer4a getServer() {
+ public OrthographyServer4a getServer() {
return this.server;
}
Deleted: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -1,340 +0,0 @@
-/*
- * Copyright 2004 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$
- */
-
-/*
- * Known contributors:
- * @author Carlos Villegas <ca...@un...> (original author)
- */
-
-package org.foray.orthography;
-
-import org.foray.common.ForayConstants;
-import org.foray.common.i18n.Language4a;
-import org.foray.common.url.UrlFactory;
-import org.foray.orthography.util.ConfigParser;
-import org.foray.orthography.util.NatLangParser;
-import org.foray.orthography.util.NaturalLanguage;
-
-import org.axsl.common.i18n.Language;
-import org.axsl.common.i18n.WritingSystem;
-import org.axsl.orthography.OrthographyException;
-import org.axsl.orthography.OrthographyServer;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-/**
- * This class is the main entry point to the hyphenation package.
- */
-public class HyphenationServer4a implements OrthographyServer {
-
- /** The logger. */
- private Logger logger = LoggerFactory.getLogger(HyphenationServer4a.class);
-
- /** The configuration for this server. */
- private HyphenationServerConfig config;
-
- /** Map of all Natural Language instances. */
- private Map<Language, NaturalLanguage> languages = new HashMap<Language, NaturalLanguage>();
-
- /** An EntityResolver to be used by XML parsers (for handling DTD catalogs, etc.). */
- private EntityResolver entityResolver = null;
-
- /** Map of orthographies and their configurations to be used by this server. */
- private Map<WritingSystem, OrthographyConfig4a> orthographyConfigurations =
- new HashMap<WritingSystem, OrthographyConfig4a>();
-
- /** The map of match rule lists, keyed by id. */
- private Map<String, List<Pattern>> matchRuleLists = new HashMap<String, List<Pattern>>();
-
- /** The map of derivative rule lists, keyed by id. */
- private Map<String, List<DerivativePattern>> derivativeRuleLists = new HashMap<String, List<DerivativePattern>>();
-
- /**
- * Constructor.
- * @param config The configuration for this server.
- * @throws OrthographyException For errors parsing configuration.
- */
- public HyphenationServer4a(final HyphenationServerConfig config) throws OrthographyException {
- this.config = config;
- if (config.getOrthographyConfigurationLocation() == null) {
- throw new OrthographyException("Orthography configuration location has not been provided");
- } else {
- InputStream inputStream = null;
- try {
- inputStream = config.getOrthographyConfigurationLocation().openStream();
- } catch (final IOException e) {
- throw new OrthographyException(e);
- }
- final InputSource inputSource = new InputSource(inputStream);
-
- final ConfigParser parser = new ConfigParser(this, inputSource);
- parser.start();
- }
- }
-
- /**
- * Finds or creates the instance of this class that is suitable for a given
- * language description.
- * @param languageCode The ISO-639 code for the language sought.
- * @return The suitable instance for {@code languageCode}.
- */
- public NaturalLanguage getNaturalLanguage(
- final String languageCode) {
- final Language iso639 = Language4a.findFromAlpha(languageCode);
- return this.getNaturalLanguage(iso639);
- }
-
- /**
- * Finds or creates the instance of this class that is suitable for a given
- * language description.
- * @param iso639 The ISO-639 instance for the language sought.
- * @return The suitable instance for {@code iso639}.
- */
- public NaturalLanguage getNaturalLanguage(final Language iso639) {
- NaturalLanguage nl = this.languages.get(iso639);
- if (nl != null) {
- return nl;
- }
- try {
- nl = this.parseNaturalLanguage(iso639.getAlpha3Code());
- } catch (final OrthographyException e) {
- this.logger.error(e.getMessage());
- return null;
- }
- if (nl != null) {
- this.languages.put(iso639, nl);
- }
- return nl;
- }
-
- /**
- * Makes a new, empty instance of this class for a given language
- * description.
- * @param languageCode The ISO-639 code for the new instance.
- * @return A new instance for {@code languageCode}, or null if an
- * instance already exists for it.
- */
- public NaturalLanguage makeNaturalLanguage(
- final String languageCode) {
- final Language iso639 = Language4a.findFromAlpha(languageCode);
- final NaturalLanguage existingLang = this.getNaturalLanguage(iso639);
- if (existingLang != null) {
- /* If the instance already exists, don't return a new one for the
- * same language code. */
- return null;
- }
- final NaturalLanguage newLang = new NaturalLanguage();
- /* TODO: It is ugly to expose this instance before it has been parsed.
- * Instead we need to add a concept of "locking" to this class that
- * will make it effectively immutable, and register it at that time
- * instead of now. */
- this.languages.put(iso639, newLang);
- return newLang;
- }
-
- /**
- * Parse a NaturalLanguage instance from its description.
- * @param languageCode The language code of the language to be parsed.
- * @return The parsed NaturalLanguage instance, if it can be found, or null
- * otherwise.
- * @throws OrthographyException For errors finding or parsing the files.
- */
- private NaturalLanguage parseNaturalLanguage(final String languageCode)
- throws OrthographyException {
- final URL naturalLanguageDir = this.config.getNaturalLanguagesBaseDirectory();
- final String filePrefix = languageCode + "-language";
- if (naturalLanguageDir == null) {
- return null;
- }
- NaturalLanguage nl = null;
-
- /* Use the language code as the base name for the file. */
-
- /* First look for the serialized object. */
- String fileName = filePrefix
- + ForayConstants.BINARY_SERIALIZATION_EXTENSION;
- URL nlFile = null;
- try {
- nlFile = UrlFactory.createURL(naturalLanguageDir, fileName);
- } catch (final MalformedURLException e) {
- /* This probably means that the hyphenation URL is not valid.
- * Rethrow the exception to alert the user. */
- throw new OrthographyException(e);
- }
-
- InputStream inputStream = null;
- try {
- inputStream = nlFile.openStream();
- } catch (final IOException e) {
- /* This just means that the input doesn't exist. Ignore the
- * exception as the null value in "inputStream" will control the
- * downstream logic. */
- }
-
- if (inputStream != null) {
- ObjectInputStream ois = null;
- try {
- ois = new ObjectInputStream(inputStream);
- nl = (NaturalLanguage) ois.readObject();
- return nl;
- } catch (final IOException e) {
- throw new OrthographyException(e);
- } catch (final ClassNotFoundException e) {
- throw new OrthographyException(e);
- } finally {
- if (ois != null) {
- try {
- ois.close();
- } catch (final IOException e) {
- this.logger.error(
- "Exception closing ObjectInputStream "
- + "for " + nlFile.toString(), e);
- }
- }
- }
- }
-
-
- /* Look for the raw XML file. */
- fileName = filePrefix + ".xml";
- try {
- nlFile = UrlFactory.createURL(naturalLanguageDir, fileName);
- } catch (final MalformedURLException e) {
- /* This probably means that the hyphenation URL is not valid.
- * Rethrow the exception to alert the user. */
- throw new OrthographyException(e);
- }
-
- /* Does the XML file exist? */
- try {
- inputStream = nlFile.openStream();
- } catch (final IOException e) {
- /* The XML pattern file does not exist. Do not try to parse it. */
- return null;
- }
-
- if (this.logger.isDebugEnabled()) {
- this.logger.debug("reading " + naturalLanguageDir + filePrefix
- + ".xml");
- }
- final NatLangParser parser = new NatLangParser(this.logger);
- nl = parser.parse(nlFile);
- return nl;
- }
-
- @Override
- public HyphenationConsumer4a makeConsumer() {
- return new HyphenationConsumer4a(this);
- }
-
- /**
- * Returns the EntityResolver for this server.
- * @return The EntityResolver.
- */
- public EntityResolver getEntityResolver() {
- return this.entityResolver;
- }
-
- /**
- * Sets the EntityResolver for this server.
- * @param entityResolver The new EntityResolver.
- */
- public void setEntityResolver(final EntityResolver entityResolver) {
- this.entityResolver = entityResolver;
- }
-
- /**
- * Registers a configuration for a given orthography.
- * @param orthography The orthography for which the configuration should be registered.
- * @param config The configuration for {@code orthography}.
- */
- public void registerOrthographyConfig(final WritingSystem orthography, final OrthographyConfig4a config) {
- this.orthographyConfigurations.put(orthography, config);
- }
-
- @Override
- public OrthographyConfig4a getOrthography(final WritingSystem orthography) {
- return this.orthographyConfigurations.get(orthography);
- }
-
- /**
- * Registers a list of match rules.
- * @param id The id of the match rules to be registered.
- * @param matchRules The match rules being registered.
- */
- public void registerMatchRules(final String id, final List<Pattern> matchRules) {
- if (this.matchRuleLists.get(id) != null) {
- throw new IllegalArgumentException("Match Rules already exist for id: " + id);
- }
- this.matchRuleLists.put(id, matchRules);
- }
-
- /**
- * Returns the list of match rules for a given Id.
- * @param id The id of the match rules to be returned.
- * @return The match rules for {@code id}.
- */
- public List<Pattern> getMatchRules(final String id) {
- return this.matchRuleLists.get(id);
- }
-
- /**
- * Registers a list of derivative rules.
- * @param id The id of the derivative rules to be registered.
- * @param derivativeRules The derivative rules being registered.
- */
- public void registerDerivativeRules(final String id, final List<DerivativePattern> derivativeRules) {
- if (this.derivativeRuleLists.get(id) != null) {
- throw new IllegalArgumentException("Derivative Rules already exist for id: " + id);
- }
- this.derivativeRuleLists.put(id, derivativeRules);
- }
-
- /**
- * Returns the list of derivative rules for a given Id.
- * @param id The id of the derivative rules to be returned.
- * @return The derivative rules for {@code id}.
- */
- public List<DerivativePattern> getDerivativePatterns(final String id) {
- return this.derivativeRuleLists.get(id);
- }
-
-}
Deleted: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServerConfig.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServerConfig.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServerConfig.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -1,152 +0,0 @@
-/*
- * Copyright 2019 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;
-
-import java.net.URL;
-
-/**
- * Configuration information for the hyphenation server.
- */
-public class HyphenationServerConfig {
-
- /** The location of the orthography configuration. */
- private URL orthographyConfigurationLocation;
-
- /** The directory containing unparsed word lists. */
- private URL wordListsBaseDirectory;
-
- /** The directory containing parsed and serialized dictionaries. */
- private URL serializedDictionariesBaseDirectory;
-
- /** The directory containing unparsed hyphenation pattern files.*/
- private URL rawHyphenationPatternsBaseDirectory;
-
- /** The directory containing parsed and serialized hyphenation pattern files. */
- private URL serializedHyphenationPatternsBaseDirectory;
-
- /** The directory containing natural language files. */
- private URL naturalLanguagesBaseDirectory;
-
- /**
- * Sets the location of the orthography configuration.
- * @param orthographyConfigurationLocation The location of the orthography configuration.
- */
- public void setOrthographyConfigurationLocation(final URL orthographyConfigurationLocation) {
- this.orthographyConfigurationLocation = orthographyConfigurationLocation;
- }
-
- /**
- * Returns the location of the orthography configuration.
- * @return The location of the orthography configuration.
- */
- public URL getOrthographyConfigurationLocation() {
- return this.orthographyConfigurationLocation;
- }
-
- /**
- * Sets the word lists base directory.
- * @param wordListsBaseDirectory The word lists base directory to set.
- */
- public void setWordListsBaseDirectory(final URL wordListsBaseDirectory) {
- this.wordListsBaseDirectory = wordListsBaseDirectory;
- }
-
- /**
- * Returns the directory containing unparsed word lists.
- * @return The directory containing unparsed word lists.
- */
- public URL getWordListsBaseDirectory() {
- return this.wordListsBaseDirectory;
- }
-
- /**
- * Sets the serialized dictionaries base directory.
- * @param serializedDictionariesBaseDirectory The serialized dictionaries base directory to set.
- */
- public void setSerializedDictionariesBaseDirectory(final URL serializedDictionariesBaseDirectory) {
- this.serializedDictionariesBaseDirectory = serializedDictionariesBaseDirectory;
- }
-
- /**
- * Returns the directory containing parsed and serialized dictionaries.
- * @return The directory containing parsed and serialized dictionaries.
- */
- public URL getSerializedDictionariesBaseDirectory() {
- return this.serializedDictionariesBaseDirectory;
- }
-
- /**
- * Sets the raw hyphenation patterns base directory.
- * @param rawHyphenationPatternsBaseDirectory The raw hyphenation patterns base directory to set.
- */
- public void setRawHyphenationPatternsBaseDirectory(final URL rawHyphenationPatternsBaseDirectory) {
- this.rawHyphenationPatternsBaseDirectory = rawHyphenationPatternsBaseDirectory;
- }
-
- /**
- * Returns the directory containing unparsed hyphenation pattern files.
- * @return The directory containing unparsed hyphenation pattern files.
- */
- public URL getRawHyphenationPatternsBaseDirectory() {
- return this.rawHyphenationPatternsBaseDirectory;
- }
-
- /**
- * Sets the serialized hyphenation patterns base directory.
- * @param serializedHyphenationPatternsBaseDirectory The serialized hyphenation patterns base directory to set.
- */
- public void setSerializedHyphenationPatternsBaseDirectory(final URL serializedHyphenationPatternsBaseDirectory) {
- this.serializedHyphenationPatternsBaseDirectory = serializedHyphenationPatternsBaseDirectory;
- }
-
- /**
- * Returns the directory containing parsed and serialized hyphenation pattern files.
- * @return The directory containing parsed and serialized hyphenation pattern files.
- */
- public URL getSerializedHyphenationPatternsBaseDirectory() {
- return this.serializedHyphenationPatternsBaseDirectory;
- }
-
- /**
- * Sets the natural languages base directory.
- * @param naturalLanguagesBaseDirectory The natural languages base directory to set.
- */
- public void setNaturalLanguagesBaseDirectory(final URL naturalLanguagesBaseDirectory) {
- this.naturalLanguagesBaseDirectory = naturalLanguagesBaseDirectory;
- }
-
- /**
- * Returns the directory containing natural language files.
- * @return The directory containing natural language files.
- */
- public URL getNaturalLanguagesBaseDirectory() {
- return this.naturalLanguagesBaseDirectory;
- }
-
-}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -68,7 +68,7 @@
private WordBreaker wordBreaker;
/** The parent hyphenation server. */
- private HyphenationServer4a server;
+ private OrthographyServer4a server;
/* TODO: Following orthography-specific config needs to be moved to XML or subclass. */
/** Character delimiting a compound word. NB: This variable may be orthography specific, and may therefore need to
@@ -82,7 +82,7 @@
* Constructor.
* @param server The parent hyphenation server.
*/
- public OrthographyConfig4a(final HyphenationServer4a server) {
+ public OrthographyConfig4a(final OrthographyServer4a server) {
this.server = server;
}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java (from rev 12043, trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4a.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -0,0 +1,340 @@
+/*
+ * Copyright 2004 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$
+ */
+
+/*
+ * Known contributors:
+ * @author Carlos Villegas <ca...@un...> (original author)
+ */
+
+package org.foray.orthography;
+
+import org.foray.common.ForayConstants;
+import org.foray.common.i18n.Language4a;
+import org.foray.common.url.UrlFactory;
+import org.foray.orthography.util.ConfigParser;
+import org.foray.orthography.util.NatLangParser;
+import org.foray.orthography.util.NaturalLanguage;
+
+import org.axsl.common.i18n.Language;
+import org.axsl.common.i18n.WritingSystem;
+import org.axsl.orthography.OrthographyException;
+import org.axsl.orthography.OrthographyServer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * This class is the main entry point to the hyphenation package.
+ */
+public class OrthographyServer4a implements OrthographyServer {
+
+ /** The logger. */
+ private Logger logger = LoggerFactory.getLogger(OrthographyServer4a.class);
+
+ /** The configuration for this server. */
+ private OrthographyServerConfig config;
+
+ /** Map of all Natural Language instances. */
+ private Map<Language, NaturalLanguage> languages = new HashMap<Language, NaturalLanguage>();
+
+ /** An EntityResolver to be used by XML parsers (for handling DTD catalogs, etc.). */
+ private EntityResolver entityResolver = null;
+
+ /** Map of orthographies and their configurations to be used by this server. */
+ private Map<WritingSystem, OrthographyConfig4a> orthographyConfigurations =
+ new HashMap<WritingSystem, OrthographyConfig4a>();
+
+ /** The map of match rule lists, keyed by id. */
+ private Map<String, List<Pattern>> matchRuleLists = new HashMap<String, List<Pattern>>();
+
+ /** The map of derivative rule lists, keyed by id. */
+ private Map<String, List<DerivativePattern>> derivativeRuleLists = new HashMap<String, List<DerivativePattern>>();
+
+ /**
+ * Constructor.
+ * @param config The configuration for this server.
+ * @throws OrthographyException For errors parsing configuration.
+ */
+ public OrthographyServer4a(final OrthographyServerConfig config) throws OrthographyException {
+ this.config = config;
+ if (config.getOrthographyConfigurationLocation() == null) {
+ throw new OrthographyException("Orthography configuration location has not been provided");
+ } else {
+ InputStream inputStream = null;
+ try {
+ inputStream = config.getOrthographyConfigurationLocation().openStream();
+ } catch (final IOException e) {
+ throw new OrthographyException(e);
+ }
+ final InputSource inputSource = new InputSource(inputStream);
+
+ final ConfigParser parser = new ConfigParser(this, inputSource);
+ parser.start();
+ }
+ }
+
+ /**
+ * Finds or creates the instance of this class that is suitable for a given
+ * language description.
+ * @param languageCode The ISO-639 code for the language sought.
+ * @return The suitable instance for {@code languageCode}.
+ */
+ public NaturalLanguage getNaturalLanguage(
+ final String languageCode) {
+ final Language iso639 = Language4a.findFromAlpha(languageCode);
+ return this.getNaturalLanguage(iso639);
+ }
+
+ /**
+ * Finds or creates the instance of this class that is suitable for a given
+ * language description.
+ * @param iso639 The ISO-639 instance for the language sought.
+ * @return The suitable instance for {@code iso639}.
+ */
+ public NaturalLanguage getNaturalLanguage(final Language iso639) {
+ NaturalLanguage nl = this.languages.get(iso639);
+ if (nl != null) {
+ return nl;
+ }
+ try {
+ nl = this.parseNaturalLanguage(iso639.getAlpha3Code());
+ } catch (final OrthographyException e) {
+ this.logger.error(e.getMessage());
+ return null;
+ }
+ if (nl != null) {
+ this.languages.put(iso639, nl);
+ }
+ return nl;
+ }
+
+ /**
+ * Makes a new, empty instance of this class for a given language
+ * description.
+ * @param languageCode The ISO-639 code for the new instance.
+ * @return A new instance for {@code languageCode}, or null if an
+ * instance already exists for it.
+ */
+ public NaturalLanguage makeNaturalLanguage(
+ final String languageCode) {
+ final Language iso639 = Language4a.findFromAlpha(languageCode);
+ final NaturalLanguage existingLang = this.getNaturalLanguage(iso639);
+ if (existingLang != null) {
+ /* If the instance already exists, don't return a new one for the
+ * same language code. */
+ return null;
+ }
+ final NaturalLanguage newLang = new NaturalLanguage();
+ /* TODO: It is ugly to expose this instance before it has been parsed.
+ * Instead we need to add a concept of "locking" to this class that
+ * will make it effectively immutable, and register it at that time
+ * instead of now. */
+ this.languages.put(iso639, newLang);
+ return newLang;
+ }
+
+ /**
+ * Parse a NaturalLanguage instance from its description.
+ * @param languageCode The language code of the language to be parsed.
+ * @return The parsed NaturalLanguage instance, if it can be found, or null
+ * otherwise.
+ * @throws OrthographyException For errors finding or parsing the files.
+ */
+ private NaturalLanguage parseNaturalLanguage(final String languageCode)
+ throws OrthographyException {
+ final URL naturalLanguageDir = this.config.getNaturalLanguagesBaseDirectory();
+ final String filePrefix = languageCode + "-language";
+ if (naturalLanguageDir == null) {
+ return null;
+ }
+ NaturalLanguage nl = null;
+
+ /* Use the language code as the base name for the file. */
+
+ /* First look for the serialized object. */
+ String fileName = filePrefix
+ + ForayConstants.BINARY_SERIALIZATION_EXTENSION;
+ URL nlFile = null;
+ try {
+ nlFile = UrlFactory.createURL(naturalLanguageDir, fileName);
+ } catch (final MalformedURLException e) {
+ /* This probably means that the hyphenation URL is not valid.
+ * Rethrow the exception to alert the user. */
+ throw new OrthographyException(e);
+ }
+
+ InputStream inputStream = null;
+ try {
+ inputStream = nlFile.openStream();
+ } catch (final IOException e) {
+ /* This just means that the input doesn't exist. Ignore the
+ * exception as the null value in "inputStream" will control the
+ * downstream logic. */
+ }
+
+ if (inputStream != null) {
+ ObjectInputStream ois = null;
+ try {
+ ois = new ObjectInputStream(inputStream);
+ nl = (NaturalLanguage) ois.readObject();
+ return nl;
+ } catch (final IOException e) {
+ throw new OrthographyException(e);
+ } catch (final ClassNotFoundException e) {
+ throw new OrthographyException(e);
+ } finally {
+ if (ois != null) {
+ try {
+ ois.close();
+ } catch (final IOException e) {
+ this.logger.error(
+ "Exception closing ObjectInputStream "
+ + "for " + nlFile.toString(), e);
+ }
+ }
+ }
+ }
+
+
+ /* Look for the raw XML file. */
+ fileName = filePrefix + ".xml";
+ try {
+ nlFile = UrlFactory.createURL(naturalLanguageDir, fileName);
+ } catch (final MalformedURLException e) {
+ /* This probably means that the hyphenation URL is not valid.
+ * Rethrow the exception to alert the user. */
+ throw new OrthographyException(e);
+ }
+
+ /* Does the XML file exist? */
+ try {
+ inputStream = nlFile.openStream();
+ } catch (final IOException e) {
+ /* The XML pattern file does not exist. Do not try to parse it. */
+ return null;
+ }
+
+ if (this.logger.isDebugEnabled()) {
+ this.logger.debug("reading " + naturalLanguageDir + filePrefix
+ + ".xml");
+ }
+ final NatLangParser parser = new NatLangParser(this.logger);
+ nl = parser.parse(nlFile);
+ return nl;
+ }
+
+ @Override
+ public HyphenationConsumer4a makeConsumer() {
+ return new HyphenationConsumer4a(this);
+ }
+
+ /**
+ * Returns the EntityResolver for this server.
+ * @return The EntityResolver.
+ */
+ public EntityResolver getEntityResolver() {
+ return this.entityResolver;
+ }
+
+ /**
+ * Sets the EntityResolver for this server.
+ * @param entityResolver The new EntityResolver.
+ */
+ public void setEntityResolver(final EntityResolver entityResolver) {
+ this.entityResolver = entityResolver;
+ }
+
+ /**
+ * Registers a configuration for a given orthography.
+ * @param orthography The orthography for which the configuration should be registered.
+ * @param config The configuration for {@code orthography}.
+ */
+ public void registerOrthographyConfig(final WritingSystem orthography, final OrthographyConfig4a config) {
+ this.orthographyConfigurations.put(orthography, config);
+ }
+
+ @Override
+ public OrthographyConfig4a getOrthography(final WritingSystem orthography) {
+ return this.orthographyConfigurations.get(orthography);
+ }
+
+ /**
+ * Registers a list of match rules.
+ * @param id The id of the match rules to be registered.
+ * @param matchRules The match rules being registered.
+ */
+ public void registerMatchRules(final String id, final List<Pattern> matchRules) {
+ if (this.matchRuleLists.get(id) != null) {
+ throw new IllegalArgumentException("Match Rules already exist for id: " + id);
+ }
+ this.matchRuleLists.put(id, matchRules);
+ }
+
+ /**
+ * Returns the list of match rules for a given Id.
+ * @param id The id of the match rules to be returned.
+ * @return The match rules for {@code id}.
+ */
+ public List<Pattern> getMatchRules(final String id) {
+ return this.matchRuleLists.get(id);
+ }
+
+ /**
+ * Registers a list of derivative rules.
+ * @param id The id of the derivative rules to be registered.
+ * @param derivativeRules The derivative rules being registered.
+ */
+ public void registerDerivativeRules(final String id, final List<DerivativePattern> derivativeRules) {
+ if (this.derivativeRuleLists.get(id) != null) {
+ throw new IllegalArgumentException("Derivative Rules already exist for id: " + id);
+ }
+ this.derivativeRuleLists.put(id, derivativeRules);
+ }
+
+ /**
+ * Returns the list of derivative rules for a given Id.
+ * @param id The id of the derivative rules to be returned.
+ * @return The derivative rules for {@code id}.
+ */
+ public List<DerivativePattern> getDerivativePatterns(final String id) {
+ return this.derivativeRuleLists.get(id);
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServerConfig.java (from rev 12032, trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServerConfig.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServerConfig.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServerConfig.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2019 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;
+
+import java.net.URL;
+
+/**
+ * Configuration information for the hyphenation server.
+ */
+public class OrthographyServerConfig {
+
+ /** The location of the orthography configuration. */
+ private URL orthographyConfigurationLocation;
+
+ /** The directory containing unparsed word lists. */
+ private URL wordListsBaseDirectory;
+
+ /** The directory containing parsed and serialized dictionaries. */
+ private URL serializedDictionariesBaseDirectory;
+
+ /** The directory containing unparsed hyphenation pattern files.*/
+ private URL rawHyphenationPatternsBaseDirectory;
+
+ /** The directory containing parsed and serialized hyphenation pattern files. */
+ private URL serializedHyphenationPatternsBaseDirectory;
+
+ /** The directory containing natural language files. */
+ private URL naturalLanguagesBaseDirectory;
+
+ /**
+ * Sets the location of the orthography configuration.
+ * @param orthographyConfigurationLocation The location of the orthography configuration.
+ */
+ public void setOrthographyConfigurationLocation(final URL orthographyConfigurationLocation) {
+ this.orthographyConfigurationLocation = orthographyConfigurationLocation;
+ }
+
+ /**
+ * Returns the location of the orthography configuration.
+ * @return The location of the orthography configuration.
+ */
+ public URL getOrthographyConfigurationLocation() {
+ return this.orthographyConfigurationLocation;
+ }
+
+ /**
+ * Sets the word lists base directory.
+ * @param wordListsBaseDirectory The word lists base directory to set.
+ */
+ public void setWordListsBaseDirectory(final URL wordListsBaseDirectory) {
+ this.wordListsBaseDirectory = wordListsBaseDirectory;
+ }
+
+ /**
+ * Returns the directory containing unparsed word lists.
+ * @return The directory containing unparsed word lists.
+ */
+ public URL getWordListsBaseDirectory() {
+ return this.wordListsBaseDirectory;
+ }
+
+ /**
+ * Sets the serialized dictionaries base directory.
+ * @param serializedDictionariesBaseDirectory The serialized dictionaries base directory to set.
+ */
+ public void setSerializedDictionariesBaseDirectory(final URL serializedDictionariesBaseDirectory) {
+ this.serializedDictionariesBaseDirectory = serializedDictionariesBaseDirectory;
+ }
+
+ /**
+ * Returns the directory containing parsed and serialized dictionaries.
+ * @return The directory containing parsed and serialized dictionaries.
+ */
+ public URL getSerializedDictionariesBaseDirectory() {
+ return this.serializedDictionariesBaseDirectory;
+ }
+
+ /**
+ * Sets the raw hyphenation patterns base directory.
+ * @param rawHyphenationPatternsBaseDirectory The raw hyphenation patterns base directory to set.
+ */
+ public void setRawHyphenationPatternsBaseDirectory(final URL rawHyphenationPatternsBaseDirectory) {
+ this.rawHyphenationPatternsBaseDirectory = rawHyphenationPatternsBaseDirectory;
+ }
+
+ /**
+ * Returns the directory containing unparsed hyphenation pattern files.
+ * @return The directory containing unparsed hyphenation pattern files.
+ */
+ public URL getRawHyphenationPatternsBaseDirectory() {
+ return this.rawHyphenationPatternsBaseDirectory;
+ }
+
+ /**
+ * Sets the serialized hyphenation patterns base directory.
+ * @param serializedHyphenationPatternsBaseDirectory The serialized hyphenation patterns base directory to set.
+ */
+ public void setSerializedHyphenationPatternsBaseDirectory(final URL serializedHyphenationPatternsBaseDirectory) {
+ this.serializedHyphenationPatternsBaseDirectory = serializedHyphenationPatternsBaseDirectory;
+ }
+
+ /**
+ * Returns the directory containing parsed and serialized hyphenation pattern files.
+ * @return The directory containing parsed and serialized hyphenation pattern files.
+ */
+ public URL getSerializedHyphenationPatternsBaseDirectory() {
+ return this.serializedHyphenationPatternsBaseDirectory;
+ }
+
+ /**
+ * Sets the natural languages base directory.
+ * @param naturalLanguagesBaseDirectory The natural languages base directory to set.
+ */
+ public void setNaturalLanguagesBaseDirectory(final URL naturalLanguagesBaseDirectory) {
+ this.naturalLanguagesBaseDirectory = naturalLanguagesBaseDirectory;
+ }
+
+ /**
+ * Returns the directory containing natural language files.
+ * @return The directory containing natural language files.
+ */
+ public URL getNaturalLanguagesBaseDirectory() {
+ return this.naturalLanguagesBaseDirectory;
+ }
+
+}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -41,8 +41,8 @@
import org.foray.orthography.DerivativeRule;
import org.foray.orthography.DictionaryResource;
import org.foray.orthography.HyphenationPatternsResource;
-import org.foray.orthography.HyphenationServer4a;
import org.foray.orthography.OrthographyConfig4a;
+import org.foray.orthography.OrthographyServer4a;
import org.foray.orthography.PosUtils;
import org.foray.orthography.WordBreaker;
import org.foray.orthography.WordWrapperFactory;
@@ -79,7 +79,7 @@
import javax.xml.parsers.SAXParserFactory;
/**
- * SAX2 Handler which retrieves the orthography configuration information and stores it in a {@link HyphenationServer4a}
+ * SAX2 Handler which retrieves the orthography configuration information and stores it in a {@link OrthographyServer4a}
* instance.
* Normally this class doesn't need to be accessed directly.
*/
@@ -154,7 +154,7 @@
private InputSource filename;
/** The hyphenation server receiving the parsed information. */
- private HyphenationServer4a hyphenationServer;
+ private OrthographyServer4a hyphenationServer;
/** The XML parser's Locator instance, used to indicate line and column numbers in user messages. */
private Locator locator;
@@ -176,7 +176,7 @@
* @param filename The file which contains the configuration information
* to be parsed.
*/
- public ConfigParser(final HyphenationServer4a server, final InputSource filename) {
+ public ConfigParser(final OrthographyServer4a server, final InputSource filename) {
this.hyphenationServer = server;
this.filename = filename;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -35,9 +35,9 @@
import org.foray.common.primitive.ObjectUtils;
import org.foray.common.primitive.StringUtils;
import org.foray.common.primitive.XmlUtils;
-import org.foray.orthography.HyphenationServer4a;
-import org.foray.orthography.HyphenationServerConfig;
import org.foray.orthography.OrthographyConfig4a;
+import org.foray.orthography.OrthographyServer4a;
+import org.foray.orthography.OrthographyServerConfig;
import org.foray.orthography.SegmentDictionary;
import org.axsl.common.i18n.WritingSystem;
@@ -166,7 +166,7 @@
private Logger logger = LoggerFactory.getLogger(SpellChecker.class);
/** The Hyphenation server. */
- private HyphenationServer4a server;
+ private OrthographyServer4a server;
/** The list of elements having no content but that can be placed in the middle of a word. */
private List<String> elementIgnoreList = Arrays.asList(new String[] {"Page", "MendOut", "Comment", "ToDo"});
@@ -196,9 +196,9 @@
this.input = input;
this.output = output;
- final HyphenationServerConfig serverConfig = new HyphenationServerConfig();
+ final OrthographyServerConfig serverConfig = new OrthographyServerConfig();
serverConfig.setOrthographyConfigurationLocation(orthographyConfigPath);
- this.server = new HyphenationServer4a(serverConfig);
+ this.server = new OrthographyServer4a(serverConfig);
if (adhocDictionaryPaths != null) {
for (URL adhocDictionaryPath : adhocDictionaryPaths) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -30,8 +30,8 @@
import org.foray.common.i18n.Language4a;
import org.foray.common.url.UrlFactory;
-import org.foray.orthography.HyphenationServer4a;
-import org.foray.orthography.HyphenationServerConfig;
+import org.foray.orthography.OrthographyServer4a;
+import org.foray.orthography.OrthographyServerConfig;
import org.axsl.common.i18n.Language;
import org.axsl.orthography.OrthographyException;
@@ -113,7 +113,7 @@
* upon language codes in the document itself. */
/** The server used to find natural language resources. */
- private HyphenationServer4a server;
+ private OrthographyServer4a server;
/** The logger (lazily created). Use {#getLogger()} to get the instance. */
private Logger logger;
@@ -129,7 +129,7 @@
* document will be tested.
* find the DTD for this document.
*/
- public ValidateChars(final HyphenationServer4a server,
+ public ValidateChars(final OrthographyServer4a server,
final InputSource input, final String catalog,
final String languageCode) {
this.server = server;
@@ -378,12 +378,12 @@
} catch (final MalformedURLException e) {
logger.error("Invalid URL: " + nlDir, e);
}
- final HyphenationServerConfig config = new HyphenationServerConfig();
+ final OrthographyServerConfig config = new OrthographyServerConfig();
config.setRawHyphenationPatternsBaseDirectory(hyphenationDir);
config.setSerializedHyphenationPatternsBaseDirectory(hyphenationDir);
- HyphenationServer4a server = null;
+ OrthographyServer4a server = null;
try {
- server = new HyphenationServer4a(config);
+ server = new OrthographyServer4a(config);
} catch (final OrthographyException e) {
logger.error(e.getMessage(), e);
/* CheckStyle: Allow System.exit() in main method. */
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -29,9 +29,9 @@
package org.foray.orthography.util;
import org.foray.common.i18n.WritingSystem4a;
-import org.foray.orthography.HyphenationServer4a;
-import org.foray.orthography.HyphenationServerConfig;
import org.foray.orthography.OrthographyConfig4a;
+import org.foray.orthography.OrthographyServer4a;
+import org.foray.orthography.OrthographyServerConfig;
import org.foray.orthography.SegmentDictionary;
import org.axsl.orthography.Dictionary;
@@ -88,7 +88,7 @@
private OrthographyConfig4a currentOrthographyConfig;
/** The Hyphenation server. */
- private HyphenationServer4a server;
+ private OrthographyServer4a server;
/** The list of dictionaries that are currently active, i.e. that match the current orthography. */
private List<Dictionary> currentDictionaries = new ArrayList<Dictionary>();
@@ -112,9 +112,9 @@
this.input = input;
this.output = output;
- final HyphenationServerConfig serverConfig = new HyphenationServerConfig();
+ final OrthographyServerConfig serverConfig = new OrthographyServerConfig();
serverConfig.setOrthographyConfigurationLocation(orthographyConfigPath);
- this.server = new HyphenationServer4a(serverConfig);
+ this.server = new OrthographyServer4a(serverConfig);
/* Remove hard-coding. */
final WritingSystem4a writingSystem = WritingSystem4a.find("eng", "USA", "Latn");
this.currentOrthographyConfig = this.server.getOrthography(writingSystem);
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -49,7 +49,7 @@
public class HyphenationConsumer4aTests {
/** The hyphenation server used in these tests. */
- private static HyphenationServer4a server;
+ private static OrthographyServer4a server;
/** The paragraph configuration that should be used in these tests. */
private static ParaConfig paraConfig = new ParaConfig4a(null, 0, WritingSystem4a.USA, 0, 0);
@@ -65,8 +65,8 @@
*/
@BeforeClass
public static void beforeClass() throws IOException, OrthographyException {
- final HyphenationServerConfig config = HyphenationServer4aTests.makeHyphenationServerConfig();
- server = new HyphenationServer4a(config);
+ final OrthographyServerConfig config = HyphenationServer4aTests.makeHyphenationServerConfig();
+ server = new OrthographyServer4a(config);
Assert.assertNotNull(server);
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java 2021-11-12 11:54:29 UTC (rev 12043)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java 2021-11-12 12:04:06 UTC (rev 12044)
@@ -43,12 +43,12 @@
import java.util.Properties;
/**
- * Tests of {@link HyphenationServer4a}.
+ * Tests of {@link OrthographyServer4a}.
*/
public class HyphenationServer4aTests {
/** The object under test. */
- private HyphenationServer4a out;
+ private OrthographyServer4a out;
/**
* Set up the tests.
@@ -66,7 +66,7 @@
* @return A hyphenation server config that can be used by hyphenation tests.
* @throws IOException For errors retrieving the environment, or creating the URLs.
*/
- public static HyphenationServerConfig makeHyphenationServerConfig() throws IOException {
+ public static OrthographyServerConfig makeHyphenationServerConfig() throws IOException {
final Properties buildProperties = Environment.getBuildProperties();
final String foraySandbox = buildProperties.getProperty("foray.sandbox");
@@ -87,7 +87,7 @@
final URL parsedPatterns = new URL("file", null, parsedPatternsPath);
final URL naturalLanguage = new URL("file", null, naturalLanguagePath);
- final HyphenationServerConfig config = new HyphenationServerConfig();
+ final OrthographyServerConfig config = new OrthographyServerConfig();
config.setOrthographyConfigurationLocation(orthographyFile);
config.setWordListsBaseDirectory(rawDictionary);
config.setSerializedDictionariesBaseDirectory(parsedDictionary);
@@ -98,14 +98,14 @@
}
/**
- * Creates an instance of {@link HyphenationServer4a}.
+ * Creates an instance of {@link OrthographyServer4a}.
* @return The newly-created instance.
* @throws IOException For any errors creating the instance.
* @throws OrthographyException For errors creating a hyphenation server.
*/
- public static HyphenationServer4a makeHyphenationServer() throws IOException, OrthographyException {
- final HyphenationServerConfig config = makeHyphenationServerConfig();
- return new HyphenationServer4a(config);
+ public static OrthographyServer4a makeHyphenationServer() throws IOException, OrthographyException {
+ final OrthographyServerConfig config = makeHyphenationServerConfig();
+ return new OrthographyServer4a(config);
}
/**
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/Pattern...
[truncated message content] |
|
From: <vic...@us...> - 2021-11-12 11:54:32
|
Revision: 12043
http://sourceforge.net/p/foray/code/12043
Author: victormote
Date: 2021-11-12 11:54:29 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Conform to aXSL changes: Rename interface OrthographyConfig to Orthography; also, related method names.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-12 01:23:10 UTC (rev 12042)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-12 11:54:29 UTC (rev 12043)
@@ -35,7 +35,7 @@
import org.axsl.common.i18n.WritingSystem;
import org.axsl.font.FontConsumer;
import org.axsl.linebreak.LineBreakControl;
-import org.axsl.orthography.OrthographyConfig;
+import org.axsl.orthography.Orthography;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.OrthographyServer;
import org.axsl.orthography.Word;
@@ -395,12 +395,12 @@
* LineText items to find the beginning of the word.
*/
final OrthographyServer server = this.getTextServer().getHyphenationServer();
- final WritingSystem orthography = this.currentLineText.inlineWritingSystem();
+ final WritingSystem writingSystem = this.currentLineText.inlineWritingSystem();
- final OrthographyConfig orthographyConfig = server.getOrthographyConfig(orthography);
+ final Orthography orthographyConfig = server.getOrthography(writingSystem);
if (orthographyConfig == null) {
throw new TextException(String.format("Configuration not found for orthography {}",
- orthography.toString()));
+ writingSystem.toString()));
}
// Count the number of chars at the beginning that should be ignored.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 01:23:10 UTC (rev 12042)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 11:54:29 UTC (rev 12043)
@@ -73,7 +73,7 @@
final ParaConfig paraConfig) {
final ParaBranch4a wordSequence = new ParaBranch4a(paraConfig);
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
- final OrthographyConfig4a orthographyConfig = this.server.getOrthographyConfig(paraConfig.getWritingSystem());
+ final OrthographyConfig4a orthographyConfig = this.server.getOrthography(paraConfig.getWritingSystem());
if (orthographyConfig == null) {
this.logger.error("Orthography not configured for: " + paraConfig.getWritingSystem());
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-12 01:23:10 UTC (rev 12042)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-12 11:54:29 UTC (rev 12043)
@@ -291,7 +291,7 @@
}
@Override
- public OrthographyConfig4a getOrthographyConfig(final WritingSystem orthography) {
+ public OrthographyConfig4a getOrthography(final WritingSystem orthography) {
return this.orthographyConfigurations.get(orthography);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java 2021-11-12 01:23:10 UTC (rev 12042)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java 2021-11-12 11:54:29 UTC (rev 12043)
@@ -35,7 +35,7 @@
import org.foray.orthography.wrapper.UppercaseWord;
import org.axsl.orthography.Dictionary;
-import org.axsl.orthography.OrthographyConfig;
+import org.axsl.orthography.Orthography;
import org.axsl.orthography.PartOfSpeech;
import org.axsl.orthography.Word;
@@ -47,7 +47,7 @@
/**
* The resources (dictionaries, word wrappers, hyphenation patterns, etc.) that should be used by a given orthography.
*/
-public class OrthographyConfig4a implements OrthographyConfig {
+public class OrthographyConfig4a implements Orthography {
/** The list of ids to lists of regex patterns, which, for this orthography, signal a valid word if matched. */
private List<String> matchRuleListIds = new ArrayList<String>();
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 01:23:10 UTC (rev 12042)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 11:54:29 UTC (rev 12043)
@@ -95,10 +95,10 @@
/** The qualified name, if specified. */
private String qName;
- /** The orthography specified in an xml:lang attribute for this element, if any. */
- private WritingSystem orthography;
+ /** The writing system specified in an xml:lang attribute for this element, if any. */
+ private WritingSystem writingSystem;
- /** The orthography configuration for this element, only if {@link #orthography} is not null. */
+ /** The orthography configuration for this element, only if {@link #writingSystem} is not null. */
private OrthographyConfig4a orthographyConfig;
/**
@@ -119,7 +119,7 @@
@Override
public String toString() {
return String.format("Namespace: %1$s, Local Name: %2$s, QName: %3$s, Orthography: %4$s", this.namespace,
- this.localName, this.qName, this.orthography);
+ this.localName, this.qName, this.writingSystem);
}
}
@@ -360,14 +360,14 @@
* the text content. */
final Script4a script = Script4a.LATIN;
- element.orthography = WritingSystem4a.find(language, country, script);
- if (element.orthography == null) {
+ element.writingSystem = WritingSystem4a.find(language, country, script);
+ if (element.writingSystem == null) {
final String message = String.format(
"Orthography not found. Language: %1$s, Country: %2$s, Script: %3$s ", languageString,
countryString, script.getAlphaCode());
this.output.println(message + locationString());
} else {
- final OrthographyConfig4a config = this.server.getOrthographyConfig(element.orthography);
+ final OrthographyConfig4a config = this.server.getOrthography(element.writingSystem);
if (config == null) {
final String message = String.format(
"Unconfigured orthography. Language: %1$s, Country: %2$s, Script: %3$s ",
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 01:23:10 UTC (rev 12042)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 11:54:29 UTC (rev 12043)
@@ -116,8 +116,8 @@
serverConfig.setOrthographyConfigurationLocation(orthographyConfigPath);
this.server = new HyphenationServer4a(serverConfig);
/* Remove hard-coding. */
- final WritingSystem4a orthography = WritingSystem4a.find("eng", "USA", "Latn");
- this.currentOrthographyConfig = this.server.getOrthographyConfig(orthography);
+ final WritingSystem4a writingSystem = WritingSystem4a.find("eng", "USA", "Latn");
+ this.currentOrthographyConfig = this.server.getOrthography(writingSystem);
if (adhocDictionaryPaths != null) {
for (URL adhocDictionaryPath : adhocDictionaryPaths) {
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 01:23:10 UTC (rev 12042)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 11:54:29 UTC (rev 12043)
@@ -142,7 +142,7 @@
if (! testWord.toLowerCase().equals("hyphenation")) {
throw new OrthographyException("Test of \"hyphenation\" has invalid input.");
}
- final OrthographyConfig4a orthography = server.getOrthographyConfig(WritingSystem4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(3, hyphenation.getQtyHyphenationPoints());
@@ -183,7 +183,7 @@
if (! testWord.toLowerCase().equals("obligatory")) {
throw new OrthographyException("Test of \"obligatory\" has invalid input.");
}
- final OrthographyConfig4a orthography = server.getOrthographyConfig(WritingSystem4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(4, hyphenation.getQtyHyphenationPoints());
@@ -202,7 +202,7 @@
@Test
public void testEnInvalidCharacter() throws OrthographyException {
final String testWord = "table8";
- final OrthographyConfig4a orthography = server.getOrthographyConfig(WritingSystem4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNull(hyphenation);
}
@@ -215,7 +215,7 @@
@Test
public void testTimes() throws OrthographyException {
final String testWord = "times";
- final OrthographyConfig4a orthography = server.getOrthographyConfig(WritingSystem4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthography(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals("times", hyphenation.toString());
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java 2021-11-12 01:23:10 UTC (rev 12042)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java 2021-11-12 11:54:29 UTC (rev 12043)
@@ -118,58 +118,58 @@
final PatternTree.Source expectedSource = PatternTree.Source.RESOURCES;
/* English, U.S. */
- WritingSystem4a orthography = WritingSystem4a.USA;
- PatternTree tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
+ WritingSystem4a writingSystem = WritingSystem4a.USA;
+ PatternTree tree = this.out.getOrthography(writingSystem).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Finnish. */
- orthography = WritingSystem4a.FINLAND;
- tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
+ writingSystem = WritingSystem4a.FINLAND;
+ tree = this.out.getOrthography(writingSystem).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Hungarian. */
- orthography = WritingSystem4a.HUNGARY;
- tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
+ writingSystem = WritingSystem4a.HUNGARY;
+ tree = this.out.getOrthography(writingSystem).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Italian. */
- orthography = WritingSystem4a.ITALY;
- tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
+ writingSystem = WritingSystem4a.ITALY;
+ tree = this.out.getOrthography(writingSystem).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Polish. */
- orthography = WritingSystem4a.POLAND;
- tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
+ writingSystem = WritingSystem4a.POLAND;
+ tree = this.out.getOrthography(writingSystem).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Portuguese. */
- orthography = WritingSystem4a.PORTUGAL;
- tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
+ writingSystem = WritingSystem4a.PORTUGAL;
+ tree = this.out.getOrthography(writingSystem).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Russian. */
- orthography = WritingSystem4a.RUSSIA;
- tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
+ writingSystem = WritingSystem4a.RUSSIA;
+ tree = this.out.getOrthography(writingSystem).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Spanish. */
- orthography = WritingSystem4a.SPAIN;
- tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
+ writingSystem = WritingSystem4a.SPAIN;
+ tree = this.out.getOrthography(writingSystem).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Try one that we know we don't have, Klingon. */
final Language4a language = Language4a.findFromAlpha("tlh");
- orthography = WritingSystem4a.find(language, null, null);
+ writingSystem = WritingSystem4a.find(language, null, null);
/* We have not configured an orthography. */
- Assert.assertNull(this.out.getOrthographyConfig(orthography));
+ Assert.assertNull(this.out.getOrthography(writingSystem));
}
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java 2021-11-12 01:23:10 UTC (rev 12042)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java 2021-11-12 11:54:29 UTC (rev 12043)
@@ -54,8 +54,8 @@
@BeforeClass
public static void beforeClass() throws IOException, OrthographyException {
final HyphenationServer4a server = HyphenationServer4aTests.makeHyphenationServer();
- final WritingSystem4a orthography = WritingSystem4a.USA;
- PatternTreeTests.patternTree = server.getOrthographyConfig(orthography).getHyphenationPatterns();
+ final WritingSystem4a writingSystem = WritingSystem4a.USA;
+ PatternTreeTests.patternTree = server.getOrthography(writingSystem).getHyphenationPatterns();
Assert.assertNotNull(PatternTreeTests.patternTree);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 01:23:13
|
Revision: 12042
http://sourceforge.net/p/foray/code/12042
Author: victormote
Date: 2021-11-12 01:23:10 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Conform to aXSL change: Change method names and parameter names to reflect change from Orthography to WritingSystem.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaConfig4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java
trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -223,7 +223,7 @@
* Returns the orthography.
* @return The orthography.
*/
- public WritingSystem orthography() {
+ public WritingSystem writingSystem() {
/* TODO: Get this from the FOTree. */
return WritingSystem4a.USA;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberArea.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -239,7 +239,7 @@
final FontUse fontUse = getPrimaryFont();
fontUse.registerCharsUsed(word);
return fontUse.width(word, 0, word.length(), traitFontSize(), traitGeneratedBy().traitLetterSpacingOpt(this),
- traitGeneratedBy().traitWordSpacingOpt(this), fontOptions(), orthography());
+ traitGeneratedBy().traitWordSpacingOpt(this), fontOptions(), writingSystem());
}
@Override
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationArea.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -266,7 +266,7 @@
final FontUse fontUse = getPrimaryFont();
fontUse.registerCharsUsed(word);
return fontUse.width(word, 0, word.length(), traitFontSize(), traitGeneratedBy().traitLetterSpacingOpt(this),
- traitGeneratedBy().traitWordSpacingOpt(this), fontOptions(), orthography());
+ traitGeneratedBy().traitWordSpacingOpt(this), fontOptions(), writingSystem());
}
@Override
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/PageNumberCitationLastArea.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -267,7 +267,7 @@
final FontUse fontUse = getPrimaryFont();
fontUse.registerCharsUsed(word);
return fontUse.width(word, 0, word.length(), traitFontSize(), traitGeneratedBy().traitLetterSpacingOpt(this),
- traitGeneratedBy().traitWordSpacingOpt(this), fontOptions(), orthography());
+ traitGeneratedBy().traitWordSpacingOpt(this), fontOptions(), writingSystem());
}
@Override
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -253,7 +253,7 @@
final FontUse fontUse = getPrimaryFont();
fontUse.registerCharsUsed(word);
return fontUse.width(word, 0, word.length(), traitFontSize(), traitGeneratedBy().traitLetterSpacingOpt(this),
- traitGeneratedBy().traitWordSpacingOpt(this), fontOptions(), orthography());
+ traitGeneratedBy().traitWordSpacingOpt(this), fontOptions(), writingSystem());
}
@Override
@@ -325,7 +325,7 @@
* Returns the orthography.
* @return The orthography.
*/
- public WritingSystem orthography() {
+ public WritingSystem writingSystem() {
/* TODO: Get this from the FOTree. */
return WritingSystem4a.USA;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -612,7 +612,7 @@
private int recomputeProgressionDimension() {
final CharSequence text = getText();
final int pd = getPrimaryFont().width(text, 0, text.length(), traitFontSize(), traitLetterSpacingOpt(),
- traitWordSpacingOpt(), fontOptions(), orthography());
+ traitWordSpacingOpt(), fontOptions(), writingSystem());
return pd;
}
@@ -678,7 +678,7 @@
}
@Override
- public WritingSystem orthography() {
+ public WritingSystem writingSystem() {
/* TODO: Get this from the FOTree. */
return WritingSystem4a.USA;
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaConfig4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaConfig4a.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaConfig4a.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -95,7 +95,7 @@
}
@Override
- public WritingSystem getOrthography() {
+ public WritingSystem getWritingSystem() {
return this.orthography;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -139,8 +139,8 @@
}
@Override
- public WritingSystem inlineOrthography() {
- return this.realLineText.inlineOrthography();
+ public WritingSystem inlineWritingSystem() {
+ return this.realLineText.inlineWritingSystem();
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -3899,7 +3899,7 @@
public int getWidth(final ParaLeaf leaf) {
final FontUse fontUse = resolvePrimaryFont(null);
return fontUse.width(leaf.getText(), 0, leaf.getText().length(), this.traitFontSize(null), 0, 0,
- FontOptions.DEFAULT, getOrthography());
+ FontOptions.DEFAULT, getWritingSystem());
}
@Override
@@ -3920,7 +3920,7 @@
}
@Override
- public WritingSystem getOrthography() {
+ public WritingSystem getWritingSystem() {
final Language4a language = this.traitLanguage(null);
final Country4a country = this.traitCountry(null);
final Script4a script = this.traitScript(null);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -215,7 +215,7 @@
}
@Override
- public WritingSystem inlineOrthography() {
+ public WritingSystem inlineWritingSystem() {
final Language4a language = inlineLanguage();
final Country4a country = inlineCountry();
return WritingSystem4a.find(language, country, null);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -281,7 +281,7 @@
}
@Override
- public WritingSystem4a inlineOrthography() {
+ public WritingSystem4a inlineWritingSystem() {
final Language4a language = inlineLanguage();
final Country4a country = inlineCountry();
final Script4a script = inlineScript();
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -58,7 +58,7 @@
public FoWordSequence(final FoObj parent, final CharSequence content) {
super(parent);
final OrthographyConsumer hyphenationConsumer = getHyphenationConsumer();
- final ParaConfig4a config = new ParaConfig4a(getPrimaryFont(null), inlineFontSize(), inlineOrthography(),
+ final ParaConfig4a config = new ParaConfig4a(getPrimaryFont(null), inlineFontSize(), inlineWritingSystem(),
parent.traitWordSpacingMax(null), parent.traitWordSpacingMin(null));
final ParaBranch wordSequence =
hyphenationConsumer.parseWordSequence(content, 0, content.length(), config);
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -115,7 +115,7 @@
final int end) throws TextException {
this.currentLineText = lineText;
this.currentChars = this.currentLineText.inlineText();
- final WritingSystem orthography = lineText.inlineOrthography();
+ final WritingSystem orthography = lineText.inlineWritingSystem();
final String language = orthography.getLanguage().getAlpha3Code();
this.finalWidth = 0;
@@ -395,7 +395,7 @@
* LineText items to find the beginning of the word.
*/
final OrthographyServer server = this.getTextServer().getHyphenationServer();
- final WritingSystem orthography = this.currentLineText.inlineOrthography();
+ final WritingSystem orthography = this.currentLineText.inlineWritingSystem();
final OrthographyConfig orthographyConfig = server.getOrthographyConfig(orthography);
if (orthographyConfig == null) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -73,9 +73,9 @@
final ParaConfig paraConfig) {
final ParaBranch4a wordSequence = new ParaBranch4a(paraConfig);
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
- final OrthographyConfig4a orthographyConfig = this.server.getOrthographyConfig(paraConfig.getOrthography());
+ final OrthographyConfig4a orthographyConfig = this.server.getOrthographyConfig(paraConfig.getWritingSystem());
if (orthographyConfig == null) {
- this.logger.error("Orthography not configured for: " + paraConfig.getOrthography());
+ this.logger.error("Orthography not configured for: " + paraConfig.getWritingSystem());
}
final WordBreaker wordBreaker = orthographyConfig.getWordBreaker();
final List<CharSequence> chunks = wordBreaker.breakIntoWords(sequence);
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -400,7 +400,7 @@
if (newFont != currentFont) {
/* Font has changed. Write the text so far. */
final int size = i - startIndex;
- paintText(area, currentFont, text, startIndex, size, area.fontOptions(), area.orthography());
+ paintText(area, currentFont, text, startIndex, size, area.fontOptions(), area.writingSystem());
if (size > 0) {
startIndex = i;
}
@@ -409,7 +409,7 @@
}
if (startIndex < text.length()) {
paintText(area, currentFont, text, startIndex, text.length() - startIndex,
- area.fontOptions(), area.orthography());
+ area.fontOptions(), area.writingSystem());
}
} catch (final PdfException e) {
throw new GalleyVisitorException(e);
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2021-11-12 00:48:39 UTC (rev 12041)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/ps/PsRenderer.java 2021-11-12 01:23:10 UTC (rev 12042)
@@ -898,7 +898,7 @@
write(moveTo(area));
StringBuilder sb = new StringBuilder();
final IntSequence glyphIndexes =
- area.getPrimaryFont().encode(text, 0, text.length(), area.fontOptions(), area.orthography());
+ area.getPrimaryFont().encode(text, 0, text.length(), area.fontOptions(), area.writingSystem());
for (int i = 0; i < glyphIndexes.length(); i++) {
final int glyphIndex = glyphIndexes.intAt(i);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 00:48:42
|
Revision: 12041
http://sourceforge.net/p/foray/code/12041
Author: victormote
Date: 2021-11-12 00:48:39 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Rename Orthography4a to WritingSystem4a to remain parallel with aXSL, and for distinction from the foray-orthography project.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java
trunk/foray/foray-common/src/test/java/org/foray/common/i18n/Orthography4aTests.java
trunk/foray/foray-font/src/test/java/org/foray/font/Font4aTests.java
trunk/foray/foray-font/src/test/java/org/foray/font/format/ttf/OtfLookupGsubTests.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character.java
trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/LineBreaker.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfDocumentTests.java
trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java
Added Paths:
-----------
trunk/foray/foray-common/src/main/java/org/foray/common/i18n/WritingSystem4a.java
Removed Paths:
-------------
trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/area/TestBlock.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -37,7 +37,7 @@
import org.foray.area.PageCollection;
import org.foray.area.TextArea;
import org.foray.common.FontOptions4a;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.core.ForayException;
import org.axsl.font.FontException;
@@ -292,7 +292,7 @@
/* The following computation is tested in {@link TestFont4a#testWidth()}. */
final String testString = "Test of Centering";
final int textWidth = fontUse.width(
- testString, 0, testString.length(), 12000, 0, 0, this.fontOptionsWithKerning, Orthography4a.USA);
+ testString, 0, testString.length(), 12000, 0, 0, this.fontOptionsWithKerning, WritingSystem4a.USA);
Assert.assertEquals(textWidth, textArea.crIpd());
/* The x value of the text area content rectangle should be at the x
@@ -357,7 +357,7 @@
* The extra word spacing is .3em = .3 * 12000 = 3600. */
final String testString = "Centered with Word Spacing";
final int textWidth = fontUse.width(testString, 0, testString.length(), 12000, 0, 3600,
- this.fontOptionsWithKerning, Orthography4a.USA);
+ this.fontOptionsWithKerning, WritingSystem4a.USA);
Assert.assertEquals(textWidth, textArea.crIpd());
/* The x value of the text area content rectangle should be at the x
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.axsl.area.AreaTreeException;
import org.axsl.common.i18n.WritingSystem;
@@ -225,7 +225,7 @@
*/
public WritingSystem orthography() {
/* TODO: Get this from the FOTree. */
- return Orthography4a.USA;
+ return WritingSystem4a.USA;
}
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -28,7 +28,7 @@
package org.foray.area;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.axsl.area.AreaTreeException;
import org.axsl.common.i18n.WritingSystem;
@@ -327,7 +327,7 @@
*/
public WritingSystem orthography() {
/* TODO: Get this from the FOTree. */
- return Orthography4a.USA;
+ return WritingSystem4a.USA;
}
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -29,7 +29,7 @@
package org.foray.area;
import org.foray.common.CharSequenceSubset;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.primitive.XmlCharacterUtils;
import org.axsl.area.AreaTreeException;
@@ -680,7 +680,7 @@
@Override
public WritingSystem orthography() {
/* TODO: Get this from the FOTree. */
- return Orthography4a.USA;
+ return WritingSystem4a.USA;
}
@Override
Deleted: trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -1,285 +0,0 @@
-/*
- * Copyright 2017 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.common.i18n;
-
-import org.foray.common.primitive.ObjectUtils;
-
-import org.axsl.common.i18n.Country;
-import org.axsl.common.i18n.Language;
-import org.axsl.common.i18n.Script;
-import org.axsl.common.i18n.WritingSystem;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * FOray implementation of {@link WritingSystem}.
- * Instances of this class are immutable.
- */
-public final class Orthography4a implements WritingSystem {
-
- /** The orthograpy for the United States. */
- public static final Orthography4a USA;
-
- /** The orthograpy for Finland. */
- public static final Orthography4a FINLAND;
-
- /** The orthograpy for Hungary. */
- public static final Orthography4a HUNGARY;
-
- /** The orthograpy for Italy. */
- public static final Orthography4a ITALY;
-
- /** The orthograpy for Poland. */
- public static final Orthography4a POLAND;
-
- /** The orthograpy for Portugal. */
- public static final Orthography4a PORTUGAL;
-
- /** The orthograpy for Russia. */
- public static final Orthography4a RUSSIA;
-
- /** The orthograpy for Spain. */
- public static final Orthography4a SPAIN;
-
- /** Map of the registered orthographies, used to avoid unnecessary duplication. */
- private static final Map<Script4a, Map<Language4a, Map<Country4a, Orthography4a>>> REGISTRATION_MAP =
- new HashMap<Script4a, Map<Language4a, Map<Country4a, Orthography4a>>>();
-
- static {
- USA = Orthography4a.find(Language4a.ENGLISH, Country4a.USA, Script4a.LATIN);
- FINLAND = Orthography4a.find(Language4a.FINNISH, Country4a.FINLAND, Script4a.LATIN);
- HUNGARY = Orthography4a.find(Language4a.HUNGARIAN, Country4a.HUNGARY, Script4a.LATIN);
- ITALY = Orthography4a.find(Language4a.ITALIAN, Country4a.ITALY, Script4a.LATIN);
- POLAND = Orthography4a.find(Language4a.POLISH, Country4a.POLAND, Script4a.LATIN);
- PORTUGAL = Orthography4a.find(Language4a.PORTUGUESE, Country4a.PORTUGAL, Script4a.LATIN);
- RUSSIA = Orthography4a.find(Language4a.RUSSIAN, Country4a.RUSSIA, Script4a.CYRILLIC);
- SPAIN = Orthography4a.find(Language4a.SPANISH, Country4a.SPAIN, Script4a.LATIN);
- }
-
- /** The language. */
- private Language4a language;
-
- /** The country. */
- private Country4a country;
-
- /** The script. */
- private Script4a script;
-
- /** The cached value of the hash code for this instance. */
- private int hash;
-
- /**
- * Private constructor. Use {@link #find(Language, Country, Script)} to obtain an instance of this class.
- * @param language The language.
- * @param country The country.
- * @param script The script.
- */
- private Orthography4a(final Language4a language, final Country4a country, final Script4a script) {
- this.language = language;
- this.country = country;
- this.script = script;
-
- /* Cache the hash code for performance. */
- this.hash = ObjectUtils.HASH_CODE_SEED;
- this.hash = ObjectUtils.recomputeHash(this.hash, this.language.hashCode());
- this.hash = ObjectUtils.recomputeHash(this.hash, this.country.hashCode());
- this.hash = ObjectUtils.recomputeHash(this.hash, this.script.hashCode());
- }
-
- /**
- * Finds or creates an instance of this class for a given set of parameters.
- * @param language The language.
- * @param country The country.
- * @param script The script.
- * @return The orthography for the given parameters.
- */
- public static Orthography4a find(final Language4a language, final Country4a country, final Script4a script) {
- Script4a scriptToUse = script;
- if (scriptToUse == null) {
- scriptToUse = Script4a.UNDETERMINED;
- }
- Language4a languageToUse = language;
- if (languageToUse == null) {
- languageToUse = Language4a.UNDETERMINED;
- }
- Country4a countryToUse = country;
- if (countryToUse == null) {
- countryToUse = Country4a.UNDETERMINED;
- }
-
- Map<Language4a, Map<Country4a, Orthography4a>> scriptMap = REGISTRATION_MAP.get(scriptToUse);
- if (scriptMap == null) {
- scriptMap = new HashMap<Language4a, Map<Country4a, Orthography4a>>();
- REGISTRATION_MAP.put(scriptToUse, scriptMap);
- }
- Map<Country4a, Orthography4a> languageMap = scriptMap.get(languageToUse);
- if (languageMap == null) {
- languageMap = new HashMap<Country4a, Orthography4a>();
- scriptMap.put(languageToUse, languageMap);
- }
- Orthography4a orthography = languageMap.get(countryToUse);
- if (orthography == null) {
- orthography = new Orthography4a(languageToUse, countryToUse, scriptToUse);
- languageMap.put(countryToUse, orthography);
- }
- return orthography;
- }
-
- /**
- * Finds or creates an instance of this class for a given set of string parameters.
- * @param languageString The language.
- * @param countryString The country.
- * @param scriptString The script.
- * @return The orthography for the given parameters.
- */
- public static Orthography4a find(final String languageString, final String countryString,
- final String scriptString) {
- final Language4a language = Language4a.findFromAlpha(languageString);
- final Country4a country = Country4a.findFromAlpha(countryString);
- final Script4a script = Script4a.findFromAlpha(scriptString);
- return find(language, country, script);
- }
-
- @Override
- public Language4a getLanguage() {
- return this.language;
- }
-
- @Override
- public Country4a getCountry() {
- return this.country;
- }
-
- @Override
- public Script4a getScript() {
- return this.script;
- }
-
- /**
- * Returns the number of registered instances, useful mostly for testing.
- * @return The number of registered instances.
- */
- public static int getCount() {
- int count = 0;
- for (Map<Language4a, Map<Country4a, Orthography4a>> scriptMap : REGISTRATION_MAP.values()) {
- for (Map<Country4a, Orthography4a> languageMap : scriptMap.values()) {
- count += languageMap.size();
- }
- }
- return count;
- }
-
- /**
- * Indicates whether the language in the orthography contains a valid 3-character alpha code.
- * @param orthography The orthography to be tested.
- * Note that this does not need to be an instance of this class, but can be any instance of {@link WritingSystem}.
- * @return True if and only if the orthography contains a language with a valid 3-character alpha code.
- */
- public static boolean is3CharacterLanguageCodeValid(final WritingSystem orthography) {
- if (orthography == null
- || (orthography.getLanguage().getAlpha3Code() != null
- && orthography.getLanguage().getAlpha3Code().equals(Language4a.UNDETERMINED.getAlpha3Code()))) {
- return false;
- }
- return true;
- }
-
- /**
- * Indicates whether the country in the orthography contains a valid 3-character alpha code.
- * @param orthography The orthography to be tested.
- * Note that this does not need to be an instance of this class, but can be any instance of {@link WritingSystem}.
- * @return True if and only if the orthography contains a country with a valid 3-character alpha code.
- */
- public static boolean is3CharacterCountryCodeValid(final WritingSystem orthography) {
- if (orthography == null
- || (orthography.getCountry().getAlpha3Code() != null
- && orthography.getCountry().getAlpha3Code().equals(Country4a.UNDETERMINED.getAlpha3Code()))) {
- return false;
- }
- return true;
- }
-
- /**
- * Returns the concatenation of the 3-character language code, the underscore character ("_"), and the 3-character
- * country code for a given orthography.
- * For example, for U.S. English, the returned code should be "eng_USA".
- *
- * @param orthography The orthography containing the language and country information.
- * Note that this does not need to be an instance of this class, but can be any instance of {@link WritingSystem}.
- * @return The concatenation of the language and country code for {@code orthography}.
- */
- public static String get3CharacterLanguageCountryCode(final WritingSystem orthography) {
- if (! Orthography4a.is3CharacterLanguageCodeValid(orthography)) {
- return null;
- }
- if (! Orthography4a.is3CharacterCountryCodeValid(orthography)) {
- return null;
- }
- final StringBuilder builder = new StringBuilder();
- builder.append(orthography.getLanguage().getAlpha3Code());
- builder.append("_");
- builder.append(orthography.getCountry().getAlpha3Code());
- return builder.toString();
- }
-
- @Override
- public boolean equals(final Object other) {
- if (other == this) {
- return true;
- }
- if (! (other instanceof WritingSystem)) {
- return false;
- }
- final WritingSystem otherOrthography = (WritingSystem) other;
- if (this.language.equals(otherOrthography.getLanguage())
- && this.country.equals(otherOrthography.getCountry())
- && this.script.equals(otherOrthography.getScript())) {
- return true;
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return this.hash;
- }
-
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder();
- builder.append(this.language.toString());
- builder.append("_");
- builder.append(this.country.toString());
- builder.append("_");
- builder.append(this.script.toString());
- return builder.toString();
- }
-
-}
Copied: trunk/foray/foray-common/src/main/java/org/foray/common/i18n/WritingSystem4a.java (from rev 12040, trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java)
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/i18n/WritingSystem4a.java (rev 0)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/i18n/WritingSystem4a.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -0,0 +1,285 @@
+/*
+ * Copyright 2017 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.common.i18n;
+
+import org.foray.common.primitive.ObjectUtils;
+
+import org.axsl.common.i18n.Country;
+import org.axsl.common.i18n.Language;
+import org.axsl.common.i18n.Script;
+import org.axsl.common.i18n.WritingSystem;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * FOray implementation of {@link WritingSystem}.
+ * Instances of this class are immutable.
+ */
+public final class WritingSystem4a implements WritingSystem {
+
+ /** The orthograpy for the United States. */
+ public static final WritingSystem4a USA;
+
+ /** The orthograpy for Finland. */
+ public static final WritingSystem4a FINLAND;
+
+ /** The orthograpy for Hungary. */
+ public static final WritingSystem4a HUNGARY;
+
+ /** The orthograpy for Italy. */
+ public static final WritingSystem4a ITALY;
+
+ /** The orthograpy for Poland. */
+ public static final WritingSystem4a POLAND;
+
+ /** The orthograpy for Portugal. */
+ public static final WritingSystem4a PORTUGAL;
+
+ /** The orthograpy for Russia. */
+ public static final WritingSystem4a RUSSIA;
+
+ /** The orthograpy for Spain. */
+ public static final WritingSystem4a SPAIN;
+
+ /** Map of the registered orthographies, used to avoid unnecessary duplication. */
+ private static final Map<Script4a, Map<Language4a, Map<Country4a, WritingSystem4a>>> REGISTRATION_MAP =
+ new HashMap<Script4a, Map<Language4a, Map<Country4a, WritingSystem4a>>>();
+
+ static {
+ USA = WritingSystem4a.find(Language4a.ENGLISH, Country4a.USA, Script4a.LATIN);
+ FINLAND = WritingSystem4a.find(Language4a.FINNISH, Country4a.FINLAND, Script4a.LATIN);
+ HUNGARY = WritingSystem4a.find(Language4a.HUNGARIAN, Country4a.HUNGARY, Script4a.LATIN);
+ ITALY = WritingSystem4a.find(Language4a.ITALIAN, Country4a.ITALY, Script4a.LATIN);
+ POLAND = WritingSystem4a.find(Language4a.POLISH, Country4a.POLAND, Script4a.LATIN);
+ PORTUGAL = WritingSystem4a.find(Language4a.PORTUGUESE, Country4a.PORTUGAL, Script4a.LATIN);
+ RUSSIA = WritingSystem4a.find(Language4a.RUSSIAN, Country4a.RUSSIA, Script4a.CYRILLIC);
+ SPAIN = WritingSystem4a.find(Language4a.SPANISH, Country4a.SPAIN, Script4a.LATIN);
+ }
+
+ /** The language. */
+ private Language4a language;
+
+ /** The country. */
+ private Country4a country;
+
+ /** The script. */
+ private Script4a script;
+
+ /** The cached value of the hash code for this instance. */
+ private int hash;
+
+ /**
+ * Private constructor. Use {@link #find(Language, Country, Script)} to obtain an instance of this class.
+ * @param language The language.
+ * @param country The country.
+ * @param script The script.
+ */
+ private WritingSystem4a(final Language4a language, final Country4a country, final Script4a script) {
+ this.language = language;
+ this.country = country;
+ this.script = script;
+
+ /* Cache the hash code for performance. */
+ this.hash = ObjectUtils.HASH_CODE_SEED;
+ this.hash = ObjectUtils.recomputeHash(this.hash, this.language.hashCode());
+ this.hash = ObjectUtils.recomputeHash(this.hash, this.country.hashCode());
+ this.hash = ObjectUtils.recomputeHash(this.hash, this.script.hashCode());
+ }
+
+ /**
+ * Finds or creates an instance of this class for a given set of parameters.
+ * @param language The language.
+ * @param country The country.
+ * @param script The script.
+ * @return The orthography for the given parameters.
+ */
+ public static WritingSystem4a find(final Language4a language, final Country4a country, final Script4a script) {
+ Script4a scriptToUse = script;
+ if (scriptToUse == null) {
+ scriptToUse = Script4a.UNDETERMINED;
+ }
+ Language4a languageToUse = language;
+ if (languageToUse == null) {
+ languageToUse = Language4a.UNDETERMINED;
+ }
+ Country4a countryToUse = country;
+ if (countryToUse == null) {
+ countryToUse = Country4a.UNDETERMINED;
+ }
+
+ Map<Language4a, Map<Country4a, WritingSystem4a>> scriptMap = REGISTRATION_MAP.get(scriptToUse);
+ if (scriptMap == null) {
+ scriptMap = new HashMap<Language4a, Map<Country4a, WritingSystem4a>>();
+ REGISTRATION_MAP.put(scriptToUse, scriptMap);
+ }
+ Map<Country4a, WritingSystem4a> languageMap = scriptMap.get(languageToUse);
+ if (languageMap == null) {
+ languageMap = new HashMap<Country4a, WritingSystem4a>();
+ scriptMap.put(languageToUse, languageMap);
+ }
+ WritingSystem4a orthography = languageMap.get(countryToUse);
+ if (orthography == null) {
+ orthography = new WritingSystem4a(languageToUse, countryToUse, scriptToUse);
+ languageMap.put(countryToUse, orthography);
+ }
+ return orthography;
+ }
+
+ /**
+ * Finds or creates an instance of this class for a given set of string parameters.
+ * @param languageString The language.
+ * @param countryString The country.
+ * @param scriptString The script.
+ * @return The orthography for the given parameters.
+ */
+ public static WritingSystem4a find(final String languageString, final String countryString,
+ final String scriptString) {
+ final Language4a language = Language4a.findFromAlpha(languageString);
+ final Country4a country = Country4a.findFromAlpha(countryString);
+ final Script4a script = Script4a.findFromAlpha(scriptString);
+ return find(language, country, script);
+ }
+
+ @Override
+ public Language4a getLanguage() {
+ return this.language;
+ }
+
+ @Override
+ public Country4a getCountry() {
+ return this.country;
+ }
+
+ @Override
+ public Script4a getScript() {
+ return this.script;
+ }
+
+ /**
+ * Returns the number of registered instances, useful mostly for testing.
+ * @return The number of registered instances.
+ */
+ public static int getCount() {
+ int count = 0;
+ for (Map<Language4a, Map<Country4a, WritingSystem4a>> scriptMap : REGISTRATION_MAP.values()) {
+ for (Map<Country4a, WritingSystem4a> languageMap : scriptMap.values()) {
+ count += languageMap.size();
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Indicates whether the language in the orthography contains a valid 3-character alpha code.
+ * @param orthography The orthography to be tested.
+ * Note that this does not need to be an instance of this class, but can be any instance of {@link WritingSystem}.
+ * @return True if and only if the orthography contains a language with a valid 3-character alpha code.
+ */
+ public static boolean is3CharacterLanguageCodeValid(final WritingSystem orthography) {
+ if (orthography == null
+ || (orthography.getLanguage().getAlpha3Code() != null
+ && orthography.getLanguage().getAlpha3Code().equals(Language4a.UNDETERMINED.getAlpha3Code()))) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Indicates whether the country in the orthography contains a valid 3-character alpha code.
+ * @param orthography The orthography to be tested.
+ * Note that this does not need to be an instance of this class, but can be any instance of {@link WritingSystem}.
+ * @return True if and only if the orthography contains a country with a valid 3-character alpha code.
+ */
+ public static boolean is3CharacterCountryCodeValid(final WritingSystem orthography) {
+ if (orthography == null
+ || (orthography.getCountry().getAlpha3Code() != null
+ && orthography.getCountry().getAlpha3Code().equals(Country4a.UNDETERMINED.getAlpha3Code()))) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the concatenation of the 3-character language code, the underscore character ("_"), and the 3-character
+ * country code for a given orthography.
+ * For example, for U.S. English, the returned code should be "eng_USA".
+ *
+ * @param orthography The orthography containing the language and country information.
+ * Note that this does not need to be an instance of this class, but can be any instance of {@link WritingSystem}.
+ * @return The concatenation of the language and country code for {@code orthography}.
+ */
+ public static String get3CharacterLanguageCountryCode(final WritingSystem orthography) {
+ if (! WritingSystem4a.is3CharacterLanguageCodeValid(orthography)) {
+ return null;
+ }
+ if (! WritingSystem4a.is3CharacterCountryCodeValid(orthography)) {
+ return null;
+ }
+ final StringBuilder builder = new StringBuilder();
+ builder.append(orthography.getLanguage().getAlpha3Code());
+ builder.append("_");
+ builder.append(orthography.getCountry().getAlpha3Code());
+ return builder.toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (other == this) {
+ return true;
+ }
+ if (! (other instanceof WritingSystem)) {
+ return false;
+ }
+ final WritingSystem otherOrthography = (WritingSystem) other;
+ if (this.language.equals(otherOrthography.getLanguage())
+ && this.country.equals(otherOrthography.getCountry())
+ && this.script.equals(otherOrthography.getScript())) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.hash;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder builder = new StringBuilder();
+ builder.append(this.language.toString());
+ builder.append("_");
+ builder.append(this.country.toString());
+ builder.append("_");
+ builder.append(this.script.toString());
+ return builder.toString();
+ }
+
+}
Modified: trunk/foray/foray-common/src/test/java/org/foray/common/i18n/Orthography4aTests.java
===================================================================
--- trunk/foray/foray-common/src/test/java/org/foray/common/i18n/Orthography4aTests.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-common/src/test/java/org/foray/common/i18n/Orthography4aTests.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -32,7 +32,7 @@
import org.junit.Test;
/**
- * Tests of {@link Orthography4a}.
+ * Tests of {@link WritingSystem4a}.
*/
public class Orthography4aTests {
@@ -42,21 +42,21 @@
@Test
public void registrationTest() {
final int expectedCount = 8;
- Assert.assertEquals(expectedCount, Orthography4a.getCount());
+ Assert.assertEquals(expectedCount, WritingSystem4a.getCount());
/* Find some already-registered items multiple times. Purpose here is to make sure we aren't creating
* the same item multiple times. */
- Orthography4a pre = Orthography4a.USA;
- Orthography4a found = Orthography4a.find(pre.getLanguage(), pre.getCountry(), pre.getScript());
+ WritingSystem4a pre = WritingSystem4a.USA;
+ WritingSystem4a found = WritingSystem4a.find(pre.getLanguage(), pre.getCountry(), pre.getScript());
/* Check that both reference the same object. If not, the registration is not working correctly. */
Assert.assertTrue("Must reference the same object (USA)", pre == found);
/* The count of items in the class should not have changed from our assertion above. */
- Assert.assertEquals(expectedCount, Orthography4a.getCount());
+ Assert.assertEquals(expectedCount, WritingSystem4a.getCount());
- pre = Orthography4a.FINLAND;
- found = Orthography4a.find(pre.getLanguage(), pre.getCountry(), pre.getScript());
+ pre = WritingSystem4a.FINLAND;
+ found = WritingSystem4a.find(pre.getLanguage(), pre.getCountry(), pre.getScript());
Assert.assertTrue("Must reference the same object (FINLAND)", pre == found);
- Assert.assertEquals(expectedCount, Orthography4a.getCount());
+ Assert.assertEquals(expectedCount, WritingSystem4a.getCount());
}
}
Modified: trunk/foray/foray-font/src/test/java/org/foray/font/Font4aTests.java
===================================================================
--- trunk/foray/foray-font/src/test/java/org/foray/font/Font4aTests.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-font/src/test/java/org/foray/font/Font4aTests.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -29,7 +29,7 @@
package org.foray.font;
import org.foray.common.FontOptions4a;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.font.config.RegisteredFont;
import org.axsl.font.FontException;
@@ -111,7 +111,7 @@
* If these are scaled to 12 points, the millipoints used are 7565 * 12
* = 90,780. */
Assert.assertEquals(90780, fontUse.width(
- testString, 0, testString.length(), 12000, 0, 0, fontOptionsWithKerning, Orthography4a.USA));
+ testString, 0, testString.length(), 12000, 0, 0, fontOptionsWithKerning, WritingSystem4a.USA));
/* Test without kerning.
* Total kerning = -105.
@@ -118,7 +118,7 @@
* Adjusted text space units = 7,565 + 105 = 7,670.
* When scaled to 12 points, the millipoints used are 7670 * 12 = 92,040. */
Assert.assertEquals(92040, fontUse.width(
- testString, 0, testString.length(), 12000, 0, 0, fontOptionsWithoutKerning, Orthography4a.USA));
+ testString, 0, testString.length(), 12000, 0, 0, fontOptionsWithoutKerning, WritingSystem4a.USA));
/* Test with word spacing.
* Word spacing = 300.
@@ -126,7 +126,7 @@
* Total word spacing = 600.
* Total space (kerning on) = 90,780 + 600 = 91,380. */
Assert.assertEquals(91380, fontUse.width(
- testString, 0, testString.length(), 12000, 0, 300, fontOptionsWithKerning, Orthography4a.USA));
+ testString, 0, testString.length(), 12000, 0, 300, fontOptionsWithKerning, WritingSystem4a.USA));
/* Test with letter spacing.
* Letter spacing = 5.
@@ -134,12 +134,12 @@
* Total word spacing = 80.
* Total space (kerning on) = 90,780 + 80 = 90,860. */
Assert.assertEquals(90860, fontUse.width(
- testString, 0, testString.length(), 12000, 5, 0, fontOptionsWithKerning, Orthography4a.USA));
+ testString, 0, testString.length(), 12000, 5, 0, fontOptionsWithKerning, WritingSystem4a.USA));
/* Test with both word spacing and letter spacing, using same parameters as above.
* Total space (kerning on) = 90,780 + 600 + 80 = 91,460. */
Assert.assertEquals(91460, fontUse.width(
- testString, 0, testString.length(), 12000, 5, 300, fontOptionsWithKerning, Orthography4a.USA));
+ testString, 0, testString.length(), 12000, 5, 300, fontOptionsWithKerning, WritingSystem4a.USA));
}
}
Modified: trunk/foray/foray-font/src/test/java/org/foray/font/format/ttf/OtfLookupGsubTests.java
===================================================================
--- trunk/foray/foray-font/src/test/java/org/foray/font/format/ttf/OtfLookupGsubTests.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-font/src/test/java/org/foray/font/format/ttf/OtfLookupGsubTests.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -28,7 +28,7 @@
package org.foray.font.format.ttf;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.io.SimpleDataSource;
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.common.sequence.IntArrayBuilder;
@@ -85,7 +85,7 @@
OtfLookupGsubTests.ttfFont = ttfSingle.getTTFFont(null);
Assert.assertNotNull(ttfFont);
- OtfLookupGsubTests.orthography = Orthography4a.USA;
+ OtfLookupGsubTests.orthography = WritingSystem4a.USA;
}
/**
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -34,8 +34,8 @@
import org.foray.common.data.OrderedTreeNode;
import org.foray.common.i18n.Country4a;
import org.foray.common.i18n.Language4a;
-import org.foray.common.i18n.Orthography4a;
import org.foray.common.i18n.Script4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.primitive.UnicodeCharUtils;
import org.foray.common.primitive.XmlCharacterUtils;
import org.foray.fotree.fo.FoProperty;
@@ -3924,7 +3924,7 @@
final Language4a language = this.traitLanguage(null);
final Country4a country = this.traitCountry(null);
final Script4a script = this.traitScript(null);
- return Orthography4a.find(language, country, script);
+ return WritingSystem4a.find(language, country, script);
}
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -30,7 +30,7 @@
import org.foray.common.i18n.Country4a;
import org.foray.common.i18n.Language4a;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.primitive.XmlCharacterUtils;
import org.foray.fotree.FoObj;
import org.foray.fotree.Namespace;
@@ -218,7 +218,7 @@
public WritingSystem inlineOrthography() {
final Language4a language = inlineLanguage();
final Country4a country = inlineCountry();
- return Orthography4a.find(language, country, null);
+ return WritingSystem4a.find(language, country, null);
}
@Override
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Character.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -30,8 +30,8 @@
import org.foray.common.i18n.Country4a;
import org.foray.common.i18n.Language4a;
-import org.foray.common.i18n.Orthography4a;
import org.foray.common.i18n.Script4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.fotree.FoObj;
import org.foray.fotree.Namespace;
import org.foray.fotree.PropertyList;
@@ -281,11 +281,11 @@
}
@Override
- public Orthography4a inlineOrthography() {
+ public WritingSystem4a inlineOrthography() {
final Language4a language = inlineLanguage();
final Country4a country = inlineCountry();
final Script4a script = inlineScript();
- return Orthography4a.find(language, country, script);
+ return WritingSystem4a.find(language, country, script);
}
@Override
Modified: trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java
===================================================================
--- trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-graphic/src/main/java/org/foray/graphic/batik/PdfTextPainter.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -34,7 +34,7 @@
package org.foray.graphic.batik;
import org.foray.common.WellKnownConstants;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.axsl.font.Font;
import org.axsl.font.FontConsumer;
@@ -280,7 +280,7 @@
/* TODO: Pass the font options and orthography below instead of hard-coding them. */
final int width = fontToUse.width(txt, 0, txt.length(),
awtFontSize * WellKnownConstants.MILLIPOINTS_PER_POINT, letterSpacing, 0, FontOptions.DEFAULT,
- Orthography4a.USA);
+ WritingSystem4a.USA);
final float advance = WellKnownConstants.millipointsToPoints(width);
float tx = 0;
if (anchor != null) {
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/LineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/LineBreaker.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/LineBreaker.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -28,7 +28,7 @@
package org.foray.text.line;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.text.TextServer4a;
import org.axsl.font.FontConsumer;
@@ -334,7 +334,7 @@
fontUse.registerCharsUsed(word);
/* TODO: Pass the orthography below instead of hard-coding it. */
return fontUse.width(word, offset, length, lineText.inlineFontSize(), lineText.inlineLetterSpacingOptimum(), 0,
- lineText.inlineFontOptions(), Orthography4a.USA);
+ lineText.inlineFontOptions(), WritingSystem4a.USA);
}
/**
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -29,7 +29,7 @@
package org.foray.linebreak;
import org.foray.common.data.OrderedTreePath4a;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.para.ParaBranch4a;
import org.foray.common.para.ParaConfig4a;
import org.foray.orthography.HyphenationConsumer4a;
@@ -90,7 +90,7 @@
final Font font = LbTestUtilities.createMonotypeFont();
final FontUse fontUse = Mockito.mock(FontUse.class);
Mockito.when(fontUse.getFont()).thenReturn(font);
- this.paraConfig = new ParaConfig4a(fontUse, 10, Orthography4a.USA, 0, 0);
+ this.paraConfig = new ParaConfig4a(fontUse, 10, WritingSystem4a.USA, 0, 0);
}
/**
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -31,8 +31,8 @@
import org.foray.common.AxslDtdUtil;
import org.foray.common.i18n.Country4a;
import org.foray.common.i18n.Language4a;
-import org.foray.common.i18n.Orthography4a;
import org.foray.common.i18n.Script4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.primitive.StringUtils;
import org.foray.common.resource.ResourceLocation;
import org.foray.common.resource.ResourceLocationClasspath;
@@ -492,7 +492,7 @@
this.logger.error("Unable to find script for: {}", scriptString);
this.logger.error(getContextMessage());
}
- final Orthography4a orthography = Orthography4a.find(language, country, script);
+ final WritingSystem4a orthography = WritingSystem4a.find(language, country, script);
if (orthography == null) {
this.logger.error("Unable to find script for: {}_{}_{}", languageString, countryString, scriptString);
this.logger.error(getContextMessage());
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -29,7 +29,7 @@
package org.foray.orthography.util;
import org.foray.common.AxslDtdUtil;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.primitive.StringUtils;
import org.foray.orthography.AmbiguousWord;
import org.foray.orthography.PosUtils;
@@ -76,7 +76,7 @@
private class DictionaryElement {
/** The orthography for this dictionary. */
- private Orthography4a orthography;
+ private WritingSystem4a orthography;
/** The soft hyphen char for this dictionary. */
private char softHyphenChar;
@@ -369,7 +369,7 @@
final String language = attributes.getValue(StringUtils.EMPTY_STRING, "language");
final String country = attributes.getValue(StringUtils.EMPTY_STRING, "country");
final String script = attributes.getValue(StringUtils.EMPTY_STRING, "script");
- this.currentDictionary.orthography = Orthography4a.find(language, country, script);
+ this.currentDictionary.orthography = WritingSystem4a.find(language, country, script);
logger.info("Begin dictionary word list parsing: " + this.currentDictionary.orthography.toString());
final String soft = attributes.getValue(StringUtils.EMPTY_STRING, "soft-hyphen-char");
if (soft.length() != 1) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -30,8 +30,8 @@
import org.foray.common.i18n.Country4a;
import org.foray.common.i18n.Language4a;
-import org.foray.common.i18n.Orthography4a;
import org.foray.common.i18n.Script4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.primitive.ObjectUtils;
import org.foray.common.primitive.StringUtils;
import org.foray.common.primitive.XmlUtils;
@@ -360,7 +360,7 @@
* the text content. */
final Script4a script = Script4a.LATIN;
- element.orthography = Orthography4a.find(language, country, script);
+ element.orthography = WritingSystem4a.find(language, country, script);
if (element.orthography == null) {
final String message = String.format(
"Orthography not found. Language: %1$s, Country: %2$s, Script: %3$s ", languageString,
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -28,7 +28,7 @@
package org.foray.orthography.util;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.orthography.HyphenationServer4a;
import org.foray.orthography.HyphenationServerConfig;
import org.foray.orthography.OrthographyConfig4a;
@@ -116,7 +116,7 @@
serverConfig.setOrthographyConfigurationLocation(orthographyConfigPath);
this.server = new HyphenationServer4a(serverConfig);
/* Remove hard-coding. */
- final Orthography4a orthography = Orthography4a.find("eng", "USA", "Latn");
+ final WritingSystem4a orthography = WritingSystem4a.find("eng", "USA", "Latn");
this.currentOrthographyConfig = this.server.getOrthographyConfig(orthography);
if (adhocDictionaryPaths != null) {
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -28,7 +28,7 @@
package org.foray.orthography;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.para.ParaBranch4a;
import org.foray.common.para.ParaConfig4a;
@@ -52,7 +52,7 @@
private static HyphenationServer4a server;
/** The paragraph configuration that should be used in these tests. */
- private static ParaConfig paraConfig = new ParaConfig4a(null, 0, Orthography4a.USA, 0, 0);
+ private static ParaConfig paraConfig = new ParaConfig4a(null, 0, WritingSystem4a.USA, 0, 0);
/** The object under test. */
private HyphenationConsumer4a consumer;
@@ -142,7 +142,7 @@
if (! testWord.toLowerCase().equals("hyphenation")) {
throw new OrthographyException("Test of \"hyphenation\" has invalid input.");
}
- final OrthographyConfig4a orthography = server.getOrthographyConfig(Orthography4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthographyConfig(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(3, hyphenation.getQtyHyphenationPoints());
@@ -183,7 +183,7 @@
if (! testWord.toLowerCase().equals("obligatory")) {
throw new OrthographyException("Test of \"obligatory\" has invalid input.");
}
- final OrthographyConfig4a orthography = server.getOrthographyConfig(Orthography4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthographyConfig(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(4, hyphenation.getQtyHyphenationPoints());
@@ -202,7 +202,7 @@
@Test
public void testEnInvalidCharacter() throws OrthographyException {
final String testWord = "table8";
- final OrthographyConfig4a orthography = server.getOrthographyConfig(Orthography4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthographyConfig(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNull(hyphenation);
}
@@ -215,7 +215,7 @@
@Test
public void testTimes() throws OrthographyException {
final String testWord = "times";
- final OrthographyConfig4a orthography = server.getOrthographyConfig(Orthography4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthographyConfig(WritingSystem4a.USA);
final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals("times", hyphenation.toString());
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -30,7 +30,7 @@
import org.foray.common.Environment;
import org.foray.common.i18n.Language4a;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.axsl.orthography.OrthographyException;
@@ -118,49 +118,49 @@
final PatternTree.Source expectedSource = PatternTree.Source.RESOURCES;
/* English, U.S. */
- Orthography4a orthography = Orthography4a.USA;
+ WritingSystem4a orthography = WritingSystem4a.USA;
PatternTree tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Finnish. */
- orthography = Orthography4a.FINLAND;
+ orthography = WritingSystem4a.FINLAND;
tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Hungarian. */
- orthography = Orthography4a.HUNGARY;
+ orthography = WritingSystem4a.HUNGARY;
tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Italian. */
- orthography = Orthography4a.ITALY;
+ orthography = WritingSystem4a.ITALY;
tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Polish. */
- orthography = Orthography4a.POLAND;
+ orthography = WritingSystem4a.POLAND;
tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Portuguese. */
- orthography = Orthography4a.PORTUGAL;
+ orthography = WritingSystem4a.PORTUGAL;
tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Russian. */
- orthography = Orthography4a.RUSSIA;
+ orthography = WritingSystem4a.RUSSIA;
tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
/* Spanish. */
- orthography = Orthography4a.SPAIN;
+ orthography = WritingSystem4a.SPAIN;
tree = this.out.getOrthographyConfig(orthography).getHyphenationPatterns();
Assert.assertNotNull(tree);
Assert.assertEquals(expectedSource, tree.getSource());
@@ -167,7 +167,7 @@
/* Try one that we know we don't have, Klingon. */
final Language4a language = Language4a.findFromAlpha("tlh");
- orthography = Orthography4a.find(language, null, null);
+ orthography = WritingSystem4a.find(language, null, null);
/* We have not configured an orthography. */
Assert.assertNull(this.out.getOrthographyConfig(orthography));
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -28,7 +28,7 @@
package org.foray.orthography;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.axsl.orthography.OrthographyException;
@@ -54,7 +54,7 @@
@BeforeClass
public static void beforeClass() throws IOException, OrthographyException {
final HyphenationServer4a server = HyphenationServer4aTests.makeHyphenationServer();
- final Orthography4a orthography = Orthography4a.USA;
+ final WritingSystem4a orthography = WritingSystem4a.USA;
PatternTreeTests.patternTree = server.getOrthographyConfig(orthography).getHyphenationPatterns();
Assert.assertNotNull(PatternTreeTests.patternTree);
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/util/PdfGraphics2D.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -36,7 +36,7 @@
import org.foray.common.CharacterOutputStream;
import org.foray.common.Gradient4a;
import org.foray.common.WellKnownConstants;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.ps.PsColor;
import org.foray.common.ps.PsUtil;
import org.foray.pdf.PdfConstants;
@@ -675,7 +675,7 @@
this.write(matrixString + "cm");
this.write("1 0 0 -1 0 0 Tm ");
- final CharSequence outputString = font.textToPdf(s, FontOptions.DEFAULT, Orthography4a.USA);
+ final CharSequence outputString = font.textToPdf(s, FontOptions.DEFAULT, WritingSystem4a.USA);
this.write(outputString);
this.write("ET");
Modified: trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfDocumentTests.java
===================================================================
--- trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfDocumentTests.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-pdf/src/test/java/org/foray/pdf/object/PdfDocumentTests.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -28,7 +28,7 @@
package org.foray.pdf.object;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.common.sequence.ByteArray;
import org.foray.common.sequence.ByteArrayBuilder;
import org.foray.font.ConsumerFont4a;
@@ -102,7 +102,7 @@
contentStream.setCursor(36, heightPoints - 36);
contentStream.openTextObject();
- contentStream.drawText("Hello World!", FontOptions.DEFAULT, Orthography4a.USA);
+ contentStream.drawText("Hello World!", FontOptions.DEFAULT, WritingSystem4a.USA);
contentStream.closeTextObject();
contentStream.close();
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java 2021-11-12 00:38:42 UTC (rev 12040)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java 2021-11-12 00:48:39 UTC (rev 12041)
@@ -34,7 +34,7 @@
package org.foray.render.pdf;
import org.foray.common.WellKnownConstants;
-import org.foray.common.i18n.Orthography4a;
+import org.foray.common.i18n.WritingSystem4a;
import org.foray.render.PrintRenderer;
import org.axsl.common.FormattedIntegerType;
@@ -481,7 +481,7 @@
/* Paint the text. */
final CharSequence textToWrite = text.subSequence(startIndex, startIndex + size);
- getContentStream().drawText(textToWrite, fontOptions, Orthography4a.USA);
+ getContentStream().drawText(textToWrite, fontOptions, WritingSystem4a.USA);
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-12 00:38:45
|
Revision: 12040
http://sourceforge.net/p/foray/code/12040
Author: victormote
Date: 2021-11-12 00:38:42 +0000 (Fri, 12 Nov 2021)
Log Message:
-----------
Conform to aXSL change: Rename Orthography class to WritingSystem, to avoid confusion with the axsl-orthography package.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java
trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaConfig4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TtfTableGsub.java
trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java
trunk/foray/foray-font/src/test/java/org/foray/font/format/ttf/OtfLookupGsubTests.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfContentStream4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFont4a.java
trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfString.java
trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/AbstractAncestralInlineArea.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -31,7 +31,7 @@
import org.foray.common.i18n.Orthography4a;
import org.axsl.area.AreaTreeException;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.fo.fo.BasicLink;
import org.axsl.fo.fo.BidiOverride;
import org.axsl.fo.fo.CharacterSequence;
@@ -223,7 +223,7 @@
* Returns the orthography.
* @return The orthography.
*/
- public Orthography orthography() {
+ public WritingSystem orthography() {
/* TODO: Get this from the FOTree. */
return Orthography4a.USA;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/ScalingValueCitationArea.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -31,7 +31,7 @@
import org.foray.common.i18n.Orthography4a;
import org.axsl.area.AreaTreeException;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.fo.Fo;
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.fo.fo.ScalingValueCitation;
@@ -325,7 +325,7 @@
* Returns the orthography.
* @return The orthography.
*/
- public Orthography orthography() {
+ public WritingSystem orthography() {
/* TODO: Get this from the FOTree. */
return Orthography4a.USA;
}
Modified: trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-areatree/src/main/java/org/foray/area/TextArea.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -33,7 +33,7 @@
import org.foray.common.primitive.XmlCharacterUtils;
import org.axsl.area.AreaTreeException;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.fo.Fo;
import org.axsl.fo.fo.Block;
@@ -678,7 +678,7 @@
}
@Override
- public Orthography orthography() {
+ public WritingSystem orthography() {
/* TODO: Get this from the FOTree. */
return Orthography4a.USA;
}
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -32,17 +32,17 @@
import org.axsl.common.i18n.Country;
import org.axsl.common.i18n.Language;
-import org.axsl.common.i18n.Orthography;
import org.axsl.common.i18n.Script;
+import org.axsl.common.i18n.WritingSystem;
import java.util.HashMap;
import java.util.Map;
/**
- * FOray implementation of {@link Orthography}.
+ * FOray implementation of {@link WritingSystem}.
* Instances of this class are immutable.
*/
-public final class Orthography4a implements Orthography {
+public final class Orthography4a implements WritingSystem {
/** The orthograpy for the United States. */
public static final Orthography4a USA;
@@ -199,10 +199,10 @@
/**
* Indicates whether the language in the orthography contains a valid 3-character alpha code.
* @param orthography The orthography to be tested.
- * Note that this does not need to be an instance of this class, but can be any instance of {@link Orthography}.
+ * Note that this does not need to be an instance of this class, but can be any instance of {@link WritingSystem}.
* @return True if and only if the orthography contains a language with a valid 3-character alpha code.
*/
- public static boolean is3CharacterLanguageCodeValid(final Orthography orthography) {
+ public static boolean is3CharacterLanguageCodeValid(final WritingSystem orthography) {
if (orthography == null
|| (orthography.getLanguage().getAlpha3Code() != null
&& orthography.getLanguage().getAlpha3Code().equals(Language4a.UNDETERMINED.getAlpha3Code()))) {
@@ -214,10 +214,10 @@
/**
* Indicates whether the country in the orthography contains a valid 3-character alpha code.
* @param orthography The orthography to be tested.
- * Note that this does not need to be an instance of this class, but can be any instance of {@link Orthography}.
+ * Note that this does not need to be an instance of this class, but can be any instance of {@link WritingSystem}.
* @return True if and only if the orthography contains a country with a valid 3-character alpha code.
*/
- public static boolean is3CharacterCountryCodeValid(final Orthography orthography) {
+ public static boolean is3CharacterCountryCodeValid(final WritingSystem orthography) {
if (orthography == null
|| (orthography.getCountry().getAlpha3Code() != null
&& orthography.getCountry().getAlpha3Code().equals(Country4a.UNDETERMINED.getAlpha3Code()))) {
@@ -232,10 +232,10 @@
* For example, for U.S. English, the returned code should be "eng_USA".
*
* @param orthography The orthography containing the language and country information.
- * Note that this does not need to be an instance of this class, but can be any instance of {@link Orthography}.
+ * Note that this does not need to be an instance of this class, but can be any instance of {@link WritingSystem}.
* @return The concatenation of the language and country code for {@code orthography}.
*/
- public static String get3CharacterLanguageCountryCode(final Orthography orthography) {
+ public static String get3CharacterLanguageCountryCode(final WritingSystem orthography) {
if (! Orthography4a.is3CharacterLanguageCodeValid(orthography)) {
return null;
}
@@ -254,10 +254,10 @@
if (other == this) {
return true;
}
- if (! (other instanceof Orthography)) {
+ if (! (other instanceof WritingSystem)) {
return false;
}
- final Orthography otherOrthography = (Orthography) other;
+ final WritingSystem otherOrthography = (WritingSystem) other;
if (this.language.equals(otherOrthography.getLanguage())
&& this.country.equals(otherOrthography.getCountry())
&& this.script.equals(otherOrthography.getScript())) {
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaConfig4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaConfig4a.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/para/ParaConfig4a.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -28,7 +28,7 @@
package org.foray.common.para;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaGlue;
import org.axsl.common.para.ParaLeaf;
@@ -59,7 +59,7 @@
private int hyphenationCharacter = '-';
/** The orthography that should be used when applying locale-sensitive font features. */
- private Orthography orthography;
+ private WritingSystem orthography;
/**
* Constructor.
@@ -69,7 +69,7 @@
* @param stretchability The size, in millipoints, of any stretchability.
* @param shrinkability The size, in millipoints, of any shrinkability.
*/
- public ParaConfig4a(final FontUse fontUse, final int fontSize, final Orthography orthography,
+ public ParaConfig4a(final FontUse fontUse, final int fontSize, final WritingSystem orthography,
final int stretchability, final int shrinkability) {
this.fontUse = fontUse;
this.fontSize = fontSize;
@@ -95,7 +95,7 @@
}
@Override
- public Orthography getOrthography() {
+ public WritingSystem getOrthography() {
return this.orthography;
}
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/Font4a.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -31,7 +31,7 @@
import org.foray.font.config.RegisteredFont;
import org.foray.font.format.Kerning;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.common.sequence.IntSequence;
import org.axsl.font.Font;
import org.axsl.font.FontOptions;
@@ -177,7 +177,7 @@
@Override
public int width(final IntSequence word, final int offset, final int length, final int fontSize,
final int letterSpacing, final int wordSpacing, final FontOptions requestedFontOptions,
- final Orthography orthography) {
+ final WritingSystem orthography) {
final FontOptions fontOptions = requestedFontOptions == null ? FontOptions.DEFAULT : requestedFontOptions;
if (word == null) {
return 0;
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/FontUse4a.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -38,7 +38,7 @@
import org.foray.font.format.ttf.TtfTableGsub;
import org.foray.font.format.type1.Type1Font;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.common.sequence.ByteSequence;
import org.axsl.common.sequence.IntSequence;
import org.axsl.font.Font;
@@ -140,7 +140,7 @@
@Override
public IntArrayBuilder encode(final CharSequence chars, final int offset, final int length,
- final FontOptions options, final Orthography orthography) {
+ final FontOptions options, final WritingSystem orthography) {
/* Convert the chars to code points. */
/* Some substitutions add glyphs, so make the output a bit bigger than the input to avoid array copying. */
final IntArrayBuilder codePoints = CharSequenceUtils.toCodepoints(chars, offset, length, 2);
@@ -194,7 +194,8 @@
@Override
public int width(final CharSequence chars, final int offset, final int length, final int fontSize,
- final int letterSpacing, final int wordSpacing, final FontOptions options, final Orthography orthography) {
+ final int letterSpacing, final int wordSpacing, final FontOptions options,
+ final WritingSystem orthography) {
final IntArrayBuilder metricIndexes = new IntArrayBuilder(chars.length());
for (int i = 0; i < chars.length(); i ++) {
final int metricIndex = getFont().metricIndex(chars.charAt(i));
@@ -579,7 +580,7 @@
@Override
public String textToPdf(final CharSequence theString, final FontOptions fontOptions,
- final Orthography orthography) {
+ final WritingSystem orthography) {
final Font font = getFOrayFont();
final IntSequence glyphIndexes = encode(theString, 0, theString.length(), fontOptions, orthography);
final StringBuilder buffer = new StringBuilder();
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TtfTableGsub.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TtfTableGsub.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/format/ttf/TtfTableGsub.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -31,7 +31,7 @@
import org.foray.common.io.RandomAccessInput;
import org.foray.common.sequence.IntArrayBuilder;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.font.FontOptions;
import java.io.IOException;
@@ -140,7 +140,7 @@
* @param orthography The orthography that should be used when applying subsitutions.
*/
public void makeSubstitutions(final IntArrayBuilder glyphIndexes, final FontOptions options,
- final Orthography orthography) {
+ final WritingSystem orthography) {
/* "To implement features, a client applies the lookups in the order the lookup definitions occur in the
* LookupList. As a result, within the GSUB or GPOS table, lookups from several different features may be
Modified: trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java
===================================================================
--- trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-font/src/main/java/org/foray/font/util/MockFont.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -32,7 +32,7 @@
import org.foray.common.sequence.IntArray;
import org.axsl.common.data.BoundingBox;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.common.sequence.IntSequence;
import org.axsl.font.Font;
import org.axsl.font.FontOptions;
@@ -78,7 +78,8 @@
@Override
public int width(final IntSequence metricIndexes, final int offset, final int length, final int fontSize,
- final int letterSpacing, final int wordSpacing, final FontOptions options, final Orthography orthography) {
+ final int letterSpacing, final int wordSpacing, final FontOptions options,
+ final WritingSystem orthography) {
// TODO Auto-generated method stub
return 0;
}
Modified: trunk/foray/foray-font/src/test/java/org/foray/font/format/ttf/OtfLookupGsubTests.java
===================================================================
--- trunk/foray/foray-font/src/test/java/org/foray/font/format/ttf/OtfLookupGsubTests.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-font/src/test/java/org/foray/font/format/ttf/OtfLookupGsubTests.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -38,7 +38,7 @@
import org.foray.font.format.ttf.OtfLookupGsubx04x01.Ligature;
import org.foray.font.format.ttf.OtfLookupGsubx04x01.LigatureSet;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.font.FontException;
import org.axsl.font.FontOptions;
import org.axsl.ps.Encoding;
@@ -63,7 +63,7 @@
private static TrueTypeFont ttfFont;
/** The orthography that should be used when applying font features like subsitutions. */
- private static Orthography orthography;
+ private static WritingSystem orthography;
/**
* Setup this class for testing.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoLineText.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -28,7 +28,7 @@
package org.foray.fotree;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.fo.FoContext;
import org.axsl.fo.fo.GraftingPoint;
import org.axsl.font.FontOptions;
@@ -139,7 +139,7 @@
}
@Override
- public Orthography inlineOrthography() {
+ public WritingSystem inlineOrthography() {
return this.realLineText.inlineOrthography();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -58,8 +58,8 @@
import org.foray.fotree.value.DtBorderWidth;
import org.foray.fotree.value.DtWritingMode;
-import org.axsl.common.i18n.Orthography;
import org.axsl.common.i18n.Script;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaGlue;
import org.axsl.common.para.ParaLeaf;
@@ -3920,7 +3920,7 @@
}
@Override
- public Orthography getOrthography() {
+ public WritingSystem getOrthography() {
final Language4a language = this.traitLanguage(null);
final Country4a country = this.traitCountry(null);
final Script4a script = this.traitScript(null);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/ForeignXml.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -62,8 +62,7 @@
*
* @see InstreamForeignObject
*/
-public abstract class ForeignXml extends FoObj
- implements org.axsl.fo.FoForeignXml {
+public abstract class ForeignXml extends FoObj implements org.axsl.fo.FoForeignXml {
/** The parent of this node. */
private InstreamForeignObject parent;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/AbstractCharacterSequence.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -37,7 +37,7 @@
import org.foray.fotree.PropertyList;
import org.foray.fotree.fo.FoValue;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.TextTransform;
import org.axsl.common.value.WhiteSpaceTreatment;
@@ -215,7 +215,7 @@
}
@Override
- public Orthography inlineOrthography() {
+ public WritingSystem inlineOrthography() {
final Language4a language = inlineLanguage();
final Country4a country = inlineCountry();
return Orthography4a.find(language, country, null);
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/svg/obj/InstreamSvgElement.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -44,8 +44,7 @@
/**
* The content of an inline SVG document.
*/
-public class InstreamSvgElement extends ForeignXml
- implements org.axsl.fo.foreign.SvgElement {
+public class InstreamSvgElement extends ForeignXml implements org.axsl.fo.foreign.SvgElement {
/** The SVG Graphic instance for this inline SVG. */
private SvgGraphic svgGraphic;
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -32,7 +32,7 @@
import org.foray.text.TextServer4a;
import org.foray.text.line.EagerLineBreaker;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.font.FontConsumer;
import org.axsl.linebreak.LineBreakControl;
import org.axsl.orthography.OrthographyConfig;
@@ -115,7 +115,7 @@
final int end) throws TextException {
this.currentLineText = lineText;
this.currentChars = this.currentLineText.inlineText();
- final Orthography orthography = lineText.inlineOrthography();
+ final WritingSystem orthography = lineText.inlineOrthography();
final String language = orthography.getLanguage().getAlpha3Code();
this.finalWidth = 0;
@@ -395,7 +395,7 @@
* LineText items to find the beginning of the word.
*/
final OrthographyServer server = this.getTextServer().getHyphenationServer();
- final Orthography orthography = this.currentLineText.inlineOrthography();
+ final WritingSystem orthography = this.currentLineText.inlineOrthography();
final OrthographyConfig orthographyConfig = server.getOrthographyConfig(orthography);
if (orthographyConfig == null) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -41,7 +41,7 @@
import org.foray.orthography.util.NaturalLanguage;
import org.axsl.common.i18n.Language;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.OrthographyServer;
@@ -78,8 +78,8 @@
private EntityResolver entityResolver = null;
/** Map of orthographies and their configurations to be used by this server. */
- private Map<Orthography, OrthographyConfig4a> orthographyConfigurations =
- new HashMap<Orthography, OrthographyConfig4a>();
+ private Map<WritingSystem, OrthographyConfig4a> orthographyConfigurations =
+ new HashMap<WritingSystem, OrthographyConfig4a>();
/** The map of match rule lists, keyed by id. */
private Map<String, List<Pattern>> matchRuleLists = new HashMap<String, List<Pattern>>();
@@ -286,12 +286,12 @@
* @param orthography The orthography for which the configuration should be registered.
* @param config The configuration for {@code orthography}.
*/
- public void registerOrthographyConfig(final Orthography orthography, final OrthographyConfig4a config) {
+ public void registerOrthographyConfig(final WritingSystem orthography, final OrthographyConfig4a config) {
this.orthographyConfigurations.put(orthography, config);
}
@Override
- public OrthographyConfig4a getOrthographyConfig(final Orthography orthography) {
+ public OrthographyConfig4a getOrthographyConfig(final WritingSystem orthography) {
return this.orthographyConfigurations.get(orthography);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -40,7 +40,7 @@
import org.foray.orthography.OrthographyConfig4a;
import org.foray.orthography.SegmentDictionary;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.orthography.Dictionary;
import org.axsl.orthography.OrthographyException;
@@ -96,7 +96,7 @@
private String qName;
/** The orthography specified in an xml:lang attribute for this element, if any. */
- private Orthography orthography;
+ private WritingSystem orthography;
/** The orthography configuration for this element, only if {@link #orthography} is not null. */
private OrthographyConfig4a orthographyConfig;
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfContentStream4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfContentStream4a.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfContentStream4a.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -31,7 +31,7 @@
import org.foray.common.WellKnownConstants;
import org.foray.pdf.PdfGraphicsState4a;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.font.FontConsumer;
import org.axsl.font.FontOptions;
import org.axsl.graphic.Graphic;
@@ -111,7 +111,7 @@
@Override
public synchronized void drawText(final CharSequence text, final FontOptions fontOptions,
- final Orthography orthography) throws PdfException {
+ final WritingSystem orthography) throws PdfException {
if (text.length() < 1) {
return;
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFont4a.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFont4a.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfFont4a.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -30,7 +30,7 @@
import org.foray.common.WellKnownConstants;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.font.Font;
import org.axsl.font.FontOptions;
import org.axsl.font.FontUse;
@@ -432,7 +432,7 @@
@Override
public CharSequence textToPdf(final CharSequence theString, final FontOptions fontOptions,
- final Orthography orthography) {
+ final WritingSystem orthography) {
/* If available, delegate this to the FontUse instance. */
return this.fsFont == null ? theString : this.fsFont.textToPdf(theString, fontOptions, orthography);
}
Modified: trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfString.java
===================================================================
--- trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfString.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-pdf/src/main/java/org/foray/pdf/object/PdfString.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -28,7 +28,7 @@
package org.foray.pdf.object;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.font.FontOptions;
import org.axsl.pdf.PdfFont;
@@ -52,7 +52,7 @@
private FontOptions fontOptions;
/** The orthography that should be used when applying font features like subsitutions. */
- private Orthography orthography;
+ private WritingSystem orthography;
/**
* Constructor.
@@ -63,7 +63,7 @@
* @param orthography The orthography that should be used when applying font features like subsitutions.
*/
public PdfString(final String string, final PdfFont font, final FontOptions fontOptions,
- final Orthography orthography) {
+ final WritingSystem orthography) {
this.theString = string;
this.font = font;
this.fontOptions = fontOptions;
Modified: trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java
===================================================================
--- trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java 2021-11-11 23:36:46 UTC (rev 12039)
+++ trunk/foray/foray-render/src/main/java/org/foray/render/pdf/PdfRenderer.java 2021-11-12 00:38:42 UTC (rev 12040)
@@ -39,7 +39,7 @@
import org.axsl.common.FormattedIntegerType;
import org.axsl.common.PositiveIntegerFormatter;
-import org.axsl.common.i18n.Orthography;
+import org.axsl.common.i18n.WritingSystem;
import org.axsl.common.value.LinkType;
import org.axsl.common.value.RuleStyle;
import org.axsl.font.Font;
@@ -472,7 +472,7 @@
*/
private void paintText(final TextArea area, final FontUse fontUse,
final CharSequence text, final int startIndex, final int size,
- final FontOptions fontOptions, final Orthography orthography) throws PdfException {
+ final FontOptions fontOptions, final WritingSystem orthography) throws PdfException {
if (size < 1) {
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 23:36:47
|
Revision: 12039
http://sourceforge.net/p/foray/code/12039
Author: victormote
Date: 2021-11-11 23:36:46 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Conform to aXSL change: Move method from OrthographyConsumer to OrthographyConfig.
Modified Paths:
--------------
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-11 23:01:13 UTC (rev 12038)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-11 23:36:46 UTC (rev 12039)
@@ -35,7 +35,7 @@
import org.axsl.common.i18n.Orthography;
import org.axsl.font.FontConsumer;
import org.axsl.linebreak.LineBreakControl;
-import org.axsl.orthography.OrthographyConsumer;
+import org.axsl.orthography.OrthographyConfig;
import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.OrthographyServer;
import org.axsl.orthography.Word;
@@ -395,8 +395,14 @@
* LineText items to find the beginning of the word.
*/
final OrthographyServer server = this.getTextServer().getHyphenationServer();
- final OrthographyConsumer consumer = server.makeConsumer();
final Orthography orthography = this.currentLineText.inlineOrthography();
+
+ final OrthographyConfig orthographyConfig = server.getOrthographyConfig(orthography);
+ if (orthographyConfig == null) {
+ throw new TextException(String.format("Configuration not found for orthography {}",
+ orthography.toString()));
+ }
+
// Count the number of chars at the beginning that should be ignored.
final int actualWordStart = wordStarts(this.currentChars, this.wordStart);
if (actualWordStart < 0) {
@@ -408,7 +414,7 @@
// See if there are discretionary hyphenation points.
Word hyph = null;
try {
- hyph = consumer.hyphenate(this.currentChars, actualWordStart, wordSize, orthography);
+ hyph = orthographyConfig.hyphenate(this.currentChars, actualWordStart, wordSize);
} catch (final OrthographyException e) {
/* Log the exception and continue. */
this.getLogger().error("Hyphenation error", e);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-11 23:01:13 UTC (rev 12038)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-11 23:36:46 UTC (rev 12039)
@@ -29,14 +29,9 @@
package org.foray.orthography;
import org.foray.common.para.ParaBranch4a;
-import org.foray.common.primitive.CharSequenceUtils;
import org.foray.common.primitive.CharacterUtils;
import org.foray.common.primitive.NumberUtils;
-import org.foray.orthography.wrapper.CapitalizedWord;
-import org.foray.orthography.wrapper.ExactWord;
-import org.foray.orthography.wrapper.UppercaseWord;
-import org.axsl.common.i18n.Orthography;
import org.axsl.common.para.ParaConfig;
import org.axsl.orthography.OrthographyConsumer;
import org.axsl.orthography.Word;
@@ -65,58 +60,6 @@
this.server = server;
}
- @Override
- public Word hyphenate(final CharSequence word, final int offset, final int length, final Orthography orthography) {
- final OrthographyConfig4a orthographyConfig = this.server.getOrthographyConfig(orthography);
- if (orthographyConfig == null) {
- this.logger.warn("Configuration not found for orthography {}", orthography.toString());
- return null;
- }
-
- /* The character sequence containing the characters in the word that we are looking for. */
- final CharSequence chars = word.subSequence(offset, offset + length);
- Word hyphenatedWord = null;
-
- /* Look in the dictionary first, as it should be more accurate. */
- final SegmentDictionary dictionary = orthographyConfig.getDictionary();
- if (dictionary != null) {
- hyphenatedWord = dictionary.getWord(chars.toString().toLowerCase(), 0);
- if (hyphenatedWord == null) {
- hyphenatedWord = orthographyConfig.findDerivatives(chars);
- }
- }
-
-
- if (hyphenatedWord == null) {
- /* The word was not found in the dictionary. Try the hyphenation patterns. */
- final PatternTree patternTree = orthographyConfig.getHyphenationPatterns();
- if (patternTree == null) {
- return null;
- }
- hyphenatedWord = patternTree.hyphenate(chars, 0, length);
- }
-
- if (hyphenatedWord == null) {
- return null;
- }
-
- final boolean capitalized = CharSequenceUtils.equalToCapitalized(hyphenatedWord.getNormalizedContent(), chars);
- if (capitalized) {
- return new CapitalizedWord(hyphenatedWord);
- }
- final boolean uppercase = CharSequenceUtils.equalToUppercase(hyphenatedWord.getNormalizedContent(), chars);
- if (uppercase) {
- return new UppercaseWord(hyphenatedWord);
- }
-
- if (CharSequenceUtils.hasAnyUppercase(chars)) {
- /* There is unexpected capitalization. */
- return new ExactWord(hyphenatedWord, chars.toString());
- }
-
- return hyphenatedWord;
- }
-
/**
* Returns the parent server.
* @return The parent server.
@@ -148,7 +91,7 @@
parseInterwordContent(wordSequence, chunk);
} else {
/* Chunk is a word. */
- Word word = hyphenate(chunk, 0, chunk.length(), paraConfig.getOrthography());
+ Word word = orthographyConfig.hyphenate(chunk, 0, chunk.length());
if (word == null) {
word = new StringWord(0, chunk);
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java 2021-11-11 23:01:13 UTC (rev 12038)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java 2021-11-11 23:36:46 UTC (rev 12039)
@@ -30,6 +30,9 @@
import org.foray.common.primitive.BooleanUtils;
import org.foray.common.primitive.CharSequenceUtils;
+import org.foray.orthography.wrapper.CapitalizedWord;
+import org.foray.orthography.wrapper.ExactWord;
+import org.foray.orthography.wrapper.UppercaseWord;
import org.axsl.orthography.Dictionary;
import org.axsl.orthography.OrthographyConfig;
@@ -350,4 +353,50 @@
return false;
}
+ @Override
+ public Word hyphenate(final CharSequence word, final int offset, final int length) {
+ /* The character sequence containing the characters in the word that we are looking for. */
+ final CharSequence chars = word.subSequence(offset, offset + length);
+ Word hyphenatedWord = null;
+
+ /* Look in the dictionary first, as it should be more accurate. */
+ final SegmentDictionary dictionary = getDictionary();
+ if (dictionary != null) {
+ hyphenatedWord = dictionary.getWord(chars.toString().toLowerCase(), 0);
+ if (hyphenatedWord == null) {
+ hyphenatedWord = findDerivatives(chars);
+ }
+ }
+
+
+ if (hyphenatedWord == null) {
+ /* The word was not found in the dictionary. Try the hyphenation patterns. */
+ final PatternTree patternTree = getHyphenationPatterns();
+ if (patternTree == null) {
+ return null;
+ }
+ hyphenatedWord = patternTree.hyphenate(chars, 0, length);
+ }
+
+ if (hyphenatedWord == null) {
+ return null;
+ }
+
+ final boolean capitalized = CharSequenceUtils.equalToCapitalized(hyphenatedWord.getNormalizedContent(), chars);
+ if (capitalized) {
+ return new CapitalizedWord(hyphenatedWord);
+ }
+ final boolean uppercase = CharSequenceUtils.equalToUppercase(hyphenatedWord.getNormalizedContent(), chars);
+ if (uppercase) {
+ return new UppercaseWord(hyphenatedWord);
+ }
+
+ if (CharSequenceUtils.hasAnyUppercase(chars)) {
+ /* There is unexpected capitalization. */
+ return new ExactWord(hyphenatedWord, chars.toString());
+ }
+
+ return hyphenatedWord;
+ }
+
}
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-11 23:01:13 UTC (rev 12038)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java 2021-11-11 23:36:46 UTC (rev 12039)
@@ -57,6 +57,7 @@
/** The object under test. */
private HyphenationConsumer4a consumer;
+
/**
* Setup resources used over all tests in this class.
* @throws IOException For errors during server creation.
@@ -141,7 +142,8 @@
if (! testWord.toLowerCase().equals("hyphenation")) {
throw new OrthographyException("Test of \"hyphenation\" has invalid input.");
}
- final Word hyphenation = this.consumer.hyphenate(testWord, 0, testWord.length(), Orthography4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthographyConfig(Orthography4a.USA);
+ final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(3, hyphenation.getQtyHyphenationPoints());
Assert.assertEquals(2, hyphenation.getHyphenationPointOffset(0));
@@ -181,7 +183,8 @@
if (! testWord.toLowerCase().equals("obligatory")) {
throw new OrthographyException("Test of \"obligatory\" has invalid input.");
}
- final Word hyphenation = this.consumer.hyphenate(testWord, 0, testWord.length(), Orthography4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthographyConfig(Orthography4a.USA);
+ final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals(4, hyphenation.getQtyHyphenationPoints());
Assert.assertEquals(2, hyphenation.getHyphenationPointOffset(0));
@@ -199,7 +202,8 @@
@Test
public void testEnInvalidCharacter() throws OrthographyException {
final String testWord = "table8";
- final Word hyphenation = this.consumer.hyphenate(testWord, 0, testWord.length(), Orthography4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthographyConfig(Orthography4a.USA);
+ final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNull(hyphenation);
}
@@ -211,7 +215,8 @@
@Test
public void testTimes() throws OrthographyException {
final String testWord = "times";
- final Word hyphenation = this.consumer.hyphenate(testWord, 0, testWord.length(), Orthography4a.USA);
+ final OrthographyConfig4a orthography = server.getOrthographyConfig(Orthography4a.USA);
+ final Word hyphenation = orthography.hyphenate(testWord, 0, testWord.length());
Assert.assertNotNull(hyphenation);
Assert.assertEquals("times", hyphenation.toString());
Assert.assertEquals("time", hyphenation.getNormalizedContent());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 23:01:16
|
Revision: 12038
http://sourceforge.net/p/foray/code/12038
Author: victormote
Date: 2021-11-11 23:01:13 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Conform to aXSL addition of new method.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-11 22:34:43 UTC (rev 12037)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-11 23:01:13 UTC (rev 12038)
@@ -290,11 +290,7 @@
this.orthographyConfigurations.put(orthography, config);
}
- /**
- * Returns the registered configuration for a given orthography.
- * @param orthography The orthography whose configuration should be returned.
- * @return The configuration for {@code orthography}.
- */
+ @Override
public OrthographyConfig4a getOrthographyConfig(final Orthography orthography) {
return this.orthographyConfigurations.get(orthography);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 22:34:46
|
Revision: 12037
http://sourceforge.net/p/foray/code/12037
Author: victormote
Date: 2021-11-11 22:34:43 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Conform to aXSL change removing method.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-11 22:15:33 UTC (rev 12036)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-11 22:34:43 UTC (rev 12037)
@@ -117,11 +117,6 @@
return hyphenatedWord;
}
- @Override
- public List<Word> getUnexpectedWords() {
- throw new UnsupportedOperationException();
- }
-
/**
* Returns the parent server.
* @return The parent server.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 22:15:34
|
Revision: 12036
http://sourceforge.net/p/foray/code/12036
Author: victormote
Date: 2021-11-11 22:15:33 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Conform to aXSL interface removal.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapperFactory.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 2021-11-11 21:22:13 UTC (rev 12035)
+++ trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml 2021-11-11 22:15:33 UTC (rev 12036)
@@ -186,7 +186,7 @@
<resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/eng.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-orthography/src/main/data/hyph-patterns/eng.xml</resource-location>
+ <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-orthography/src/main/data/hyphPatterns/eng.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapperFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapperFactory.java 2021-11-11 21:22:13 UTC (rev 12035)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapperFactory.java 2021-11-11 22:15:33 UTC (rev 12036)
@@ -29,13 +29,12 @@
package org.foray.orthography;
import org.axsl.orthography.Dictionary;
-import org.axsl.orthography.WordFactory;
/**
* Factory that knows how to create an instance of a {@link WordWrapper}.
* @param <T> The type of {@link WordWrapper} created by this factory.
*/
-public abstract class WordWrapperFactory<T extends WordWrapper> implements WordFactory<T> {
+public abstract class WordWrapperFactory<T extends WordWrapper> {
/**
* Checks a word against the pattern for this word wrapper, and creates an instance of it if there is a match.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 21:22:15
|
Revision: 12035
http://sourceforge.net/p/foray/code/12035
Author: victormote
Date: 2021-11-11 21:22:13 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Clean up more hyphen --> orthography issues.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/eng.jbso
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/fin.jbso
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/hun.jbso
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/ita.jbso
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/mah.jbso
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/pol.jbso
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/por.jbso
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/rus.jbso
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/spa.jbso
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-11 21:07:49 UTC (rev 12034)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-11 21:22:13 UTC (rev 12035)
@@ -47,7 +47,7 @@
import java.util.List;
/**
- * FOray implementation of {@link HyphenationConsumer}.
+ * FOray implementation of {@link OrthographyConsumer}.
*/
public class HyphenationConsumer4a implements OrthographyConsumer {
Modified: trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/eng.jbso
===================================================================
(Binary files differ)
Modified: trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/fin.jbso
===================================================================
(Binary files differ)
Modified: trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/hun.jbso
===================================================================
(Binary files differ)
Modified: trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/ita.jbso
===================================================================
(Binary files differ)
Modified: trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/mah.jbso
===================================================================
(Binary files differ)
Modified: trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/pol.jbso
===================================================================
(Binary files differ)
Modified: trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/por.jbso
===================================================================
(Binary files differ)
Modified: trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/rus.jbso
===================================================================
(Binary files differ)
Modified: trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/spa.jbso
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 21:07:52
|
Revision: 12034
http://sourceforge.net/p/foray/code/12034
Author: victormote
Date: 2021-11-11 21:07:49 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Clean up more hyphen --> orthography changes.
Modified Paths:
--------------
trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
trunk/foray/foray-orthography/build.gradle
trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
trunk/foray/foray-orthography/src/test/resources/orthography-config.xml
trunk/foray/master/doc/web/00-rsrc/include/leftmenu-module.html
trunk/foray/master/doc/web/module/download.html
trunk/foray/master/doc/web/module/hyphen/index.html
trunk/foray/master/doc/web/module/index.html
trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch
trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch
Added Paths:
-----------
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/
Removed Paths:
-------------
trunk/foray/foray-orthography/src/main/resources/resources/org/foray/hyphen/
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2021-11-11 21:07:49 UTC (rev 12034)
@@ -85,7 +85,8 @@
private FoDocumentReader() throws IOException, ForayException {
final Properties buildProperties = Environment.getBuildProperties();
final String foraySandbox = buildProperties.getProperty("foray.sandbox");
- final String orthographyConfigPath = foraySandbox + "/foray-hyphen/src/test/resources/orthography-config.xml";
+ final String orthographyConfigPath =
+ foraySandbox + "/foray-orthography/src/test/resources/orthography-config.xml";
final URL orthographyFile = new URL("file", null, orthographyConfigPath);
final Logger logger = LoggerFactory.getLogger(FoDocumentReader.class);
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-11 21:07:49 UTC (rev 12034)
@@ -140,14 +140,15 @@
final Properties buildProperties = Environment.getBuildProperties();
final String foraySandbox = buildProperties.getProperty("foray.sandbox");
- final String orthographyConfigPath = foraySandbox + "/foray-hyphen/src/test/resources/orthography-config.xml";
- final String wordListDirString = foraySandbox + "/foray-hyphen/src/main/data/word-lists/";
+ final String orthographyConfigPath =
+ foraySandbox + "/foray-orthography/src/test/resources/orthography-config.xml";
+ final String wordListDirString = foraySandbox + "/foray-orthography/src/main/data/word-lists/";
final String dictionaryDirString =
- foraySandbox + "/foray-orthography/src/main/resources/resources/org/foray/hyphen/dictionaries/";
- final String rawPatternsDirString = foraySandbox + "/foray-hyphen/src/main/data/hyph-patterns/";
+ foraySandbox + "/foray-orthography/src/main/resources/resources/org/foray/orthography/dictionaries/";
+ final String rawPatternsDirString = foraySandbox + "/foray-orthography/src/main/data/hyph-patterns/";
final String serializedPatternsDirString =
- foraySandbox + "/foray-orthography/src/main/resources/resources/org/foray/hyphen/dictionaries";
- final String naturalLanguageDirString = foraySandbox + "/foray-hyphen/src/main/data/natural-languages/";
+ foraySandbox + "/foray-orthography/src/main/resources/resources/org/foray/orthography/dictionaries";
+ final String naturalLanguageDirString = foraySandbox + "/foray-orthography/src/main/data/natural-languages/";
final URL orthographyFile = new URL("file", null, orthographyConfigPath);
final URL rawDictionary = new URL("file", null, wordListDirString);
Modified: trunk/foray/foray-orthography/build.gradle
===================================================================
--- trunk/foray/foray-orthography/build.gradle 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/foray-orthography/build.gradle 2021-11-11 21:07:49 UTC (rev 12034)
@@ -28,11 +28,11 @@
outputs.upToDateWhen { false }
description = "Parse and serialize the hyphenation patterns"
classpath = sourceSets.main.runtimeClasspath
- main = 'org.foray.hyphen.PatternSerializer'
+ main = 'org.foray.orthography.PatternSerializer'
args('--input')
args('src/main/data/hyph-patterns')
args('--output')
- args('src/main/resources/resources/org/foray/hyphen/patterns')
+ args('src/main/resources/resources/org/foray/orthography/hyphPatterns')
args('--pattern')
args('^.*\\.xml$')
}
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 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/foray-orthography/src/main/data/orthographies/foray-orthography-config.xml 2021-11-11 21:07:49 UTC (rev 12034)
@@ -158,10 +158,10 @@
</derivative-pattern-list>
<derivative-factory-list id="eng-999-derivatives">
- <derivative-factory class="org.foray.hyphen.wrapper.LatinPlural1WordFactory"/>
- <derivative-factory class="org.foray.hyphen.wrapper.LatinPlural2WordFactory"/>
- <derivative-factory class="org.foray.hyphen.wrapper.LatinPossessive1WordFactory"/>
- <derivative-factory class="org.foray.hyphen.wrapper.LatinPossessive2WordFactory"/>
+ <derivative-factory class="org.foray.orthography.wrapper.LatinPlural1WordFactory"/>
+ <derivative-factory class="org.foray.orthography.wrapper.LatinPlural2WordFactory"/>
+ <derivative-factory class="org.foray.orthography.wrapper.LatinPossessive1WordFactory"/>
+ <derivative-factory class="org.foray.orthography.wrapper.LatinPossessive2WordFactory"/>
</derivative-factory-list>
<dictionary-resource id="dictionary-eng-moby">
@@ -169,11 +169,11 @@
<resource-location type="classpath">/resources/org/foray/dictionaries/en-moby.jbso</resource-location>
</parsed-resource>
<parsed-resource>
- <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-hyphen/src/main/resources/resources/org/foray/dictionaries/eng-999-Latn.dict.jbso</resource-location>
+ <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-orthography/src/main/resources/resources/org/foray/dictionaries/eng-999-Latn.dict.jbso</resource-location>
</parsed-resource>
<unparsed-dictionary>
<dictionary-element>
- <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-hyphen/src/main/data/dictionaries/eng-999-Latn.dict.xml</resource-location>
+ <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-orthography/src/main/data/dictionaries/eng-999-Latn.dict.xml</resource-location>
</dictionary-element>
</unparsed-dictionary>
</dictionary-resource>
@@ -180,13 +180,13 @@
<hyphenation-patterns-resource id="hyph-patterns-eng">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/hyphen/patterns/eng.jbso</resource-location>
+ <resource-location type="classpath">/resources/org/foray/orthography/hyphPatterns/eng.jbso</resource-location>
</parsed-resource>
<parsed-resource>
- <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/eng.jbso</resource-location>
+ <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/eng.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-hyphen/src/main/data/hyph-patterns/eng.xml</resource-location>
+ <resource-location type="url">file:///C:/vic/foray/trunk/foray/foray-orthography/src/main/data/hyph-patterns/eng.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
@@ -196,7 +196,7 @@
<dictionary reference="dictionary-eng-moby"/>
<hyphenation-patterns reference="hyph-patterns-eng"/>
<derivative-factories reference="eng-999-derivatives"/>
- <word-breaker class="org.foray.hyphen.WordBreakerLatin1"/>
+ <word-breaker class="org.foray.orthography.WordBreakerLatin1"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Latn"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Zyyy"/>
<orthography language-iso-3char="eng" country-iso-3char="999" script-iso-4char="Latn"/>
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java 2021-11-11 21:07:49 UTC (rev 12034)
@@ -70,14 +70,15 @@
final Properties buildProperties = Environment.getBuildProperties();
final String foraySandbox = buildProperties.getProperty("foray.sandbox");
- final String orthographyConfigPath = foraySandbox + "/foray-hyphen/src/test/resources/orthography-config.xml";
- final String rawDictionaryPath = foraySandbox + "/foray-hyphen/src/main/data/dictionaries/";
+ final String orthographyConfigPath = foraySandbox
+ + "/foray-orthography/src/test/resources/orthography-config.xml";
+ final String rawDictionaryPath = foraySandbox + "/foray-orthography/src/main/data/dictionaries/";
final String parsedDictionaryPath =
- foraySandbox + "/foray-hyphen/src/main/resources/resources/org/foray/hyphen/dictionaries/";
- final String rawPatternsPath = foraySandbox + "/foray-hyphen/src/main/data/hyph-patterns";
+ foraySandbox + "/foray-orthography/src/main/resources/resources/org/foray/orthography/dictionaries/";
+ final String rawPatternsPath = foraySandbox + "/foray-orthography/src/main/data/hyph-patterns";
final String parsedPatternsPath =
- foraySandbox + "/foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/";
- final String naturalLanguagePath = foraySandbox + "/foray-hyphen/src/main/data/natural-languages/";
+ foraySandbox + "/foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/";
+ final String naturalLanguagePath = foraySandbox + "/foray-orthography/src/main/data/natural-languages/";
final URL orthographyFile = new URL("file", null, orthographyConfigPath);
final URL rawDictionary = new URL("file", null, rawDictionaryPath);
Modified: trunk/foray/foray-orthography/src/test/resources/orthography-config.xml
===================================================================
--- trunk/foray/foray-orthography/src/test/resources/orthography-config.xml 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/foray-orthography/src/test/resources/orthography-config.xml 2021-11-11 21:07:49 UTC (rev 12034)
@@ -7,7 +7,7 @@
When configuring the location of resources:
1. parsed-classpath should always be an absolute classpath (i.e. should start with "/").
2. parsed-url and dictionary-url can be absolute or relative. The values in this file are relative, starting with
- file:../foray-hyphen, and are designed to allow this file to be used while running tests in any FOray project.
+ file:../foray-orthography, and are designed to allow this file to be used while running tests in any FOray project.
-->
@@ -14,11 +14,11 @@
<axsl-orthography-config>
<derivative-factory-list id="derivatives-eng">
- <derivative-factory class="org.foray.hyphen.wrapper.LatinPlural1WordFactory"/>
- <derivative-factory class="org.foray.hyphen.wrapper.LatinPlural2WordFactory"/>
- <derivative-factory class="org.foray.hyphen.wrapper.LatinPossessive1WordFactory"/>
- <derivative-factory class="org.foray.hyphen.wrapper.LatinPossessive2WordFactory"/>
- <derivative-factory class="org.foray.hyphen.wrapper.LatinPast1WordFactory"/>
+ <derivative-factory class="org.foray.orthography.wrapper.LatinPlural1WordFactory"/>
+ <derivative-factory class="org.foray.orthography.wrapper.LatinPlural2WordFactory"/>
+ <derivative-factory class="org.foray.orthography.wrapper.LatinPossessive1WordFactory"/>
+ <derivative-factory class="org.foray.orthography.wrapper.LatinPossessive2WordFactory"/>
+ <derivative-factory class="org.foray.orthography.wrapper.LatinPast1WordFactory"/>
</derivative-factory-list>
<dictionary-resource id="dictionary-eng-moby">
@@ -26,11 +26,11 @@
<resource-location type="classpath">/resources/org/foray/dictionaries/eng-999-Latn.jbso</resource-location>
</parsed-resource>
<parsed-resource>
- <resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/dictionaries/eng-999-Latn.jbso</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/resources/resources/org/foray/dictionaries/eng-999-Latn.jbso</resource-location>
</parsed-resource>
<unparsed-dictionary>
<dictionary-element>
- <resource-location type="url">file:../foray-hyphen/src/main/data/dictionaries/eng-999-Latn.dict.xml</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/data/dictionaries/eng-999-Latn.dict.xml</resource-location>
<exclusion regex-pattern="^[A-Z]"/>
</dictionary-element>
</unparsed-dictionary>
@@ -38,90 +38,90 @@
<hyphenation-patterns-resource id="hyph-patterns-eng">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/hyphen/patterns/eng.jbso</resource-location>
+ <resource-location type="classpath">/resources/org/foray/orthography/hyphPatterns/eng.jbso</resource-location>
</parsed-resource>
<parsed-resource>
- <resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/eng.jbso</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/eng.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:../foray-hyphen/src/main/data/hyph-patterns/eng.xml</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/data/hyph-patterns/eng.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
<hyphenation-patterns-resource id="hyph-patterns-fin">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/hyphen/patterns/fin.jbso</resource-location>
+ <resource-location type="classpath">/resources/org/foray/orthography/hyphPatterns/fin.jbso</resource-location>
</parsed-resource>
- <parsed-resource><resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/fin.jbso</resource-location>
+ <parsed-resource><resource-location type="url">file:../foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/fin.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:../foray-hyphen/src/main/data/hyph-patterns/fin.xml</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/data/hyph-patterns/fin.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
<hyphenation-patterns-resource id="hyph-patterns-hun">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/hyphen/patterns/hun.jbso</resource-location>
+ <resource-location type="classpath">/resources/org/foray/orthography/hyphPatterns/hun.jbso</resource-location>
</parsed-resource>
- <parsed-resource><resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/hun.jbso</resource-location>
+ <parsed-resource><resource-location type="url">file:../foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/hun.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:../foray-hyphen/src/main/data/hyph-patterns/hun.xml</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/data/hyph-patterns/hun.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
<hyphenation-patterns-resource id="hyph-patterns-ita">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/hyphen/patterns/ita.jbso</resource-location>
+ <resource-location type="classpath">/resources/org/foray/orthography/hyphPatterns/ita.jbso</resource-location>
</parsed-resource>
- <parsed-resource><resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/ita.jbso</resource-location>
+ <parsed-resource><resource-location type="url">file:../foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/ita.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:../foray-hyphen/src/main/data/hyph-patterns/ita.xml</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/data/hyph-patterns/ita.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
<hyphenation-patterns-resource id="hyph-patterns-pol">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/hyphen/patterns/pol.jbso</resource-location>
+ <resource-location type="classpath">/resources/org/foray/orthography/hyphPatterns/pol.jbso</resource-location>
</parsed-resource>
- <parsed-resource><resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/pol.jbso</resource-location>
+ <parsed-resource><resource-location type="url">file:../foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/pol.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:../foray-hyphen/src/main/data/hyph-patterns/pol.xml</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/data/hyph-patterns/pol.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
<hyphenation-patterns-resource id="hyph-patterns-por">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/hyphen/patterns/por.jbso</resource-location>
+ <resource-location type="classpath">/resources/org/foray/orthography/hyphPatterns/por.jbso</resource-location>
</parsed-resource>
- <parsed-resource><resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/por.jbso</resource-location>
+ <parsed-resource><resource-location type="url">file:../foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/por.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:../foray-hyphen/src/main/data/hyph-patterns/por.xml</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/data/hyph-patterns/por.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
<hyphenation-patterns-resource id="hyph-patterns-rus">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/hyphen/patterns/rus.jbso</resource-location>
+ <resource-location type="classpath">/resources/org/foray/orthography/hyphPatterns/rus.jbso</resource-location>
</parsed-resource>
- <parsed-resource><resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/rus.jbso</resource-location>
+ <parsed-resource><resource-location type="url">file:../foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/rus.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:../foray-hyphen/src/main/data/hyph-patterns/rus.xml</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/data/hyph-patterns/rus.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
<hyphenation-patterns-resource id="hyph-patterns-spa">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/hyphen/patterns/spa.jbso</resource-location>
+ <resource-location type="classpath">/resources/org/foray/orthography/hyphPatterns/spa.jbso</resource-location>
</parsed-resource>
- <parsed-resource><resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns/spa.jbso</resource-location>
+ <parsed-resource><resource-location type="url">file:../foray-orthography/src/main/resources/resources/org/foray/orthography/hyphPatterns/spa.jbso</resource-location>
</parsed-resource>
<unparsed-hyphenation-patterns>
- <resource-location type="url">file:../foray-hyphen/src/main/data/hyph-patterns/spa.xml</resource-location>
+ <resource-location type="url">file:../foray-orthography/src/main/data/hyph-patterns/spa.xml</resource-location>
</unparsed-hyphenation-patterns>
</hyphenation-patterns-resource>
@@ -129,7 +129,7 @@
<dictionary reference="dictionary-eng-moby"/>
<hyphenation-patterns reference="hyph-patterns-eng"/>
<derivative-factories reference="derivatives-eng"/>
- <word-breaker class="org.foray.hyphen.WordBreakerLatin1"/>
+ <word-breaker class="org.foray.orthography.WordBreakerLatin1"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Latn"/>
<orthography language-iso-3char="eng" country-iso-3char="USA" script-iso-4char="Zyyy"/>
</configuration>
@@ -136,43 +136,43 @@
<configuration>
<hyphenation-patterns reference="hyph-patterns-fin"/>
- <word-breaker class="org.foray.hyphen.WordBreakerDefault"/>
+ <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="fin" country-iso-3char="FIN" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-hun"/>
- <word-breaker class="org.foray.hyphen.WordBreakerDefault"/>
+ <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="hun" country-iso-3char="HUN" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-ita"/>
- <word-breaker class="org.foray.hyphen.WordBreakerLatin1"/>
+ <word-breaker class="org.foray.orthography.WordBreakerLatin1"/>
<orthography language-iso-3char="ita" country-iso-3char="ITA" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-pol"/>
- <word-breaker class="org.foray.hyphen.WordBreakerDefault"/>
+ <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="pol" country-iso-3char="POL" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-por"/>
- <word-breaker class="org.foray.hyphen.WordBreakerDefault"/>
+ <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="por" country-iso-3char="PRT" script-iso-4char="Latn"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-rus"/>
- <word-breaker class="org.foray.hyphen.WordBreakerDefault"/>
+ <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="rus" country-iso-3char="RUS" script-iso-4char="Cyrl"/>
</configuration>
<configuration>
<hyphenation-patterns reference="hyph-patterns-spa"/>
- <word-breaker class="org.foray.hyphen.WordBreakerDefault"/>
+ <word-breaker class="org.foray.orthography.WordBreakerDefault"/>
<orthography language-iso-3char="spa" country-iso-3char="ESP" script-iso-4char="Latn"/>
</configuration>
Modified: trunk/foray/master/doc/web/00-rsrc/include/leftmenu-module.html
===================================================================
--- trunk/foray/master/doc/web/00-rsrc/include/leftmenu-module.html 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/master/doc/web/00-rsrc/include/leftmenu-module.html 2021-11-11 21:07:49 UTC (rev 12034)
@@ -76,7 +76,7 @@
<tr>
<td class="Bullet1"> </td>
<td class="Menu1">
- <a class="Menu" href="/module/hyphen/">FOray Hyphen</a>
+ <a class="Menu" href="/module/hyphen/">FOray Orthography</a>
</td>
</tr>
<tr>
Modified: trunk/foray/master/doc/web/module/download.html
===================================================================
--- trunk/foray/master/doc/web/module/download.html 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/master/doc/web/module/download.html 2021-11-11 21:07:49 UTC (rev 12034)
@@ -60,7 +60,7 @@
</dependency>
<dependency>
<groupId>org.foray</groupId>
- <artifactId>foray-hyphen</artifactId>
+ <artifactId>foray-orthography</artifactId>
<version>0.4-SNAPSHOT</version>
</dependency>
<dependency>
Modified: trunk/foray/master/doc/web/module/hyphen/index.html
===================================================================
--- trunk/foray/master/doc/web/module/hyphen/index.html 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/master/doc/web/module/hyphen/index.html 2021-11-11 21:07:49 UTC (rev 12034)
@@ -15,16 +15,16 @@
<body>
<!--#include virtual="/00-rsrc/include/leftmenu-module.html" -->
-<h1>FOray Modules: FOrayHyphen</h1>
+<h1>FOray Modules: FOrayOrthography</h1>
<h2>Contents</h2>
<ul>
<li><a href="#intro">Introduction</a></li>
- <li><a href="#boot">Bootstrapping FOrayHyphen</a></li>
+ <li><a href="#boot">Bootstrapping FOrayOrthography</a></li>
</ul>
<h2><a name="intro">Introduction</a></h2>
-<p>FOrayHyphen is an implementation of
-<a href="http://www.axsl.org/hyphen/" rel="external">axslHyphen</a>, which
+<p>FOrayOrthography is an implementation of
+<a href="http://www.axsl.org/hyphen/" rel="external">axslOrthography</a>, which
should be consulted for details on the general API, sample code, etc.
Although it is possible to use the FOrayHyphen package directly, there is
probably no good reason to do so.
@@ -39,7 +39,7 @@
are as follows:</p>
<ol>
<li>Obtain a FOrayHyphenationServer instance.
-FOrayHyphenationServer is an aXSL HyphenationServer implementation, and can be
+FOrayHyphenationServer is an aXSL OrthographyServer implementation, and can be
instantiated using its constructor.
It is safe to create multiple instances, but this should be necessary only in
extremely sophisticated environments.</li>
Modified: trunk/foray/master/doc/web/module/index.html
===================================================================
--- trunk/foray/master/doc/web/module/index.html 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/master/doc/web/module/index.html 2021-11-11 21:07:49 UTC (rev 12034)
@@ -97,9 +97,9 @@
<td>Universals, FOrayXML.</td>
</tr>
<tr>
- <td><a class="Menu" href="./hyphen/">FOrayHyphen</a></td>
- <td>foray-hyphen</td>
- <td>Hyphenates words in various languages.</td>
+ <td><a class="Menu" href="./hyphen/">FOrayOrthography</a></td>
+ <td>foray-orthography</td>
+ <td>Provides hyphenation and spell-checking in various languages.</td>
<td>Universals.</td>
</tr>
<tr>
Modified: trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch
===================================================================
--- trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2021-11-11 21:07:49 UTC (rev 12034)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
- <listEntry value="/foray-orthography/src/main/java/org/foray/hyphen/DictionarySerializer.java"/>
+ <listEntry value="/foray-orthography/src/main/java/org/foray/orthography/DictionarySerializer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@@ -9,13 +9,13 @@
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-hyphen" path="1" type="4"/> "/>
- <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-hyphen"/> </runtimeClasspathEntry> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6/" javaProject="foray-orthography" path="1" type="4"/> "/>
+ <listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="foray-orthography"/> </runtimeClasspathEntry> "/>
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.USER_LIBRARY/logback" path="3" type="4"/> "/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
- <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.hyphen.DictionarySerializer"/>
- <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-hyphen"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.orthography.DictionarySerializer"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-orthography"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/src/main/data/dictionaries --output ${project_loc}/src/main/resources/resources/org/foray/dictionaries --pattern "eng-999-Latn.dict.txt""/>
- <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-hyphen"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-orthography"/>
</launchConfiguration>
Modified: trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch
===================================================================
--- trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch 2021-11-11 20:32:48 UTC (rev 12033)
+++ trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch 2021-11-11 21:07:49 UTC (rev 12034)
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
- <listEntry value="/foray-orthography/src/main/java/org/foray/hyphen/PatternSerializer.java"/>
+ <listEntry value="/foray-orthography/src/main/java/org/foray/orthography/PatternSerializer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
- <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.hyphen.PatternSerializer"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/../foray-hyphen/src/main/data/hyph-patterns --output ${project_loc}/../foray-hyphen/src/main/resources/resources/org/foray/hyphen/patterns --pattern ".*\.xml""/>
- <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-hyphen"/>
+ <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.foray.orthography.PatternSerializer"/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--input ${project_loc}/../foray-orthography/src/main/data/hyph-patterns --output ${project_loc}/../foray-orthography/src/main/resources/resources/org/foray/orthography/patterns --pattern ".*\.xml""/>
+ <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foray-orthography"/>
</launchConfiguration>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 20:32:51
|
Revision: 12033
http://sourceforge.net/p/foray/code/12033
Author: victormote
Date: 2021-11-11 20:32:48 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Conform to aXSL type name changes.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyResource.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternConsumer.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternSerializer.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternTree.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/util/NaturalLanguageTests.java
trunk/foray/master/doc/web/module/hyphen/index.html
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -47,8 +47,8 @@
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
import org.axsl.layout.LayoutFactory;
-import org.axsl.orthography.HyphenationException;
-import org.axsl.orthography.HyphenationServer;
+import org.axsl.orthography.OrthographyException;
+import org.axsl.orthography.OrthographyServer;
import org.axsl.ps.PsServer;
import org.axsl.speech.SpeechServer;
import org.axsl.text.TextServer;
@@ -94,7 +94,7 @@
public static ForaySession makeFOraySession(final SessionConfig sessionConfig) throws ForayException {
final Logger logger = LoggerFactory.getLogger(ForaySpecific.class);
final FontServer fontServer = ForaySpecific.makeFontServer(sessionConfig);
- final HyphenationServer hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
+ final OrthographyServer hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
final TextServer textServer = ForaySpecific.makeTextServer(logger, hyphenServer);
final GraphicServer graphicServer = ForaySpecific.makeGraphicServer(logger);
final FoTreeFactory foTreeServer = ForaySpecific.makeFOTreeFactory(
@@ -154,7 +154,7 @@
* @throws ForayException For errors creating the server.
*/
public static TextServer makeTextServer(final Logger logger,
- final HyphenationServer hyphenServer) throws ForayException {
+ final OrthographyServer hyphenServer) throws ForayException {
return new org.foray.text.TextServer4a(logger, hyphenServer);
}
@@ -164,7 +164,7 @@
* @return The newly-created HyphenationServer instance.
* @throws ForayException For errors creating the hyphenation server.
*/
- public static HyphenationServer makeHyphenationServer(final SessionConfig configuration) throws ForayException {
+ public static OrthographyServer makeHyphenationServer(final SessionConfig configuration) throws ForayException {
final HyphenationServerConfig config = new HyphenationServerConfig();
config.setOrthographyConfigurationLocation(configuration.optionOrthographyConfiguration());
config.setWordListsBaseDirectory(configuration.optionDictionariesBaseDirectory());
@@ -176,7 +176,7 @@
try {
return new org.foray.orthography.HyphenationServer4a(config);
- } catch (final HyphenationException e) {
+ } catch (final OrthographyException e) {
throw new ForayException(e);
}
}
@@ -209,7 +209,7 @@
final FontServer fontServer,
final GraphicServer graphicServer,
final TextServer textServer,
- final HyphenationServer hyphenationServer)
+ final OrthographyServer hyphenationServer)
throws ForayException {
final URL[] graphicSearchPath = buildGraphicSearchPath(configuration);
return new FoTreeServer4a(logger, fontServer, textServer, hyphenationServer,
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -40,7 +40,7 @@
import org.axsl.font.FontConsumer;
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.orthography.HyphenationServer;
+import org.axsl.orthography.OrthographyServer;
import org.axsl.text.TextServer;
import org.slf4j.Logger;
@@ -96,7 +96,7 @@
final FontServer fontServer = ForaySpecific.makeFontServer(sessionConfig);
final GraphicServer graphicServer = ForaySpecific.makeGraphicServer(logger);
- final HyphenationServer hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
+ final OrthographyServer hyphenServer = ForaySpecific.makeHyphenationServer(sessionConfig);
final TextServer textServer = ForaySpecific.makeTextServer(logger, hyphenServer);
final URL[] graphicSearchPath = new URL[1];
final URL testDirUrl = this.testDirectory.toURI().toURL();
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -34,7 +34,7 @@
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
import org.axsl.layout.LayoutFactory;
-import org.axsl.orthography.HyphenationServer;
+import org.axsl.orthography.OrthographyServer;
import org.axsl.speech.SpeechServer;
import org.axsl.text.TextServer;
@@ -74,7 +74,7 @@
private FontServer fontServer;
/** A HyphenationServer instance to be used for this session. */
- private HyphenationServer hyphenServer;
+ private OrthographyServer hyphenServer;
/** A TextServer instance to be used for this session. */
private TextServer textServer;
@@ -132,7 +132,7 @@
* @throws ForayException For invalid parameters.
*/
public ForaySession(final Logger logger, final SessionConfig configuration,
- final FontServer fontServer, final HyphenationServer hyphenServer,
+ final FontServer fontServer, final OrthographyServer hyphenServer,
final TextServer textServer, final GraphicServer graphicServer,
final SpeechServer speechServer,
final FoTreeFactory foTreeFactory,
@@ -263,7 +263,7 @@
* Returns the HyphenationServer.
* @return The HyphenationServer.
*/
- public HyphenationServer getHyphenationServer() {
+ public OrthographyServer getHyphenationServer() {
return this.hyphenServer;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -134,7 +134,7 @@
import org.axsl.font.FontUse;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicServer;
-import org.axsl.orthography.HyphenationConsumer;
+import org.axsl.orthography.OrthographyConsumer;
import org.axsl.speech.SpeechException;
import org.axsl.speech.SpeechServer;
import org.axsl.speech.Voice;
@@ -3891,7 +3891,7 @@
* Returns the hyphenation consumer.
* @return The hyphenation consumer.
*/
- public HyphenationConsumer getHyphenationConsumer() {
+ public OrthographyConsumer getHyphenationConsumer() {
return getParent().getHyphenationConsumer();
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -42,7 +42,7 @@
import org.axsl.fo.FoTreeListener;
import org.axsl.font.FontConsumer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.orthography.HyphenationConsumer;
+import org.axsl.orthography.OrthographyConsumer;
import org.axsl.speech.SpeechServer;
import org.axsl.text.TextServer;
@@ -103,7 +103,7 @@
private SpeechServer speechServer;
/** The hyphenation consumer for this document. */
- private HyphenationConsumer hyphenationConsumer;
+ private OrthographyConsumer hyphenationConsumer;
/** The paths to search when looking for graphics. */
private URL[] graphicSearchPath;
@@ -534,12 +534,12 @@
}
@Override
- public void setHyphenationConsumer(final HyphenationConsumer hyphenationConsumer) {
+ public void setHyphenationConsumer(final OrthographyConsumer hyphenationConsumer) {
this.hyphenationConsumer = hyphenationConsumer;
}
@Override
- public HyphenationConsumer getHyphenationConsumer() {
+ public OrthographyConsumer getHyphenationConsumer() {
return this.hyphenationConsumer;
}
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -39,7 +39,7 @@
import org.axsl.fo.FoTreeFactory;
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.orthography.HyphenationServer;
+import org.axsl.orthography.OrthographyServer;
import org.axsl.text.TextServer;
import org.slf4j.Logger;
@@ -70,7 +70,7 @@
private TextServer textServer;
/** The hyphenation server. */
- private HyphenationServer hyphenationServer;
+ private OrthographyServer orthographyServer;
/** The array of URLs in which graphics should be searched. */
private URL[] graphicSearchPath;
@@ -106,7 +106,7 @@
* @param logger The logger.
* @param fontServer The font server.
* @param textServer The text server.
- * @param hyphenationServer The hyphenation server.
+ * @param orthographyServer The hyphenation server.
* @param graphicServer The graphic server.
* @param graphicSearchPath The array of URLs in which graphics should be
* searched.
@@ -116,7 +116,7 @@
public FoTreeServer4a(final Logger logger,
final FontServer fontServer,
final TextServer textServer,
- final HyphenationServer hyphenationServer,
+ final OrthographyServer orthographyServer,
final GraphicServer graphicServer,
final URL[] graphicSearchPath,
final boolean cachingGraphics) {
@@ -124,7 +124,7 @@
this.fontServer = fontServer;
this.graphicServer = graphicServer;
this.textServer = textServer;
- this.hyphenationServer = hyphenationServer;
+ this.orthographyServer = orthographyServer;
this.graphicSearchPath = graphicSearchPath;
this.cachingGraphics = cachingGraphics;
setupNamespaces();
@@ -284,7 +284,7 @@
this.getLogger());
foTreeBuilder.setGraphicServer(this.graphicServer);
foTreeBuilder.setTextServer(this.textServer);
- foTreeBuilder.setHyphenationConsumer(this.hyphenationServer.makeConsumer());
+ foTreeBuilder.setHyphenationConsumer(this.orthographyServer.makeConsumer());
foTreeBuilder.setGraphicSearchPath(this.graphicSearchPath);
foTreeBuilder.setCachingGraphics(this.cachingGraphics);
return foTreeBuilder;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -37,7 +37,7 @@
import org.axsl.common.value.TextTransform;
import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.fo.FoContext;
-import org.axsl.orthography.HyphenationConsumer;
+import org.axsl.orthography.OrthographyConsumer;
import java.util.ArrayList;
import java.util.List;
@@ -57,7 +57,7 @@
*/
public FoWordSequence(final FoObj parent, final CharSequence content) {
super(parent);
- final HyphenationConsumer hyphenationConsumer = getHyphenationConsumer();
+ final OrthographyConsumer hyphenationConsumer = getHyphenationConsumer();
final ParaConfig4a config = new ParaConfig4a(getPrimaryFont(null), inlineFontSize(), inlineOrthography(),
parent.traitWordSpacingMax(null), parent.traitWordSpacingMin(null));
final ParaBranch wordSequence =
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -39,7 +39,7 @@
import org.axsl.fo.FoTreeException;
import org.axsl.fo.ProxyFactory;
import org.axsl.font.FontUse;
-import org.axsl.orthography.HyphenationConsumer;
+import org.axsl.orthography.OrthographyConsumer;
import org.slf4j.Logger;
@@ -511,7 +511,7 @@
}
@Override
- public HyphenationConsumer getHyphenationConsumer() {
+ public OrthographyConsumer getHyphenationConsumer() {
return this.treeBuilder.getHyphenationConsumer();
}
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -32,7 +32,7 @@
import org.axsl.font.FontConsumer;
import org.axsl.linebreak.LineBreakControl;
-import org.axsl.orthography.HyphenationServer;
+import org.axsl.orthography.OrthographyServer;
import org.axsl.text.line.EagerLineBreaker;
import org.axsl.text.line.LineBreakHandler;
import org.axsl.text.line.PatientLineBreaker;
@@ -48,18 +48,18 @@
private Logger logger;
/** The Hyphenator instance that handles hyphenation services. */
- private HyphenationServer hyphenationServer;
+ private OrthographyServer orthographyServer;
/**
* Constructor.
* @param logger The logger instance that should be used to log
* user messages.
- * @param hyphenationServer The hyphenation server that should be used to
+ * @param orthographyServer The hyphenation server that should be used to
* resolved hyphenation questions.
*/
- public TextServer4a(final Logger logger, final HyphenationServer hyphenationServer) {
+ public TextServer4a(final Logger logger, final OrthographyServer orthographyServer) {
this.logger = logger;
- this.hyphenationServer = hyphenationServer;
+ this.orthographyServer = orthographyServer;
}
/**
@@ -74,8 +74,8 @@
* Returns the hyphenation server.
* @return The hyphenation server.
*/
- public HyphenationServer getHyphenationServer() {
- return this.hyphenationServer;
+ public OrthographyServer getHyphenationServer() {
+ return this.orthographyServer;
}
@Override
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -35,9 +35,9 @@
import org.axsl.common.i18n.Orthography;
import org.axsl.font.FontConsumer;
import org.axsl.linebreak.LineBreakControl;
-import org.axsl.orthography.HyphenationConsumer;
-import org.axsl.orthography.HyphenationException;
-import org.axsl.orthography.HyphenationServer;
+import org.axsl.orthography.OrthographyConsumer;
+import org.axsl.orthography.OrthographyException;
+import org.axsl.orthography.OrthographyServer;
import org.axsl.orthography.Word;
import org.axsl.text.TextException;
import org.axsl.text.line.LineBreakHandler;
@@ -394,8 +394,8 @@
* backward at any text in the same LineText item, and then to prior
* LineText items to find the beginning of the word.
*/
- final HyphenationServer server = this.getTextServer().getHyphenationServer();
- final HyphenationConsumer consumer = server.makeConsumer();
+ final OrthographyServer server = this.getTextServer().getHyphenationServer();
+ final OrthographyConsumer consumer = server.makeConsumer();
final Orthography orthography = this.currentLineText.inlineOrthography();
// Count the number of chars at the beginning that should be ignored.
final int actualWordStart = wordStarts(this.currentChars, this.wordStart);
@@ -409,7 +409,7 @@
Word hyph = null;
try {
hyph = consumer.hyphenate(this.currentChars, actualWordStart, wordSize, orthography);
- } catch (final HyphenationException e) {
+ } catch (final OrthographyException e) {
/* Log the exception and continue. */
this.getLogger().error("Hyphenation error", e);
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -44,7 +44,7 @@
import org.axsl.font.FontUse;
import org.axsl.linebreak.LineBreakControl;
import org.axsl.linebreak.OutputLine;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.junit.Assert;
import org.junit.Before;
@@ -79,10 +79,10 @@
/**
* Setup the test.
* @throws IOException For errors creating the URLs to the various resources.
- * @throws HyphenationException For errors creating a hyphenation server.
+ * @throws OrthographyException For errors creating a hyphenation server.
*/
@Before
- public void setup() throws IOException, HyphenationException {
+ public void setup() throws IOException, OrthographyException {
final HyphenationServerConfig config = LbTestUtilities.createHyphenationServerConfig();
final HyphenationServer4a hyphenationServer = new HyphenationServer4a(config);
this.hyphenationConsumer = hyphenationServer.makeConsumer();
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -38,7 +38,7 @@
import org.axsl.common.i18n.Orthography;
import org.axsl.common.para.ParaConfig;
-import org.axsl.orthography.HyphenationConsumer;
+import org.axsl.orthography.OrthographyConsumer;
import org.axsl.orthography.Word;
import org.slf4j.Logger;
@@ -49,7 +49,7 @@
/**
* FOray implementation of {@link HyphenationConsumer}.
*/
-public class HyphenationConsumer4a implements HyphenationConsumer {
+public class HyphenationConsumer4a implements OrthographyConsumer {
/** The logger. */
private Logger logger = LoggerFactory.getLogger(this.getClass());
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -30,7 +30,7 @@
import org.foray.common.resource.ResourceLocation;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import java.io.InputStream;
@@ -72,7 +72,7 @@
final PatternTree patternTree = new PatternTree();
try {
patternTree.loadPatterns(inputStream, getLogger());
- } catch (final HyphenationException e) {
+ } catch (final OrthographyException e) {
getLogger().info("Error parsing: " + this.unparsedPatternsLocation.getLocationDescription(), e);
}
return patternTree;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -42,8 +42,8 @@
import org.axsl.common.i18n.Language;
import org.axsl.common.i18n.Orthography;
-import org.axsl.orthography.HyphenationException;
-import org.axsl.orthography.HyphenationServer;
+import org.axsl.orthography.OrthographyException;
+import org.axsl.orthography.OrthographyServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,10 +63,10 @@
/**
* This class is the main entry point to the hyphenation package.
*/
-public class HyphenationServer4a implements HyphenationServer {
+public class HyphenationServer4a implements OrthographyServer {
/** The logger. */
- private Logger logger = LoggerFactory.getLogger(HyphenationServer.class);
+ private Logger logger = LoggerFactory.getLogger(HyphenationServer4a.class);
/** The configuration for this server. */
private HyphenationServerConfig config;
@@ -90,18 +90,18 @@
/**
* Constructor.
* @param config The configuration for this server.
- * @throws HyphenationException For errors parsing configuration.
+ * @throws OrthographyException For errors parsing configuration.
*/
- public HyphenationServer4a(final HyphenationServerConfig config) throws HyphenationException {
+ public HyphenationServer4a(final HyphenationServerConfig config) throws OrthographyException {
this.config = config;
if (config.getOrthographyConfigurationLocation() == null) {
- throw new HyphenationException("Orthography configuration location has not been provided");
+ throw new OrthographyException("Orthography configuration location has not been provided");
} else {
InputStream inputStream = null;
try {
inputStream = config.getOrthographyConfigurationLocation().openStream();
} catch (final IOException e) {
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
}
final InputSource inputSource = new InputSource(inputStream);
@@ -135,7 +135,7 @@
}
try {
nl = this.parseNaturalLanguage(iso639.getAlpha3Code());
- } catch (final HyphenationException e) {
+ } catch (final OrthographyException e) {
this.logger.error(e.getMessage());
return null;
}
@@ -175,10 +175,10 @@
* @param languageCode The language code of the language to be parsed.
* @return The parsed NaturalLanguage instance, if it can be found, or null
* otherwise.
- * @throws HyphenationException For errors finding or parsing the files.
+ * @throws OrthographyException For errors finding or parsing the files.
*/
private NaturalLanguage parseNaturalLanguage(final String languageCode)
- throws HyphenationException {
+ throws OrthographyException {
final URL naturalLanguageDir = this.config.getNaturalLanguagesBaseDirectory();
final String filePrefix = languageCode + "-language";
if (naturalLanguageDir == null) {
@@ -197,7 +197,7 @@
} catch (final MalformedURLException e) {
/* This probably means that the hyphenation URL is not valid.
* Rethrow the exception to alert the user. */
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
}
InputStream inputStream = null;
@@ -216,9 +216,9 @@
nl = (NaturalLanguage) ois.readObject();
return nl;
} catch (final IOException e) {
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
} catch (final ClassNotFoundException e) {
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
} finally {
if (ois != null) {
try {
@@ -240,7 +240,7 @@
} catch (final MalformedURLException e) {
/* This probably means that the hyphenation URL is not valid.
* Rethrow the exception to alert the user. */
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
}
/* Does the XML file exist? */
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyResource.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyResource.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyResource.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -30,7 +30,7 @@
import org.foray.common.resource.ResourceLocation;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -112,7 +112,7 @@
/**
* Load a resource into memory from a serialized resource or from an external raw data file.
* @return The specified resource if it exists as a serialized object or as an external file, or null otherwise.
- * @throws HyphenationException For errors finding, deserializing, or parsing the resource files.
+ * @throws OrthographyException For errors finding, deserializing, or parsing the resource files.
*/
private T loadUncachedResource() {
/* If it is available as an already-parsed resource in our classpath, return it. */
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternConsumer.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternConsumer.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternConsumer.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -33,7 +33,7 @@
package org.foray.orthography;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
/**
* Implementations of this interface take the information parsed by a
@@ -125,11 +125,11 @@
* @param pre The "pre" portion of the special exception.
* @param post The "post" portion of the special exception.
* @param no The "no" portion of the special exception.
- * @throws HyphenationException If {@code exceptionWord} is not found
+ * @throws OrthographyException If {@code exceptionWord} is not found
* in the exception words.
*/
void addMorphException(String exceptionWord, String pre, String post,
- String no) throws HyphenationException;
+ String no) throws OrthographyException;
/**
* Add a Liang-style hyphenation pattern.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternParser.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternParser.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -36,7 +36,7 @@
import org.foray.common.ForayConstants;
import org.foray.common.xml.SaxParser;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -93,9 +93,9 @@
/**
* Constructor.
* @param consumer The pattern consumer implementation that will accept the data created by this parser.
- * @throws HyphenationException For errors during construction.
+ * @throws OrthographyException For errors during construction.
*/
- public PatternParser(final PatternConsumer consumer) throws HyphenationException {
+ public PatternParser(final PatternConsumer consumer) throws OrthographyException {
if (consumer == null) {
throw new NullPointerException("PatternConsumer may not be null.");
}
@@ -103,7 +103,7 @@
try {
this.parser = SaxParser.createSax2Parser();
} catch (final SAXException | ParserConfigurationException e) {
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
}
this.parser.setContentHandler(this);
this.parser.setErrorHandler(this);
@@ -113,9 +113,9 @@
/**
* Parses a given URL, using the PatternConsumer to consume the data retrieved during the parse.
* @param url The URL to parse.
- * @throws HyphenationException For errors during parsing.
+ * @throws OrthographyException For errors during parsing.
*/
- public void parse(final URL url) throws HyphenationException {
+ public void parse(final URL url) throws OrthographyException {
InputStream inputStream = null;
try {
inputStream = url.openStream();
@@ -133,19 +133,19 @@
/**
* Parses a given input stream, using the PatternConsumer to consume the data retrieved during the parse.
* @param inputStream The input stream to parse.
- * @throws HyphenationException For errors during parsing.
+ * @throws OrthographyException For errors during parsing.
*/
- public void parse(final InputStream inputStream) throws HyphenationException {
+ public void parse(final InputStream inputStream) throws OrthographyException {
final InputSource uri = new InputSource(inputStream);
try {
this.parser.parse(uri);
} catch (final SAXException e) {
- throw new HyphenationException(this.errMsg);
+ throw new OrthographyException(this.errMsg);
} catch (final IOException e) {
- throw new HyphenationException(e.getMessage());
+ throw new OrthographyException(e.getMessage());
} catch (final NullPointerException e) {
- throw new HyphenationException("SAX parser not available");
+ throw new OrthographyException("SAX parser not available");
}
}
@@ -219,7 +219,7 @@
this.consumer.addMorphException(attrs.getValue("no"),
attrs.getValue("pre"), attrs.getValue("post"),
attrs.getValue("no"));
- } catch (final HyphenationException e) {
+ } catch (final OrthographyException e) {
this.error(new SAXParseException("", null, e));
}
this.currElement = PatternParser.ELEM_HYPHEN;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternSerializer.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternSerializer.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternSerializer.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -31,7 +31,7 @@
import org.foray.common.ForayConstants;
import org.foray.common.IoUtil;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
@@ -125,7 +125,7 @@
try {
final URL url = infile.toURI().toURL();
hTree.loadPatterns(url.openStream(), getLogger());
- } catch (final HyphenationException ex) {
+ } catch (final OrthographyException ex) {
getLogger().error("Can't load patterns from xml file " + infile + " - Maybe hyphenation.dtd is missing?");
getLogger().error(ex.toString());
} catch (final MalformedURLException e) {
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternTree.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternTree.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternTree.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -38,7 +38,7 @@
import org.foray.common.primitive.BitUtils;
import org.foray.common.primitive.StringUtils;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.slf4j.Logger;
@@ -177,9 +177,9 @@
* Read hyphenation patterns from an XML file.
* @param inputStream The input stream containing the XML file containing the patterns.
* @param logger A logger for user messages.
- * @throws HyphenationException For errors obtaining a parser or errors during the parsing.
+ * @throws OrthographyException For errors obtaining a parser or errors during the parsing.
*/
- void loadPatterns(final InputStream inputStream, final Logger logger) throws HyphenationException {
+ void loadPatterns(final InputStream inputStream, final Logger logger) throws OrthographyException {
this.source = PatternTree.Source.PARSED;
final PatternParser pp = new PatternParser(this);
this.tempInterletterValues = new TernaryTree();
@@ -296,10 +296,10 @@
* @param k The size to which the arrays should be trimmed.
* @param qtyMorphExceptions The number of morph exceptions which will be added to the created hyphenation instance.
* @return The new Hyphenation instance.
- * @throws HyphenationException For invalid qtyMorphExceptions.
+ * @throws OrthographyException For invalid qtyMorphExceptions.
*/
private StringWord createHyphenation(final String theWord, final byte[] points, final byte[] values, final int k,
- final int qtyMorphExceptions) throws HyphenationException {
+ final int qtyMorphExceptions) throws OrthographyException {
if (k > 0) {
/* Trim result array and create the hyphenation instance. */
final byte[] returnPoints = new byte[k];
@@ -387,7 +387,7 @@
}
try {
return createHyphenation(normalizedWord, result, values, k, 0);
- } catch (final HyphenationException e) {
+ } catch (final OrthographyException e) {
/* Ignore this. It is assumed to be impossible to catch this
* Exception, because we are passing qtyMorphExceptions of zero. */
}
@@ -485,7 +485,7 @@
@Override
public void addMorphException(final String exceptionWord, final String pre,
- final String post, final String no) throws HyphenationException {
+ final String post, final String no) throws OrthographyException {
/* Implement this. */
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -48,7 +48,7 @@
import org.foray.orthography.WordWrapperFactory;
import org.axsl.orthography.DerivativeType;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.axsl.orthography.PartOfSpeech;
import org.axsl.orthography.PosQualifier;
@@ -183,9 +183,9 @@
/**
* Parses the configuration file.
- * @throws HyphenationException For errors during parsing.
+ * @throws OrthographyException For errors during parsing.
*/
- public void start() throws HyphenationException {
+ public void start() throws OrthographyException {
final XMLReader parser = createParser();
/* Turn on validation if it is available. */
try {
@@ -202,12 +202,12 @@
try {
parser.parse(this.filename);
} catch (final SAXException e) {
- if (e.getException() instanceof HyphenationException) {
- throw (HyphenationException) e.getException();
+ if (e.getException() instanceof OrthographyException) {
+ throw (OrthographyException) e.getException();
}
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
} catch (final IOException e) {
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
}
}
@@ -214,9 +214,9 @@
/**
* Creates a SAX parser for parsing the configuration file.
* @return The created SAX parser.
- * @throws HyphenationException For errors creating or configuring the parser.
+ * @throws OrthographyException For errors creating or configuring the parser.
*/
- private XMLReader createParser() throws HyphenationException {
+ private XMLReader createParser() throws OrthographyException {
try {
final SAXParserFactory spf =
javax.xml.parsers.SAXParserFactory.newInstance();
@@ -228,9 +228,9 @@
xmlReader.getClass().getName());
return xmlReader;
} catch (final javax.xml.parsers.ParserConfigurationException e) {
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
} catch (final org.xml.sax.SAXException e) {
- throw new HyphenationException(e);
+ throw new OrthographyException(e);
}
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -38,7 +38,7 @@
import org.foray.common.primitive.UnicodeCharUtils;
import org.foray.common.xml.SaxParser;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -103,10 +103,10 @@
* Parses a given URL, creating a new NaturalLanguage instance for the
* contents.
* @param url The URL to parse.
- * @throws HyphenationException For errors during parsing.
+ * @throws OrthographyException For errors during parsing.
* @return The newly-parsed NaturalLanguage instance.
*/
- public NaturalLanguage parse(final URL url) throws HyphenationException {
+ public NaturalLanguage parse(final URL url) throws OrthographyException {
InputStream inputStream = null;
try {
inputStream = url.openStream();
@@ -124,11 +124,11 @@
try {
this.parser.parse(uri);
} catch (final SAXException e) {
- throw new HyphenationException(this.errMsg);
+ throw new OrthographyException(this.errMsg);
} catch (final IOException e) {
- throw new HyphenationException(e.getMessage());
+ throw new OrthographyException(e.getMessage());
} catch (final NullPointerException e) {
- throw new HyphenationException("SAX parser not available");
+ throw new OrthographyException("SAX parser not available");
}
return this.nl;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -42,7 +42,7 @@
import org.axsl.common.i18n.Orthography;
import org.axsl.orthography.Dictionary;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
@@ -185,7 +185,7 @@
* @param adhocDictionaryPaths (optional) List of paths to ad-hoc dictionaries to be used by the spell-checker.
* This is useful for cases where a document has words that are not found in standard dictionaries.
* This can be null.
- * @throws HyphenationException For errors during configuration of the hyphenation server.
+ * @throws OrthographyException For errors during configuration of the hyphenation server.
* @throws IOException For input/output errors during parsing.
* @throws ParserConfigurationException For errors configuring the parser.
* @throws SAXException For errors found by the SAX parser.
@@ -192,7 +192,7 @@
*/
public SpellChecker(final InputSource input, final PrintStream output, final URL orthographyConfigPath,
final List<URL> adhocDictionaryPaths)
- throws HyphenationException, IOException, SAXException, ParserConfigurationException {
+ throws OrthographyException, IOException, SAXException, ParserConfigurationException {
this.input = input;
this.output = output;
@@ -554,7 +554,7 @@
final SpellChecker checker = new SpellChecker(inputSource, output, orthographyConfigPath, dictionaries);
checker.start();
- } catch (final HyphenationException | IOException | SAXException | ParserConfigurationException e) {
+ } catch (final OrthographyException | IOException | SAXException | ParserConfigurationException e) {
logger.error("Error configuring or running: " + input, e);
/* CheckStyle: Allow System.exit() in main method. */
System.exit(SpellChecker.STATUS_PARSING_ERROR);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -34,7 +34,7 @@
import org.foray.orthography.HyphenationServerConfig;
import org.axsl.common.i18n.Language;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.apache.xml.resolver.CatalogManager;
import org.apache.xml.resolver.tools.CatalogResolver;
@@ -384,7 +384,7 @@
HyphenationServer4a server = null;
try {
server = new HyphenationServer4a(config);
- } catch (final HyphenationException e) {
+ } catch (final OrthographyException e) {
logger.error(e.getMessage(), e);
/* CheckStyle: Allow System.exit() in main method. */
System.exit(ValidateChars.STATUS_FILE_NOT_FOUND);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -35,7 +35,7 @@
import org.foray.orthography.SegmentDictionary;
import org.axsl.orthography.Dictionary;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
@@ -101,7 +101,7 @@
* @param adhocDictionaryPaths (optional) List of paths to ad-hoc dictionaries to be used by the spell-checker.
* This is useful for cases where a document has words that are not found in standard dictionaries.
* This can be null.
- * @throws HyphenationException For errors during configuration of the hyphenation server.
+ * @throws OrthographyException For errors during configuration of the hyphenation server.
* @throws IOException For input/output errors during parsing.
* @throws ParserConfigurationException For errors configuring the parser.
* @throws SAXException For errors found by the SAX parser.
@@ -108,7 +108,7 @@
*/
public WordChecker(final BufferedReader input, final PrintStream output, final URL orthographyConfigPath,
final List<URL> adhocDictionaryPaths)
- throws HyphenationException, IOException, SAXException, ParserConfigurationException {
+ throws OrthographyException, IOException, SAXException, ParserConfigurationException {
this.input = input;
this.output = output;
@@ -218,7 +218,7 @@
final URL orthographyConfigPath = new URL(config);
final WordChecker checker = new WordChecker(reader, System.out, orthographyConfigPath, dictionaries);
checker.start();
- } catch (IOException | HyphenationException | SAXException | ParserConfigurationException e) {
+ } catch (IOException | OrthographyException | SAXException | ParserConfigurationException e) {
logger.error("File cannot be opened for input: " + input, e);
/* CheckStyle: Allow System.exit() in main method. */
System.exit(WordChecker.STATUS_FILE_NOT_FOUND);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java 2021-11-11 17:09:24 UTC (rev 12032)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java 2021-11-11 20:32:48 UTC (rev 12033)
@@ -37,7 +37,7 @@
import org.foray.common.primitive.NumberUtils;
import org.foray.common.primitive.StringUtils;
-import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.OrthographyException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
@@ -275,12 +275,12 @@
* @param patout The output stream to which the patterns should be written.
* @param stdoutProxy The print stream which serves as a proxy for stdout.
* It can be, but does not have to be, the actual stdout.
- * @throws HyphenationException If {@code dictionary} is null, or if {@code output} is null.
+ * @throws OrthographyException If {@code dictionary} is null, or if {@code output} is null.
* @see "patgen.web, line 93"
*/
public PatGen(final String dictionary, final String patterns, final String translate, final String patout,
final PrintStream stdoutProxy)
- throws HyphenationException {
+ throws OrthographyException {
this.dictionaryPath = dictionary;
this.patternsPath = patterns;
this.translatePath = translate;
@@ -287,10 +287,10 @@
this.patoutPath = patout;
this.stdoutProxy = stdoutProxy;
if (this.dictionaryPath == null) {
- throw new HyphenationException("Dictionary cannot be null.");
+ throw new OrthographyException("Dictionary cannot be null.");
}
if (this.patoutPath == null) {
- throw new HyphenationException("Output cannot be null.");
+ throw new OrthographyException("Output cannot be null.");
}
}
@@ -297,10 +297,10 @@
/**
* Initializes the various data structures.
* This procedure gets things started properly.
- * @throws HyphenationException If the configured constants exceed predefined thresholds.
+ * @throws OrthographyException If the configured constants exceed predefined thresholds.
* @see "patgen.web, line 98"
*/
- private void initialize() throws HyphenationException {
+ private void initialize() throws OrthographyException {
printLn(BANNER);
setInitialValuesPart1();
setInitialValuesPart2();
@@ -476,10 +476,10 @@
* @param message The specifics of what has overflowed.
* @param capacity The capacity of the item that has overflowed.
* @see "patgen.web, line 256"
- * @throws HyphenationException Always, as that is the purpose of this method.
+ * @throws OrthographyException Always, as that is the purpose of this method.
*/
- private void overflow(final String message, final int capacity) throws HyphenationException {
- throw new HyphenationException("PatGen capacity exceeded: " + message
+ private void overflow(final String message, final int capacity) throws OrthographyException {
+ throw new OrthographyException("PatGen capacity exceeded: " + message
+ " (" + capacity + ").");
}
@@ -574,10 +574,10 @@
*
* Here we check that the definitions of |ASCII_code| and
* |packed_ASCII_code| are consistent with those of |si| and |so|.
- * @throws HyphenationException For inconsistent initialization values.
+ * @throws OrthographyException For inconsistent initialization values.
* @see "patgen.web, line 313"
*/
- private void setInitialValuesPart1() throws HyphenationException {
+ private void setInitialValuesPart1() throws OrthographyException {
int bad = 0;
/* Following line must be comment out because the java compiler treats it all as dead code. */
@@ -590,7 +590,7 @@
}
bad = checkConstantValueConsistency(bad);
if (bad > 0) {
- throw new HyphenationException("Bad constants---case " + bad);
+ throw new OrthographyException("Bad constants---case " + bad);
}
}
@@ -740,9 +740,9 @@
* @param c The character for which an ASCII value is needed.
* @return The ASCII code corresponding to {@code c}.
* @see "patgen.web, line 392"
- * @throws HyphenationException If the capacity has been exceeded.
+ * @throws OrthographyException If the capacity has been exceeded.
*/
- private char getASCII(final char c) throws HyphenationException {
+ private char getASCII(final char c) throws OrthographyException {
char i = this.xord[c];
if (i == 0) {
boolean found = false;
@@ -1352,10 +1352,10 @@
* transitions) we don't bother and instead just pack it immediately to the
* right of the occupied region (starting at |triemax+1|).
* @return The pointer to the location of the trie node.
- * @throws HyphenationException If the capacity of the pattern trie nodes has been exceeded.
+ * @throws OrthographyException If the capacity of the pattern trie nodes has been exceeded.
* @see "patgen.web, line 711"
*/
- private int firstfit() throws HyphenationException {
+ private int firstfit() throws OrthographyException {
final int s = computeTrieBaseLocation();
/* Pack it. */
for (int q = 1; q <= this.qmax; q++) {
@@ -1381,10 +1381,10 @@
* set to 7 on subsequent levels because the pattern trie will be sparser
* after bad patterns are deleted (see |delete_bad_patterns|).
* @return The value to be used for "s", or -1 if no base location is found.
- * @throws HyphenationException If the capacity of the pattern trie nodes has been exceeded.
+ * @throws OrthographyException If the capacity of the pattern trie nodes has been exceeded.
* @see "patgen.web, line 738"
*/
- private int computeTrieBaseLocation() throws HyphenationException {
+ private int computeTrieBaseLocation() throws OrthographyException {
int t = 0;
if (this.qmax > this.qmaxthresh) {
t = this.trier[this.triemax + 1];
@@ -1412,10 +1412,10 @@
* far as necessary. Here we extend the initialization if necessary, and
* check for overflow.
* @param s The trie base location at which this state should be packed.
- * @throws HyphenationException If the capacity of the pattern trie nodes has been exceeded.
+ * @throws OrthographyException If the capacity of the pattern trie nodes has been exceeded.
* @see "patgen.web, line 754"
*/
- private void ensureTrieLinked(final int s) throws HyphenationException {
+ private void ensureTrieLinked(final int s) throws OrthographyException {
if (s > PatGen.TRIE_SIZE - PatGen.NUM_ASCII_CODES) {
overflow("pattern trie nodes", PatGen.TRIE_SIZE);
}
@@ -1473,11 +1473,11 @@
* @param d The hyphen position.
* @param n The next output.
* @return The opcode for the output.
- * @throws HyphenationException For an overflow condition in {@link #maxOps}.
+ * @throws OrthographyException For an overflow condition in {@link #maxOps}.
* @see "patgen.web, line 795"
* @see "The Art of Computer Programming, Second Edition, vol. 3, pp. 517-518."
*/
- private int newtrieop(final int v, final int d, final int n) throws HyphenationException {
+ private int newtrieop(final int v, final int d, final int n) throws OrthographyException {
/* Trial hash location. */
int h = ((n + PatGen.HASH_CONSTANT_1 * d + PatGen.HASH_CONSTANT_2 * v) % this.maxOps) + 1;
while (true) {
@@ -1525,11 +1525,11 @@
* a new output.
* @param val The hyphenation value.
* @param dot The hyphen position.
- * @throws HyphenationException For an overflow condition in {@link #maxOps} or if the capacity of the pattern trie
+ * @throws OrthographyException For an overflow condition in {@link #maxOps} or if the capacity of the pattern trie
* nodes is exceeded.
* @see "patgen.web, line 823"
*/
- private void insertpattern(final int val, final int dot) throws HyphenationException {
+ private void insertpattern(final int val, final int dot) throws OrthographyException {
int i = 1;
int s = this.trieroot + this.pat[i];
int t = this.triel[s];
@@ -1565,10 +1565,10 @@
* @param s The sub-trie to be packed??
* @param t The index into the pattern trie??
* @return The new value for {@code t}
- * @throws HyphenationException If the capacity of the pattern trie nodes has been exceeded.
+ * @throws OrthographyException If the capacity of the pattern trie nodes has been exceeded.
* @see "patgen.web, line 849"
*/
- private int insertCriticalTransition(final int i, final int s, final int t) throws HyphenationException {
+ private int insertCriticalTransition(final int i, final int s, final int t) throws OrthographyException {
int returnT = t;
if (this.triec[t] == 0) {
/* We're lucky, no repacking needed. */
@@ -1670,11 +1670,11 @@
/**
* Same as {@link #firstfit()}, but operates on the pattern count trie.
* @return The pointer to the location of the trie node.
- * @throws HyphenationException For overflow of the pattern count trie.
+ * @throws OrthographyException For overflow of the pattern count trie.
* @see #firstfit()
* @see "patgen.web, line 909"
*/
- private int firstcfit() throws HyphenationException {
+ private int firstcfit() throws OrthographyException {
int a;
final int b = computeTriecBaseLocation();
for (char q = 1; q <= this.qmax; q++) {
@@ -1696,10 +1696,10 @@
* The threshold for attempting a first-fit packing is 3 transitions, which
* is lower than for the pattern trie because speed is more important here.
* @return The value to be used for "b", or -1 if no base location is found.
- * @throws HyphenationException For overflows in data structures.
+ * @throws OrthographyException For overflows in data structures.
* @see "patgen.web, line 929"
*/
- private int computeTriecBaseLocation() throws HyphenationException {
+ private int computeTrie...
[truncated message content] |
|
From: <vic...@us...> - 2021-11-11 17:09:36
|
Revision: 12032
http://sourceforge.net/p/foray/code/12032
Author: victormote
Date: 2021-11-11 17:09:24 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Rename namespace org.foray.hyphen to org.foray.orthography.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionarySorter.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NaturalLanguage.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordListCreator.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/package-info.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/package-info.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/package-info.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/util/WordListTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/CapitalizedWordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/ExactWordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPast1WordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural1WordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural2WordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive1WordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive2WordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/UppercaseWordTests.java
trunk/foray/master/config/checkstyle/checkstyle-suppressions.xml
Added Paths:
-----------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/AmbiguousWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativePattern.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativeRule.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionaryResource.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionarySerializer.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServerConfig.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Interword4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/MutatingWord4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyConfig4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyResource.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternConsumer.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternGenerator.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternSerializer.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PatternTree.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/PosUtils.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Punctuation4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionary.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/SegmentDictionaryWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegment.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentLatin1Factory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/StringWordSegmentUtf16Factory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Whitespace4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Word4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreaker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerDefault.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordBreakerLatin1.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegment4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordSegmentWrapper.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapper.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/WordWrapperFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/package-info.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/TrailingModifiedWordSegment.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/DerivativeRuleTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationConsumer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/HyphenationServer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/Interword4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PatternTreeTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/PosUtilsTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/SegmentDictionaryWordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/StringWordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordBreakerLatin1Tests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/WordWrapperTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/util/
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/util/NaturalLanguageTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPast1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural2WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive2WordFactoryTests.java
Removed Paths:
-------------
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/DictionaryParserXml.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/NatLangParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/ValidateChars.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/WordChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/CapitalizedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/DecoratedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/ExactWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/FinalSegmentModifiedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPast1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPlural2WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/LatinPossessive2WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/SuffixedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/TrailingModifiedWordSegment.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/wrapper/UppercaseWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/zzarchive/PatGen.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/util/NaturalLanguageTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPast1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPlural2WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/wrapper/LatinPossessive2WordFactoryTests.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-11-11 16:55:17 UTC (rev 12031)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -36,7 +36,7 @@
import org.foray.font.FontServer4a;
import org.foray.fotree.FoTreeServer4a;
import org.foray.graphic.GraphicServer4a;
-import org.foray.hyphen.HyphenationServerConfig;
+import org.foray.orthography.HyphenationServerConfig;
import org.foray.pioneer.PioneerFactory;
import org.foray.ps.PsServer4a;
import org.foray.speech.SpeechServer4a;
@@ -175,7 +175,7 @@
config.setNaturalLanguagesBaseDirectory(configuration.optionNaturalLanguageBaseDirectory());
try {
- return new org.foray.hyphen.HyphenationServer4a(config);
+ return new org.foray.orthography.HyphenationServer4a(config);
} catch (final HyphenationException e) {
throw new ForayException(e);
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-11 16:55:17 UTC (rev 12031)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -31,7 +31,7 @@
import org.foray.common.Environment;
import org.foray.common.sequence.IntArrayBuilder;
import org.foray.font.util.MockFont;
-import org.foray.hyphen.HyphenationServerConfig;
+import org.foray.orthography.HyphenationServerConfig;
import org.axsl.font.Font;
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-11 16:55:17 UTC (rev 12031)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -32,10 +32,10 @@
import org.foray.common.i18n.Orthography4a;
import org.foray.common.para.ParaBranch4a;
import org.foray.common.para.ParaConfig4a;
-import org.foray.hyphen.HyphenationConsumer4a;
-import org.foray.hyphen.HyphenationServer4a;
-import org.foray.hyphen.HyphenationServerConfig;
-import org.foray.hyphen.StringWord;
+import org.foray.orthography.HyphenationConsumer4a;
+import org.foray.orthography.HyphenationServer4a;
+import org.foray.orthography.HyphenationServerConfig;
+import org.foray.orthography.StringWord;
import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaConfig;
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/AmbiguousWord.java (from rev 12031, trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/AmbiguousWord.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/AmbiguousWord.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/AmbiguousWord.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2021 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;
+
+import org.foray.common.primitive.CharSequenceUtils;
+
+import org.axsl.orthography.PartOfSpeech;
+
+/**
+ * Container for words that are spelled the same, but that have different hyphenation, depending on part-of-speech.
+ * @param <T> The type of words being stored in this instance.
+ */
+public class AmbiguousWord<T extends Word4a> {
+
+ /** The array of word alternatives. */
+ private T[] alternatives;
+
+ /**
+ * Constructor.
+ * @param alternatives The words that are ambiguous.
+ * @throws IllegalArgumentException For {@code alternatives} that is null, has less than 2 alternatives, or that
+ * contains alternatives that are not, in fact, ambiguous.
+ */
+ public AmbiguousWord(final T[] alternatives) {
+ if (alternatives == null
+ || alternatives.length < 2) {
+ throw new IllegalArgumentException("AmbiguousWord must contain at least two alternatives.");
+ }
+
+ /* Ensure that the alternatives are, in fact, ambiguous. */
+ final CharSequence base = alternatives[0].getActualContent();
+ for (int index = 1; index < alternatives.length; index ++) {
+ final T word = alternatives[index];
+ if (! CharSequenceUtils.areEquivalent(base, word.getActualContent())) {
+ throw new IllegalArgumentException("Word not ambiguous at index: " + index);
+ }
+ }
+ this.alternatives = alternatives;
+ }
+
+ public int length() {
+ return this.alternatives.length;
+ }
+
+ public T getAlternative(final int index) {
+ return this.alternatives[index];
+ }
+
+ /**
+ * Returns the "best" choice of the alternatives, depending on how much information is given for disambiguation.
+ * @param pos The part of speech of the desired word.
+ * This can be null.
+ * @return The first alternative matching {@code pos}, or the first alternative if {@code pos} is null or not
+ * matched.
+ */
+ public T getBest(final PartOfSpeech pos) {
+ if (pos == null) {
+ return this.alternatives[0];
+ }
+ for (int index = 0; index < this.alternatives.length; index ++) {
+ final T word = alternatives[index];
+ if (word.isOfType(pos)) {
+ return word;
+ }
+ }
+ return this.alternatives[0];
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativePattern.java (from rev 12031, trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativePattern.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativePattern.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativePattern.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2021 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;
+
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.Word;
+
+import java.util.List;
+import java.util.regex.Pattern;
+
+/**
+ * A pattern, attached to an orthography, that specifies one possible way that the root of a given word can be found,
+ * and how that affects hyphenation.
+ *
+ * Instances of this class are immutable.
+ */
+public class DerivativePattern {
+
+ /** The regex pattern to which input words must "match". */
+ private Pattern match;
+
+ /** The regex replacement string to obtain a possible root. */
+ private String replace;
+
+ /** The rules that apply to this pattern. */
+ private List<DerivativeRule> rules;
+
+ /**
+ * Constructor.
+ * @param match The regex pattern to which input words must "match".
+ * @param replace The regex replacement string to obtain a possible root.
+ * @param rules The rules that apply to this pattern.
+ */
+ public DerivativePattern(final Pattern match, final String replace, final List<DerivativeRule> rules) {
+ /* Pattern is immutable. */
+ this.match = match;
+ /* String is immutable. */
+ this.replace = replace;
+ this.rules = rules;
+ }
+
+ /**
+ * Indicates whether this pattern matches a given input.
+ * @param inputWord The word being tested.
+ * @return True if and only if this pattern matches {@code inputWord}.
+ */
+ public boolean doesPatternMatch(final CharSequence inputWord) {
+ return this.match.matcher(inputWord).matches();
+ }
+
+ /**
+ * Applies the match and replace patterns to an input word, and returns the computed root of that input word if the
+ * rule applies.
+ * @param inputWord The input word being tested.
+ * @return The root, if any, indicated by this rule, for {@code inputWord}, or null if there is no match.
+ */
+ public CharSequence getRoot(final CharSequence inputWord) {
+ if (doesPatternMatch(inputWord)) {
+ return inputWord.toString().replaceAll(this.match.pattern(), replace);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the number of derivative rules that are attached to this pattern.
+ * @return The number of derivative rules that are attached to this pattern.
+ */
+ public int qtyRules() {
+ return this.rules.size();
+ }
+
+ /**
+ * Returns the rule at a given index.
+ * @param index The index to the rule to be returned.
+ * @return The rule at index {@code index}.
+ */
+ public DerivativeRule getRule(final int index) {
+ return this.rules.get(index);
+ }
+
+ /**
+ * Checks the rules that are attached to this pattern, and returns the first one that matches.
+ * @param word The word to be tested.
+ * @return The first rule in the pattern that matches {@code word}, or null if none match.
+ */
+ public DerivativeRule findFirstApplicableRule(final Word word) {
+ for (int index = 0; index < this.rules.size(); index ++) {
+ final DerivativeRule rule = this.rules.get(index);
+ if (rule.matches(word)) {
+ return rule;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Finds the first rule from this pattern, if any, that applies to a given word.
+ * @param wordChars The word to be tested.
+ * @param dictionary The dictionary in which the root of {@code wordChars} will be sought.
+ * @return The first rule from this pattern, that applies to {@code wordChars}, or null if the pattern does not
+ * match or the rules do not apply.
+ */
+ public DerivativeRule findFirstApplicableRule(final CharSequence wordChars, final Dictionary dictionary) {
+ if (! doesPatternMatch(wordChars)) {
+ return null;
+ }
+ final String root = getRoot(wordChars).toString();
+ if (root == null) {
+ return null;
+ }
+
+ final int qtyAlternatives = dictionary.qtyAlternatives(root);
+ for (int index = 0; index < qtyAlternatives; index ++) {
+ final Word word = dictionary.getWord(root, index);
+ if (word != null) {
+ final DerivativeRule rule = findFirstApplicableRule(word);
+ if (rule != null) {
+ return rule;
+ }
+ }
+ }
+ return null;
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativeRule.java (from rev 12031, trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativeRule.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativeRule.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DerivativeRule.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2021 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;
+
+import org.axsl.orthography.DerivativeType;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
+import org.axsl.orthography.Word;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * One derivative rule that can be used to find the root of a derived word.
+ */
+public class DerivativeRule {
+
+ /** The part of speech to which the root must belong. */
+ private PartOfSpeech rootPos;
+
+ /** The qualifier that must be true for {@link #rootPos} for this rule to apply. */
+ private PosQualifier qualifier;
+
+ /** The (unmodifiable) list of derivative types which this rule applies.
+ * In other words, if this rule applies, identifies the types of derivative that the derivative could be. */
+ private List<DerivativeType> types;
+
+ public DerivativeRule(final PartOfSpeech rootPos, final PosQualifier qualifier, final List<DerivativeType> types) {
+ this.rootPos = rootPos;
+ this.qualifier = qualifier;
+ final List<DerivativeType> defensiveCopy = new ArrayList<DerivativeType>(types.size());
+ Collections.copy(types, defensiveCopy);
+ this.types = Collections.unmodifiableList(defensiveCopy);
+ }
+
+ /**
+ * Indicates whether a given word matches the criteria for this rule.
+ * @param word The word to be tested.
+ * @return True if and only if {@code word} meets the criteria for this rule.
+ */
+ public boolean matches(final Word word) {
+ if (! word.isOfType(this.rootPos)) {
+ return false;
+ }
+ return word.isOfQualifiedType(this.rootPos, this.qualifier);
+ }
+
+ /**
+ * Returns the (unmodifiable) list of derivative types which this rule applies.
+ * @return The list of derivative types which this rule applies.
+ */
+ public List<DerivativeType> getTypes() {
+ return this.types;
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionaryResource.java (from rev 12029, trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DictionaryResource.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionaryResource.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionaryResource.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2019 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;
+
+import org.foray.common.resource.ResourceLocation;
+import org.foray.common.resource.ResourceLocationUrl;
+import org.foray.orthography.util.DictionaryParserXml;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+/**
+ * Configuration information for a dictionary resource.
+ */
+public class DictionaryResource extends OrthographyResource<SegmentDictionary> {
+
+ /**
+ * One classpath or URL resource that is an element in the dictionary construction.
+ */
+ public class WordListElement {
+
+ /** The location of the element. */
+ private ResourceLocation location;
+
+ /** The list of exclusion patterns for this element. */
+ private List<Pattern> exclusionPatterns = new ArrayList<Pattern>();
+
+ /**
+ * Returns the location.
+ * @return the location.
+ */
+ public ResourceLocation getLocation() {
+ return this.location;
+ }
+
+ /**
+ * Sets the location.
+ * @param location The location to set.
+ */
+ public void setLocation(final ResourceLocation location) {
+ this.location = location;
+ }
+
+ /**
+ * Adds an exclusion pattern to the list of exclusion patterns for this element.
+ * @param exclusionPattern The pattern to add.
+ */
+ public void addExclusionPattern(final Pattern exclusionPattern) {
+ this.exclusionPatterns.add(exclusionPattern);
+ }
+
+ /**
+ * Returns the list of exclusion patterns for this element.
+ * @return The list of exclusion patterns for this element.
+ */
+ public List<Pattern> getExclusionPatterns() {
+ return this.exclusionPatterns;
+ }
+
+ }
+
+ /** The elements to be parsed to create the dictionary. This can be null or empty. */
+ private List<WordListElement> unparsedWordList = new ArrayList<WordListElement>();
+
+ /**
+ * Constructor.
+ * @param id The id of this resource.
+ */
+ public DictionaryResource(final String id) {
+ super(id);
+ }
+
+ @Override
+ public String getTypeDescription() {
+ return "SegmentDictionary";
+ }
+
+ @Override
+ protected SegmentDictionary parseResource() {
+ URL rawResource = null;
+// for (int index = 0; index < this.unparsedWordList.size(); index ++) {
+// final WordListElement element = this.unparsedWordList.get(index);
+// if (element.path.url != null) {
+// rawResource = element.path.url;
+// }
+// }
+
+ /* TODO: This is an ugly interim fix. */
+ final ResourceLocationUrl location = (ResourceLocationUrl) this.unparsedWordList.get(0).getLocation();
+ rawResource = location.getUrl();
+
+ /* Does the word list file exist? */
+ InputStream inputStream = null;
+ try {
+ inputStream = rawResource.openStream();
+ } catch (final IOException e) {
+ /* The word list file does not exist. Do not try to parse it. */
+ getLogger().info("{} URL resource not found: {}", this.getTypeDescription(), rawResource.toExternalForm());
+ return null;
+ }
+
+ getLogger().debug("Parsing {}", rawResource.toExternalForm());
+ final DictionaryParserXml parser = new DictionaryParserXml();
+ parser.setLogDictionaryProblems(true);
+ SegmentDictionary dictionary = null;
+ try {
+ final InputSource source = new InputSource(inputStream);
+ dictionary = parser.parse(source, location.getLocationDescription()).get(0);
+ } catch (final IOException e) {
+ getLogger().error("IOException", e);
+ return null;
+ } catch (final SAXException e) {
+ getLogger().error("SAXException", e);
+ return null;
+ } catch (final ParserConfigurationException e) {
+ getLogger().error("ParserConfigurationException", e);
+ return null;
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (final IOException e) {
+ /* Ignore. */
+ }
+ }
+ }
+
+ return dictionary;
+ }
+
+ /**
+ * Add an element to the word list components.
+ * @param element The element to be added.
+ */
+ public void addWordListElement(final WordListElement element) {
+ this.unparsedWordList.add(element);
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionarySerializer.java (from rev 12029, trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DictionarySerializer.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionarySerializer.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/DictionarySerializer.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2019 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;
+
+import org.foray.common.ForayConstants;
+import org.foray.common.IoUtil;
+import org.foray.orthography.util.DictionaryParser;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.io.filefilter.IOFileFilter;
+import org.apache.commons.io.filefilter.RegexFileFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+
+/**
+ * Parse and serialize dictionary objects so that they can be packaged for runtime use without the need to parse them
+ * then.
+ */
+public class DictionarySerializer {
+
+ /** The directory containing the patterns to be parsed. */
+ private File sourceDir;
+
+ /** Filter to be applied to files in {@link #sourceDir} to determine which files should be processed. */
+ private IOFileFilter fileFilter;
+
+ /** The directory in which the serialized output should be placed. */
+ private File targetDir;
+
+ /** The logger. */
+ private Logger logger = LoggerFactory.getLogger(DictionarySerializer.class);;
+
+ /**
+ * Constructor.
+ * @param sourceDir The directory containing the files to be processed.
+ * @param fileFilter The filter, if any, that should be applied to the files in @code{sourceDir}.
+ * This can be null.
+ * @param targetDir The directory into which the output files should be written.
+ * @throws IOException For invalid @code{sourceDir} or @code{targetDir}.
+ */
+ public DictionarySerializer(final File sourceDir, final IOFileFilter fileFilter, final File targetDir)
+ throws IOException {
+ if (! sourceDir.exists()
+ || ! sourceDir.isDirectory()) {
+ throw new IOException("Source directory does not exist or is not a directory: "
+ + sourceDir.getAbsolutePath());
+ }
+ if (targetDir.exists()) {
+ if (! targetDir.isDirectory()) {
+ throw new IOException("Specified target is not a directory: " + targetDir.getAbsolutePath());
+ }
+ } else {
+ targetDir.mkdirs();
+ }
+
+ this.sourceDir = sourceDir;
+ this.fileFilter = fileFilter;
+ this.targetDir = targetDir;
+ }
+
+ /**
+ * Serialize the selected files.
+ */
+ public void process() {
+ final String[] filesToProcess = this.sourceDir.list(this.fileFilter);
+ for (int i = 0; i < filesToProcess.length; i++) {
+ final String filename = filesToProcess[i];
+ final File infile = new File(this.sourceDir, filename);
+ final String baseFilename = IoUtil.baseFileName(filesToProcess[i]);
+ final File outfile = new File(this.targetDir, baseFilename + "."
+ + ForayConstants.BINARY_SERIALIZATION_EXTENSION);
+ buildDictionary(infile, outfile);
+ }
+ }
+
+ /**
+ * Parses an input file, creates a {@link SegmentDictionary} instance for it, and then serializes the instance to an
+ * output file.
+ * @param infile The input file (word list).
+ * @param outfile The output file (serialized POJO).
+ */
+ private void buildDictionary(final File infile, final File outfile) {
+ this.logger.info("Processing " + infile);
+ final DictionaryParser parser = new DictionaryParser();
+ SegmentDictionary dictionary = null;
+
+ /* Parse the dictionary. */
+ try {
+ final InputStream inputStream = infile.toURI().toURL().openStream();
+ dictionary = parser.parse(inputStream, infile.getAbsolutePath());
+ } catch (final IOException e) {
+ this.logger.error(e.getMessage());
+ }
+
+ /* Serialize the dictionary. */
+ ObjectOutputStream out = null;
+ try {
+ out = new ObjectOutputStream(new FileOutputStream(outfile));
+ out.writeObject(dictionary);
+ } catch (final IOException ioe) {
+ this.logger.error("Can't write compiled dictionary file: " + outfile);
+ this.logger.error(ioe.toString());
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (final IOException e) {
+ /* Ignore. */
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the command-line options for the {@link #main(String[])} method.
+ * @return Command-line options.
+ */
+ static Options getCommandLineOptions() {
+ final Options clOptions = new Options();
+
+ /* Input directory. */
+ final Option inputDir = new Option("i", "input", true, "path to the input directory");
+ inputDir.setRequired(true);
+ inputDir.setArgName("input-dir");
+ clOptions.addOption(inputDir);
+
+ /* Output directory. */
+ final Option outputDir = new Option("o", "output", true, "path to the output directory");
+ outputDir.setRequired(true);
+ outputDir.setArgName("output-dir");
+ clOptions.addOption(outputDir);
+
+ /* Include pattern. */
+ final Option includePattern = new Option("p", "pattern", true,
+ "input include pattern (regex)");
+ includePattern.setRequired(true);
+ includePattern.setArgName("pattern-regex");
+ clOptions.addOption(includePattern);
+
+ return clOptions;
+ }
+
+ /**
+ * Parses a command-line.
+ * @param commandLineOptions The command-line options controlling the parsing.
+ * @param args The command-line arguments to be parsed.
+ * @return The results of the parsing.
+ * @throws ParseException For errors in {@code args}.
+ */
+ public static CommandLine parseCommandLine(final Options commandLineOptions, final String[] args)
+ throws ParseException {
+ final CommandLineParser commandLineParser = new DefaultParser();
+ final CommandLine parsedCommandLine = commandLineParser.parse(commandLineOptions, args);
+
+ return parsedCommandLine;
+ }
+
+ /**
+ * Command-line interface.
+ * @param args The command-line arguments.
+ */
+ public static void main(final String[] args) {
+ final Logger logger = LoggerFactory.getLogger(DictionarySerializer.class);
+ final Options commandLineOptions = DictionarySerializer.getCommandLineOptions();
+ CommandLine parsedCommandLine = null;
+ try {
+ parsedCommandLine = DictionarySerializer.parseCommandLine(commandLineOptions, args);
+ } catch (final ParseException e) {
+ logger.error(e.getMessage(), e);
+ final HelpFormatter helpFormatter = new HelpFormatter();
+ helpFormatter.printHelp("java -cp $FORAY_CLASSPATH " + DictionarySerializer.class.getName(),
+ commandLineOptions, true);
+ /* CheckStyle: Allow System.exit() in main method. */
+ System.exit(1);
+ }
+
+ final String inputDirString = parsedCommandLine.getOptionValue("input");
+ final String outputDirString = parsedCommandLine.getOptionValue("output");
+ final String includePattern = parsedCommandLine.getOptionValue("pattern");
+
+ final File inputDir = new File(inputDirString);
+ final File outputDir = new File(outputDirString);
+ final RegexFileFilter fileFilter = new RegexFileFilter(includePattern);
+
+ try {
+ final DictionarySerializer serializer = new DictionarySerializer(inputDir, fileFilter, outputDir);
+ serializer.process();
+ } catch (final IOException e) {
+ logger.error(e.getMessage(), e);
+ /* CheckStyle: Allow System.exit() in main method. */
+ System.exit(1);
+ }
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java (from rev 12031, trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationConsumer4a.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -0,0 +1,186 @@
+/*
+ * Copyright 2016 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;
+
+import org.foray.common.para.ParaBranch4a;
+import org.foray.common.primitive.CharSequenceUtils;
+import org.foray.common.primitive.CharacterUtils;
+import org.foray.common.primitive.NumberUtils;
+import org.foray.orthography.wrapper.CapitalizedWord;
+import org.foray.orthography.wrapper.ExactWord;
+import org.foray.orthography.wrapper.UppercaseWord;
+
+import org.axsl.common.i18n.Orthography;
+import org.axsl.common.para.ParaConfig;
+import org.axsl.orthography.HyphenationConsumer;
+import org.axsl.orthography.Word;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+/**
+ * FOray implementation of {@link HyphenationConsumer}.
+ */
+public class HyphenationConsumer4a implements HyphenationConsumer {
+
+ /** The logger. */
+ private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ /** The parent server. */
+ private HyphenationServer4a server;
+
+ /**
+ * Constructor.
+ * @param server The parent server.
+ */
+ public HyphenationConsumer4a(final HyphenationServer4a server) {
+ this.server = server;
+ }
+
+ @Override
+ public Word hyphenate(final CharSequence word, final int offset, final int length, final Orthography orthography) {
+ final OrthographyConfig4a orthographyConfig = this.server.getOrthographyConfig(orthography);
+ if (orthographyConfig == null) {
+ this.logger.warn("Configuration not found for orthography {}", orthography.toString());
+ return null;
+ }
+
+ /* The character sequence containing the characters in the word that we are looking for. */
+ final CharSequence chars = word.subSequence(offset, offset + length);
+ Word hyphenatedWord = null;
+
+ /* Look in the dictionary first, as it should be more accurate. */
+ final SegmentDictionary dictionary = orthographyConfig.getDictionary();
+ if (dictionary != null) {
+ hyphenatedWord = dictionary.getWord(chars.toString().toLowerCase(), 0);
+ if (hyphenatedWord == null) {
+ hyphenatedWord = orthographyConfig.findDerivatives(chars);
+ }
+ }
+
+
+ if (hyphenatedWord == null) {
+ /* The word was not found in the dictionary. Try the hyphenation patterns. */
+ final PatternTree patternTree = orthographyConfig.getHyphenationPatterns();
+ if (patternTree == null) {
+ return null;
+ }
+ hyphenatedWord = patternTree.hyphenate(chars, 0, length);
+ }
+
+ if (hyphenatedWord == null) {
+ return null;
+ }
+
+ final boolean capitalized = CharSequenceUtils.equalToCapitalized(hyphenatedWord.getNormalizedContent(), chars);
+ if (capitalized) {
+ return new CapitalizedWord(hyphenatedWord);
+ }
+ final boolean uppercase = CharSequenceUtils.equalToUppercase(hyphenatedWord.getNormalizedContent(), chars);
+ if (uppercase) {
+ return new UppercaseWord(hyphenatedWord);
+ }
+
+ if (CharSequenceUtils.hasAnyUppercase(chars)) {
+ /* There is unexpected capitalization. */
+ return new ExactWord(hyphenatedWord, chars.toString());
+ }
+
+ return hyphenatedWord;
+ }
+
+ @Override
+ public List<Word> getUnexpectedWords() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the parent server.
+ * @return The parent server.
+ */
+ public HyphenationServer4a getServer() {
+ return this.server;
+ }
+
+ @Override
+ public ParaBranch4a parseWordSequence(final CharSequence characters, final int startIndex, final int length,
+ final ParaConfig paraConfig) {
+ final ParaBranch4a wordSequence = new ParaBranch4a(paraConfig);
+ final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
+ final OrthographyConfig4a orthographyConfig = this.server.getOrthographyConfig(paraConfig.getOrthography());
+ if (orthographyConfig == null) {
+ this.logger.error("Orthography not configured for: " + paraConfig.getOrthography());
+ }
+ final WordBreaker wordBreaker = orthographyConfig.getWordBreaker();
+ final List<CharSequence> chunks = wordBreaker.breakIntoWords(sequence);
+
+ for (int chunkIndex = 0; chunkIndex < chunks.size(); chunkIndex ++) {
+ final CharSequence chunk = chunks.get(chunkIndex);
+ if (chunk.length() < 1) {
+ continue;
+ }
+ final boolean isChunkIndexOdd = NumberUtils.isOdd(chunkIndex);
+ if (isChunkIndexOdd) {
+ /* Chunk is interword content. */
+ parseInterwordContent(wordSequence, chunk);
+ } else {
+ /* Chunk is a word. */
+ Word word = hyphenate(chunk, 0, chunk.length(), paraConfig.getOrthography());
+ if (word == null) {
+ word = new StringWord(0, chunk);
+ }
+ wordSequence.add(word);
+ }
+ }
+ return wordSequence;
+ }
+
+ private void parseInterwordContent(final ParaBranch4a wordSequence, final CharSequence interword) {
+ int index = 0;
+ while (index < interword.length()) {
+ if (CharacterUtils.isPunctuation(interword.charAt(index))) {
+ final Punctuation4a punctuation = Punctuation4a.findInstance(interword.subSequence(index, index + 1));
+ wordSequence.add(punctuation);
+ index ++;
+ } else if (Character.isWhitespace(interword.charAt(index))) {
+ final Whitespace4a whitespace = Whitespace4a.findInstance(interword.subSequence(index, index + 1));
+ wordSequence.add(whitespace);
+ index ++;
+ } else {
+ final Interword4a unknown = Interword4a.findInstance(interword.subSequence(index, index + 1));
+ wordSequence.add(unknown);
+ index ++;
+ }
+ }
+
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java (from rev 12031, trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationPatternsResource.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationPatternsResource.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2019 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;
+
+import org.foray.common.resource.ResourceLocation;
+
+import org.axsl.orthography.HyphenationException;
+
+import java.io.InputStream;
+
+/**
+ * Configuration information for a hyphenation patterns resource.
+ */
+public class HyphenationPatternsResource extends OrthographyResource<PatternTree> {
+
+ /** The location of the raw hyphenation patterns that can be parsed to obtain a resource. This can be null. */
+ private ResourceLocation unparsedPatternsLocation;
+
+ /**
+ * Constructor.
+ * @param id The id of this resource.
+ */
+ public HyphenationPatternsResource(final String id) {
+ super(id);
+ }
+
+
+ @Override
+ public String getTypeDescription() {
+ return "Hyphenation Pattern";
+ }
+
+ @Override
+ protected PatternTree parseResource() {
+ if (this.unparsedPatternsLocation == null) {
+ return null;
+ }
+
+ /* Does the XML file exist? */
+ final InputStream inputStream = this.unparsedPatternsLocation.getInputStream();
+ if (inputStream == null) {
+ return null;
+ }
+
+ getLogger().debug("Parsing {}", this.unparsedPatternsLocation.getLocationDescription());
+ final PatternTree patternTree = new PatternTree();
+ try {
+ patternTree.loadPatterns(inputStream, getLogger());
+ } catch (final HyphenationException e) {
+ getLogger().info("Error parsing: " + this.unparsedPatternsLocation.getLocationDescription(), e);
+ }
+ return patternTree;
+ }
+
+ /**
+ * Sets the location of the unparsed patterns file.
+ * @param unparsedLocation The location of the unparsed patterns file.
+ */
+ public void setUnparsedLocation(final ResourceLocation unparsedLocation) {
+ this.unparsedPatternsLocation = unparsedLocation;
+ }
+
+}
Copied: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java (from rev 12031, trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationServer4a.java)
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java (rev 0)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/HyphenationServer4a.java 2021-11-11 17:09:24 UTC (rev 12032)
@@ -0,0 +1,344 @@
+/*
+ * Copyright 2004 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$
+ */
+
+/*
+ * Known contributors:
+ * @author Carlos Villegas <ca...@un...> (original author)
+ */
+
+package org.foray.orthography;
+
+import org.foray.common.ForayConstants;
+import org.foray.common.i18n.Language4a;
+import org.foray.common.url.UrlFactory;
+import org.foray.orthography.util.ConfigParser;
+import org.foray.orthography.util.NatLangParser;
+import org.foray.orthography.util.NaturalLanguage;
+
+import org.axsl.common.i18n.Language;
+import org.axsl.common.i18n.Orthography;
+import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.HyphenationServer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * This class is the main entry point to the hyphenation package.
+ */
+public class HyphenationServer4a implements HyphenationServer {
+
+ /** The logger. */
+ private Logger logger = LoggerFactory.getLogger(HyphenationServer.class);
+
+ /** The configuration for this server. */
+ private HyphenationServerConfig config;
+
+ /** Map of all Natural Language instances. */
+ private Map<Language, NaturalLanguage> languages = new HashMap<Language, NaturalLanguage>();
+
+ /** An EntityResolver to be used by XML parsers (for handling DTD catalogs, etc.). */
+ private EntityResolver entityResolver = null;
+
+ /** Map of orthographies and their configurations to be used by this server. */
+ private Map<Orthography, OrthographyConfig4a> orthographyConfigurations =
+ new HashMap<Orthography, OrthographyConfig4a>();
+
+ /** The map of match rule lists, keyed by id. */
+ private Map<String, List<Pattern>> matchRuleLists = new HashMap<String, List<Pattern>>();
+
+ /** The map of derivative rule lists, keyed by id. */
+ private Map<String, List<DerivativePattern>> derivativeRuleLists = new HashMap<String, List<DerivativePattern>>();
+
+ /**
+ * Constructor.
+ * @param config The configuration for this server.
+ * @throws HyphenationException For errors parsing configuration.
+ */
+ public HyphenationServer4a(final HyphenationServerConfig config) throws HyphenationException {
+ this.config = config;
+ if (config.getOrthographyConfigurationLocation() == null) {
+ ...
[truncated message content] |
|
From: <vic...@us...> - 2021-11-11 16:55:21
|
Revision: 12031
http://sourceforge.net/p/foray/code/12031
Author: victormote
Date: 2021-11-11 16:55:17 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Conform to aXSL renaming of namespace from org.axsl.hyphen to org.axsl.orthography.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoInterword.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java
trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java
trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/AmbiguousWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativePattern.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativeRule.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationPatternsResource.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationServer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Interword4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/OrthographyConfig4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/OrthographyResource.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternConsumer.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternSerializer.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternTree.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PosUtils.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Punctuation4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/SegmentDictionary.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/SegmentDictionaryWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegment.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegmentLatin1.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegmentUtf16.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Whitespace4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Word4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordSegment4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordSegmentWrapper.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordWrapper.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordWrapperFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/ConfigParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/DictionaryParserXml.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/NatLangParser.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/SpellChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/ValidateChars.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/WordChecker.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/CapitalizedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/DecoratedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/ExactWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/FinalSegmentModifiedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPast1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2Word.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/SuffixedWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/TrailingModifiedWordSegment.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/UppercaseWord.java
trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/zzarchive/PatGen.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/HyphenationConsumer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/HyphenationServer4aTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/PatternTreeTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/PosUtilsTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/StringWordTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/WordWrapperTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/util/NaturalLanguageTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/wrapper/LatinPlural1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/wrapper/LatinPlural2WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactoryTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactoryTests.java
Modified: trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
===================================================================
--- trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -46,9 +46,9 @@
import org.axsl.font.FontException;
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.hyphen.HyphenationException;
-import org.axsl.hyphen.HyphenationServer;
import org.axsl.layout.LayoutFactory;
+import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.HyphenationServer;
import org.axsl.ps.PsServer;
import org.axsl.speech.SpeechServer;
import org.axsl.text.TextServer;
Modified: trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java
===================================================================
--- trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-app/src/test/java/org/foray/app/fo/FoDocumentReader.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -40,7 +40,7 @@
import org.axsl.font.FontConsumer;
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.hyphen.HyphenationServer;
+import org.axsl.orthography.HyphenationServer;
import org.axsl.text.TextServer;
import org.slf4j.Logger;
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/ForaySession.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -33,8 +33,8 @@
import org.axsl.fo.FoTreeFactory;
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.hyphen.HyphenationServer;
import org.axsl.layout.LayoutFactory;
+import org.axsl.orthography.HyphenationServer;
import org.axsl.speech.SpeechServer;
import org.axsl.text.TextServer;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoObj.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -134,7 +134,7 @@
import org.axsl.font.FontUse;
import org.axsl.graphic.Graphic;
import org.axsl.graphic.GraphicServer;
-import org.axsl.hyphen.HyphenationConsumer;
+import org.axsl.orthography.HyphenationConsumer;
import org.axsl.speech.SpeechException;
import org.axsl.speech.SpeechServer;
import org.axsl.speech.Voice;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeBuilder.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -42,7 +42,7 @@
import org.axsl.fo.FoTreeListener;
import org.axsl.font.FontConsumer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.hyphen.HyphenationConsumer;
+import org.axsl.orthography.HyphenationConsumer;
import org.axsl.speech.SpeechServer;
import org.axsl.text.TextServer;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/FoTreeServer4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -39,7 +39,7 @@
import org.axsl.fo.FoTreeFactory;
import org.axsl.font.FontServer;
import org.axsl.graphic.GraphicServer;
-import org.axsl.hyphen.HyphenationServer;
+import org.axsl.orthography.HyphenationServer;
import org.axsl.text.TextServer;
import org.slf4j.Logger;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoInterword.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoInterword.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoInterword.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,7 +31,7 @@
import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.TextTransform;
import org.axsl.common.value.WhiteSpaceTreatment;
-import org.axsl.hyphen.Interword;
+import org.axsl.orthography.Interword;
/**
* Fo wrapper around an interword.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,7 +31,7 @@
import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.TextTransform;
import org.axsl.common.value.WhiteSpaceTreatment;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Word;
/**
* Fo wrapper around a word.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequence.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -37,7 +37,7 @@
import org.axsl.common.value.TextTransform;
import org.axsl.common.value.WhiteSpaceTreatment;
import org.axsl.fo.FoContext;
-import org.axsl.hyphen.HyphenationConsumer;
+import org.axsl.orthography.HyphenationConsumer;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/FoWordSequenceContent.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -32,10 +32,10 @@
import org.axsl.common.value.LinefeedTreatment;
import org.axsl.common.value.TextTransform;
import org.axsl.common.value.WhiteSpaceTreatment;
-import org.axsl.hyphen.Interword;
-import org.axsl.hyphen.Punctuation;
-import org.axsl.hyphen.Whitespace;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Interword;
+import org.axsl.orthography.Punctuation;
+import org.axsl.orthography.Whitespace;
+import org.axsl.orthography.Word;
/**
* Abstract superclass for the content of an Fo Word Sequence.
Modified: trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java
===================================================================
--- trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-fotree/src/main/java/org/foray/fotree/fo/obj/Root.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -39,7 +39,7 @@
import org.axsl.fo.FoTreeException;
import org.axsl.fo.ProxyFactory;
import org.axsl.font.FontUse;
-import org.axsl.hyphen.HyphenationConsumer;
+import org.axsl.orthography.HyphenationConsumer;
import org.slf4j.Logger;
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/TextServer4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,8 +31,8 @@
import org.foray.text.line.solitary.SolitaryLineBreaker;
import org.axsl.font.FontConsumer;
-import org.axsl.hyphen.HyphenationServer;
import org.axsl.linebreak.LineBreakControl;
+import org.axsl.orthography.HyphenationServer;
import org.axsl.text.line.EagerLineBreaker;
import org.axsl.text.line.LineBreakHandler;
import org.axsl.text.line.PatientLineBreaker;
Modified: trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java
===================================================================
--- trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-linebreak/src/main/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -34,11 +34,11 @@
import org.axsl.common.i18n.Orthography;
import org.axsl.font.FontConsumer;
-import org.axsl.hyphen.HyphenationConsumer;
-import org.axsl.hyphen.HyphenationException;
-import org.axsl.hyphen.HyphenationServer;
-import org.axsl.hyphen.Word;
import org.axsl.linebreak.LineBreakControl;
+import org.axsl.orthography.HyphenationConsumer;
+import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.HyphenationServer;
+import org.axsl.orthography.Word;
import org.axsl.text.TextException;
import org.axsl.text.line.LineBreakHandler;
import org.axsl.text.line.LineText;
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/TotalFitLbTests.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -42,9 +42,9 @@
import org.axsl.common.para.ParaControl;
import org.axsl.font.Font;
import org.axsl.font.FontUse;
-import org.axsl.hyphen.HyphenationException;
import org.axsl.linebreak.LineBreakControl;
import org.axsl.linebreak.OutputLine;
+import org.axsl.orthography.HyphenationException;
import org.junit.Assert;
import org.junit.Before;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/AmbiguousWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/AmbiguousWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/AmbiguousWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,7 +30,7 @@
import org.foray.common.primitive.CharSequenceUtils;
-import org.axsl.hyphen.PartOfSpeech;
+import org.axsl.orthography.PartOfSpeech;
/**
* Container for words that are spelled the same, but that have different hyphenation, depending on part-of-speech.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativePattern.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativePattern.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativePattern.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,8 +28,8 @@
package org.foray.hyphen;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.Word;
import java.util.List;
import java.util.regex.Pattern;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativeRule.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativeRule.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/DerivativeRule.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,10 +28,10 @@
package org.foray.hyphen;
-import org.axsl.hyphen.DerivativeType;
-import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.PosQualifier;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.DerivativeType;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
+import org.axsl.orthography.Word;
import java.util.ArrayList;
import java.util.Collections;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -38,8 +38,8 @@
import org.axsl.common.i18n.Orthography;
import org.axsl.common.para.ParaConfig;
-import org.axsl.hyphen.HyphenationConsumer;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.HyphenationConsumer;
+import org.axsl.orthography.Word;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationPatternsResource.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationPatternsResource.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationPatternsResource.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,7 +30,7 @@
import org.foray.common.resource.ResourceLocation;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import java.io.InputStream;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationServer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationServer4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/HyphenationServer4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -42,8 +42,8 @@
import org.axsl.common.i18n.Language;
import org.axsl.common.i18n.Orthography;
-import org.axsl.hyphen.HyphenationException;
-import org.axsl.hyphen.HyphenationServer;
+import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.HyphenationServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Interword4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Interword4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Interword4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -38,7 +38,7 @@
import org.axsl.common.para.ParaConfig;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
-import org.axsl.hyphen.Interword;
+import org.axsl.orthography.Interword;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/OrthographyConfig4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/OrthographyConfig4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/OrthographyConfig4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,10 +31,10 @@
import org.foray.common.primitive.BooleanUtils;
import org.foray.common.primitive.CharSequenceUtils;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.OrthographyConfig;
-import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.OrthographyConfig;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.Word;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/OrthographyResource.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/OrthographyResource.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/OrthographyResource.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,7 +30,7 @@
import org.foray.common.resource.ResourceLocation;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternConsumer.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternConsumer.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternConsumer.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -33,7 +33,7 @@
package org.foray.hyphen;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
/**
* Implementations of this interface take the information parsed by a
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternParser.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternParser.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -36,7 +36,7 @@
import org.foray.common.ForayConstants;
import org.foray.common.xml.SaxParser;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternSerializer.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternSerializer.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternSerializer.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,7 +31,7 @@
import org.foray.common.ForayConstants;
import org.foray.common.IoUtil;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternTree.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternTree.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PatternTree.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -38,7 +38,7 @@
import org.foray.common.primitive.BitUtils;
import org.foray.common.primitive.StringUtils;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.slf4j.Logger;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PosUtils.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PosUtils.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/PosUtils.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,8 +28,8 @@
package org.foray.hyphen;
-import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.PosQualifier;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
import org.xml.sax.Attributes;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Punctuation4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Punctuation4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Punctuation4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -37,7 +37,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
-import org.axsl.hyphen.Punctuation;
+import org.axsl.orthography.Punctuation;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/SegmentDictionary.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,9 +30,9 @@
import org.foray.common.data.TernaryTreeMap;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.PosQualifier;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
import java.util.Arrays;
import java.util.HashMap;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/SegmentDictionaryWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/SegmentDictionaryWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/SegmentDictionaryWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,10 +28,10 @@
package org.foray.hyphen;
-import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.PosQualifier;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* A word whose internal character data is stored in a dictionary instead of in an instance of this class.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,8 +30,8 @@
import org.foray.common.primitive.CharSequenceUtils;
-import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.PosQualifier;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
/**
* A word implementation that wraps a set of {@link StringWordSegmentUtf16}, a thin wrapper around a {@link String}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegment.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegment.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegment.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -29,7 +29,7 @@
package org.foray.hyphen;
import org.axsl.common.para.ParaLeaf;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.WordSegment;
/**
* Interface for classes that word segments made up of string or string-like entities.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegmentLatin1.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegmentLatin1.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegmentLatin1.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -37,7 +37,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.WordSegment;
/**
* Implementation of {@link WordSegment} that simply wraps a char array.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegmentUtf16.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegmentUtf16.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/StringWordSegmentUtf16.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -37,7 +37,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.WordSegment;
/**
* Implementation of {@link WordSegment} that simply wraps a char array.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Whitespace4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Whitespace4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Whitespace4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -37,7 +37,7 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.para.ParaPenalty;
-import org.axsl.hyphen.Whitespace;
+import org.axsl.orthography.Whitespace;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Word4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Word4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/Word4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -38,8 +38,8 @@
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
import org.axsl.common.sequence.ByteSequence;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
import java.io.Serializable;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordSegment4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordSegment4a.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordSegment4a.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -35,7 +35,7 @@
import org.axsl.common.para.ParaGlue;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaPenalty;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.WordSegment;
import java.io.Serializable;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordSegmentWrapper.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordSegmentWrapper.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordSegmentWrapper.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,7 +28,7 @@
package org.foray.hyphen;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.WordSegment;
/**
* Superclass for word segment wrappers.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordWrapper.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordWrapper.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordWrapper.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,10 +28,10 @@
package org.foray.hyphen;
-import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.PosQualifier;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Decorates a normalized word with some additional data.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordWrapperFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordWrapperFactory.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/WordWrapperFactory.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,8 +28,8 @@
package org.foray.hyphen;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.WordFactory;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.WordFactory;
/**
* Factory that knows how to create an instance of a {@link WordWrapper}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/ConfigParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/ConfigParser.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/ConfigParser.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -47,10 +47,10 @@
import org.foray.hyphen.WordBreaker;
import org.foray.hyphen.WordWrapperFactory;
-import org.axsl.hyphen.DerivativeType;
-import org.axsl.hyphen.HyphenationException;
-import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.PosQualifier;
+import org.axsl.orthography.DerivativeType;
+import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/DictionaryParserXml.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/DictionaryParserXml.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/DictionaryParserXml.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -41,7 +41,7 @@
import org.foray.hyphen.StringWordSegmentLatin1Factory;
import org.foray.hyphen.StringWordSegmentUtf16Factory;
-import org.axsl.hyphen.PartOfSpeech;
+import org.axsl.orthography.PartOfSpeech;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/NatLangParser.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/NatLangParser.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/NatLangParser.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -38,7 +38,7 @@
import org.foray.common.primitive.UnicodeCharUtils;
import org.foray.common.xml.SaxParser;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/SpellChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/SpellChecker.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/SpellChecker.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -41,8 +41,8 @@
import org.foray.hyphen.SegmentDictionary;
import org.axsl.common.i18n.Orthography;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.HyphenationException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/ValidateChars.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/ValidateChars.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/ValidateChars.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -34,7 +34,7 @@
import org.foray.hyphen.HyphenationServerConfig;
import org.axsl.common.i18n.Language;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.apache.xml.resolver.CatalogManager;
import org.apache.xml.resolver.tools.CatalogResolver;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/WordChecker.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/WordChecker.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/util/WordChecker.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -34,8 +34,8 @@
import org.foray.hyphen.OrthographyConfig4a;
import org.foray.hyphen.SegmentDictionary;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.HyphenationException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/CapitalizedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/CapitalizedWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/CapitalizedWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,8 +30,8 @@
import org.foray.hyphen.WordSegmentWrapper;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Decorates a normalized word by capitalizing it, that is, by making its first character uppercase.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/DecoratedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/DecoratedWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/DecoratedWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -35,7 +35,7 @@
import org.axsl.common.para.DiscretionaryHyphen;
import org.axsl.common.para.ParaLeaf;
import org.axsl.common.para.ParaNode;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Word;
/**
* Decorates a normalized word with some additional data.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/ExactWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/ExactWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/ExactWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -32,8 +32,8 @@
import org.foray.hyphen.StringWord;
import org.foray.hyphen.StringWordSegmentUtf16;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Decorates a normalized word with an exact representation of the actual capitalization.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/FinalSegmentModifiedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/FinalSegmentModifiedWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/FinalSegmentModifiedWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,8 +30,8 @@
import org.foray.hyphen.WordWrapper;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Abstract superclass for word wrappers that modify the final segment of the word.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPast1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPast1Word.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPast1Word.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,7 +30,7 @@
import org.foray.hyphen.StringWordSegmentUtf16;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Word;
/**
* Wraps a word, usually a verb, and adds a syllable "ed" to the end.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.hyphen.WordWrapperFactory;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.Word;
/**
* Factory class for {@link LatinPast1Word}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural1Word.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural1Word.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,8 +28,8 @@
package org.foray.hyphen.wrapper;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Wraps a singular word and adds the suffix "s" to make it plural.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.hyphen.WordWrapperFactory;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.Word;
/**
* Factory class for {@link LatinPlural1Word}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural2Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural2Word.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural2Word.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,8 +28,8 @@
package org.foray.hyphen.wrapper;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Wraps a singular word and replaces its last segment, ending in a consonant and a "y", with a segment that converts
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.hyphen.WordWrapperFactory;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.Word;
/**
* Factory class for {@link LatinPlural2Word}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1Word.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1Word.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,8 +28,8 @@
package org.foray.hyphen.wrapper;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Wraps a singular word and adds the suffix "’s" to make it possessive or a contraction.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.hyphen.WordWrapperFactory;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.Word;
/**
* Factory class for {@link LatinPossessive1Word}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2Word.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2Word.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2Word.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,8 +28,8 @@
package org.foray.hyphen.wrapper;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Wraps a singular word and adds the suffix "'s" to make it possessive or a contraction.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,8 +31,8 @@
import org.foray.common.primitive.CharSequenceUtils;
import org.foray.hyphen.WordWrapperFactory;
-import org.axsl.hyphen.Dictionary;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Dictionary;
+import org.axsl.orthography.Word;
/**
* Factory class for {@link LatinPossessive2Word}.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/SuffixedWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/SuffixedWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/SuffixedWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -31,8 +31,8 @@
import org.foray.hyphen.StringWordSegmentUtf16;
import org.foray.hyphen.WordWrapper;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Wraps a word that has a suffix attached.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/TrailingModifiedWordSegment.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/TrailingModifiedWordSegment.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/TrailingModifiedWordSegment.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,7 +30,7 @@
import org.foray.hyphen.WordSegmentWrapper;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.WordSegment;
/**
* Abstract superclass for word segment wrappers that modify the end of the wrapped word segment.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/UppercaseWord.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/UppercaseWord.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/wrapper/UppercaseWord.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,8 +30,8 @@
import org.foray.hyphen.WordSegmentWrapper;
-import org.axsl.hyphen.Word;
-import org.axsl.hyphen.WordSegment;
+import org.axsl.orthography.Word;
+import org.axsl.orthography.WordSegment;
/**
* Decorates a normalized word by making all of its characters uppercase.
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/zzarchive/PatGen.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/zzarchive/PatGen.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/hyphen/zzarchive/PatGen.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -37,7 +37,7 @@
import org.foray.common.primitive.NumberUtils;
import org.foray.common.primitive.StringUtils;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/HyphenationConsumer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/HyphenationConsumer4aTests.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/HyphenationConsumer4aTests.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -33,8 +33,8 @@
import org.foray.common.para.ParaConfig4a;
import org.axsl.common.para.ParaConfig;
-import org.axsl.hyphen.HyphenationException;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.HyphenationException;
+import org.axsl.orthography.Word;
import org.junit.Assert;
import org.junit.Before;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/HyphenationServer4aTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/HyphenationServer4aTests.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/HyphenationServer4aTests.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -32,7 +32,7 @@
import org.foray.common.i18n.Language4a;
import org.foray.common.i18n.Orthography4a;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.junit.Assert;
import org.junit.Before;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/PatternTreeTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/PatternTreeTests.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/PatternTreeTests.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,7 +30,7 @@
import org.foray.common.i18n.Orthography4a;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.junit.Assert;
import org.junit.BeforeClass;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/PosUtilsTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/PosUtilsTests.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/PosUtilsTests.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -28,8 +28,8 @@
package org.foray.hyphen;
-import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.PosQualifier;
+import org.axsl.orthography.PartOfSpeech;
+import org.axsl.orthography.PosQualifier;
import org.junit.Assert;
import org.junit.Test;
@@ -40,7 +40,7 @@
public class PosUtilsTests {
/**
- * Test of {@link PosUtils#encodePosInfo(char, org.axsl.hyphen.PartOfSpeech)} and related encoding methods.
+ * Test of {@link PosUtils#encodePosInfo(char, org.axsl.orthography.PartOfSpeech)} and related encoding methods.
*/
@Test
public void testEncoding() {
@@ -84,7 +84,7 @@
}
/**
- * Test of {@link PosUtils#encodePosInfo(char, org.axsl.hyphen.PartOfSpeech)}.
+ * Test of {@link PosUtils#encodePosInfo(char, org.axsl.orthography.PartOfSpeech)}.
*/
@Test
public void testOfOrInsteadOfAdd() {
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/StringWordTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/StringWordTests.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/StringWordTests.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -157,7 +157,7 @@
}
/**
- * Test of {@link StringWord#getSegmentStart(org.axsl.hyphen.Word, int)}.
+ * Test of {@link StringWord#getSegmentStart(org.axsl.orthography.Word, int)}.
*/
@Test
public void getSegmentStartTest01() {
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/WordWrapperTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/WordWrapperTests.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/WordWrapperTests.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,7 +30,7 @@
import org.axsl.common.para.DiscretionaryHyphen.Quality;
import org.axsl.common.para.ParaNode;
-import org.axsl.hyphen.Word;
+import org.axsl.orthography.Word;
import org.junit.Assert;
import org.junit.Before;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/util/NaturalLanguageTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/util/NaturalLanguageTests.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/util/NaturalLanguageTests.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -32,7 +32,7 @@
import org.foray.hyphen.HyphenationServer4a;
import org.foray.hyphen.HyphenationServer4aTests;
-import org.axsl.hyphen.HyphenationException;
+import org.axsl.orthography.HyphenationException;
import org.junit.Assert;
import org.junit.Test;
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java 2021-11-11 16:46:50 UTC (rev 12030)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java 2021-11-11 16:55:17 UTC (rev 12031)
@@ -30,7 +30,7 @@
import org.foray.hyphen.StringWordTests;
-import org.axsl.hyphen.Dictionary;
+import org.axsl.orthography.Dictionary;
import org.junit.Assert;
import org.junit.Before;
Modified: trunk/foray/foray-orthograp...
[truncated message content] |
|
From: <vic...@us...> - 2021-11-11 16:46:53
|
Revision: 12030
http://sourceforge.net/p/foray/code/12030
Author: victormote
Date: 2021-11-11 16:46:50 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Partial changes for moving foray-hyphen to foray-orthography.
Modified Paths:
--------------
trunk/foray/foray-app/build.gradle
trunk/foray/foray-linebreak/build.gradle
trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
trunk/foray/foray-orthography/build.gradle
trunk/foray/master/build.gradle
trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch
trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch
trunk/foray/master/settings.gradle
Modified: trunk/foray/foray-app/build.gradle
===================================================================
--- trunk/foray/foray-app/build.gradle 2021-11-11 16:08:31 UTC (rev 12029)
+++ trunk/foray/foray-app/build.gradle 2021-11-11 16:46:50 UTC (rev 12030)
@@ -15,9 +15,9 @@
api project(':foray-font')
api project(':foray-fotree')
api project(':foray-graphic')
- api project(':foray-hyphen')
api project(':foray-layout')
api project(':foray-mif')
+ api project(':foray-orthography')
api project(':foray-output')
api project(':foray-pdf')
api project(':foray-pioneer')
Modified: trunk/foray/foray-linebreak/build.gradle
===================================================================
--- trunk/foray/foray-linebreak/build.gradle 2021-11-11 16:08:31 UTC (rev 12029)
+++ trunk/foray/foray-linebreak/build.gradle 2021-11-11 16:46:50 UTC (rev 12030)
@@ -11,7 +11,7 @@
testImplementation group: 'org.mockito', name: 'mockito-core', version: mockitoVersion
// testImplementation group: 'org.hamcrest', name: 'hamcrest', version: hamcrestVersion
- testImplementation project(':foray-hyphen')
+ testImplementation project(':foray-orthography')
testImplementation project(':foray-font')
}
Modified: trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java
===================================================================
--- trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-11 16:08:31 UTC (rev 12029)
+++ trunk/foray/foray-linebreak/src/test/java/org/foray/linebreak/LbTestUtilities.java 2021-11-11 16:46:50 UTC (rev 12030)
@@ -143,10 +143,10 @@
final String orthographyConfigPath = foraySandbox + "/foray-hyphen/src/test/resources/orthography-config.xml";
final String wordListDirString = foraySandbox + "/foray-hyphen/src/main/data/word-lists/";
final String dictionaryDirString =
- foraySandbox + "/foray-hyphen/src/main/resources/resources/org/foray/hyphen/dictionaries/";
+ foraySandbox + "/foray-orthography/src/main/resources/resources/org/foray/hyphen/dictionaries/";
final String rawPatternsDirString = foraySandbox + "/foray-hyphen/src/main/data/hyph-patterns/";
final String serializedPatternsDirString =
- foraySandbox + "/foray-hyphen/src/main/resources/resources/org/foray/hyphen/dictionaries";
+ foraySandbox + "/foray-orthography/src/main/resources/resources/org/foray/hyphen/dictionaries";
final String naturalLanguageDirString = foraySandbox + "/foray-hyphen/src/main/data/natural-languages/";
final URL orthographyFile = new URL("file", null, orthographyConfigPath);
Modified: trunk/foray/foray-orthography/build.gradle
===================================================================
--- trunk/foray/foray-orthography/build.gradle 2021-11-11 16:08:31 UTC (rev 12029)
+++ trunk/foray/foray-orthography/build.gradle 2021-11-11 16:46:50 UTC (rev 12030)
@@ -1,4 +1,4 @@
-description = 'foray-hyphen'
+description = 'foray-orthography'
dependencies {
api group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
@@ -17,9 +17,9 @@
javadoc {
- options.windowTitle = "FOray Hyphenation API"
- options.docTitle = "FOray Hyphenation API"
- options.header = "FOray Hyphenation API ${version}"
+ options.windowTitle = "FOray Orthography API"
+ options.docTitle = "FOray Orthography API"
+ options.header = "FOray Orthography API ${version}"
}
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2021-11-11 16:08:31 UTC (rev 12029)
+++ trunk/foray/master/build.gradle 2021-11-11 16:46:50 UTC (rev 12030)
@@ -230,7 +230,7 @@
options.groups.put('The FOray Graphic Module', ['org.foray.graphic', 'org.foray.graphic.*' ])
options.groups.put('The FOray Font Module', ['org.foray.font', 'org.foray.font.*' ])
options.groups.put('The FOray Speech Module', ['org.foray.speech', 'org.foray.speech.*' ])
- options.groups.put('The FOray Hyphenation Module', ['org.foray.hyphen', 'org.foray.hyphen.*' ])
+ options.groups.put('The FOray Orthography Module', ['org.foray.orthography', 'org.foray.orthography.*' ])
options.groups.put('The FOray LineBreak Module', ['org.foray.text', 'org.foray.text.*',
'org.foray.linebreak'])
options.groups.put('The FOray Area Tree Module', ['org.foray.area', 'org.foray.area.*' ])
Modified: trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch
===================================================================
--- trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2021-11-11 16:08:31 UTC (rev 12029)
+++ trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2021-11-11 16:46:50 UTC (rev 12030)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
- <listEntry value="/foray-hyphen/src/main/java/org/foray/hyphen/DictionarySerializer.java"/>
+ <listEntry value="/foray-orthography/src/main/java/org/foray/hyphen/DictionarySerializer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
Modified: trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch
===================================================================
--- trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch 2021-11-11 16:08:31 UTC (rev 12029)
+++ trunk/foray/master/ide/eclipse/launch-configurations/PatternSerializer.launch 2021-11-11 16:46:50 UTC (rev 12030)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
- <listEntry value="/foray-hyphen/src/main/java/org/foray/hyphen/PatternSerializer.java"/>
+ <listEntry value="/foray-orthography/src/main/java/org/foray/hyphen/PatternSerializer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
Modified: trunk/foray/master/settings.gradle
===================================================================
--- trunk/foray/master/settings.gradle 2021-11-11 16:08:31 UTC (rev 12029)
+++ trunk/foray/master/settings.gradle 2021-11-11 16:46:50 UTC (rev 12030)
@@ -7,10 +7,10 @@
includeFlat 'foray-font'
includeFlat 'foray-fotree'
includeFlat 'foray-graphic'
-includeFlat 'foray-hyphen'
includeFlat 'foray-layout'
includeFlat 'foray-linebreak'
includeFlat 'foray-mif'
+includeFlat 'foray-orthography'
includeFlat 'foray-output'
includeFlat 'foray-pdf'
includeFlat 'foray-pioneer'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 16:08:33
|
Revision: 12029
http://sourceforge.net/p/foray/code/12029
Author: victormote
Date: 2021-11-11 16:08:31 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Rename foray-hyphen to foray-orthography.
Added Paths:
-----------
trunk/foray/foray-orthography/
Removed Paths:
-------------
trunk/foray/foray-hyphen/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 15:41:21
|
Revision: 12028
http://sourceforge.net/p/foray/code/12028
Author: victormote
Date: 2021-11-11 15:41:19 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Conform to aXSL rename of axsl-hyphen to axsl-orthography.
Modified Paths:
--------------
trunk/foray/foray-core/build.gradle
trunk/foray/foray-hyphen/build.gradle
Modified: trunk/foray/foray-core/build.gradle
===================================================================
--- trunk/foray/foray-core/build.gradle 2021-11-11 15:18:30 UTC (rev 12027)
+++ trunk/foray/foray-core/build.gradle 2021-11-11 15:41:19 UTC (rev 12028)
@@ -10,8 +10,8 @@
api group: 'org.axsl', name: 'axsl-font', version: axslVersion
api group: 'org.axsl', name: 'axsl-galley', version: axslVersion
api group: 'org.axsl', name: 'axsl-graphic', version: axslVersion
- api group: 'org.axsl', name: 'axsl-hyphen', version: axslVersion
api group: 'org.axsl', name: 'axsl-layout', version: axslVersion
+ api group: 'org.axsl', name: 'axsl-orthography', version: axslVersion
api group: 'org.axsl', name: 'axsl-output', version: axslVersion
api group: 'org.axsl', name: 'axsl-speech', version: axslVersion
api group: 'org.axsl', name: 'axsl-linebreak', version: axslVersion
Modified: trunk/foray/foray-hyphen/build.gradle
===================================================================
--- trunk/foray/foray-hyphen/build.gradle 2021-11-11 15:18:30 UTC (rev 12027)
+++ trunk/foray/foray-hyphen/build.gradle 2021-11-11 15:41:19 UTC (rev 12028)
@@ -6,7 +6,7 @@
api group: 'org.apache.ant', name: 'ant-launcher', version: antVersion
api group: 'commons-cli', name: 'commons-cli', version: commonsCliVersion
api group: 'com.ibm.icu', name: 'icu4j', version: icu4jVersion
- api group: 'org.axsl', name: 'axsl-hyphen', version: axslVersion
+ api group: 'org.axsl', name: 'axsl-orthography', version: axslVersion
api project(':foray-common')
implementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackClassicVersion
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-11 15:18:32
|
Revision: 12027
http://sourceforge.net/p/foray/code/12027
Author: victormote
Date: 2021-11-11 15:18:30 +0000 (Thu, 11 Nov 2021)
Log Message:
-----------
Fix javadoc problem.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Country4a.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Country4a.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Country4a.java 2021-11-11 13:39:17 UTC (rev 12026)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Country4a.java 2021-11-11 15:18:30 UTC (rev 12027)
@@ -353,7 +353,7 @@
/**
* Constructor.
* Client code should not ordinarily use this constructor, but should use {@link #findFromAlpha(String)},
- * {@link #findFrom2Char(String)}, {@link #findFrom3Char(String)}, or {@link #findFromNumeric(int) to obtain an
+ * {@link #findFrom2Char(String)}, {@link #findFrom3Char(String)}, or {@link #findFromNumeric(int)} to obtain an
* instance of this class.
* If a new instance does need to be created, it must then be registered using {@link #register(Country4a)} for the
* methods mentioned above to be able to find it.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|