[FOray-commit] SF.net SVN: foray:[14952] trunk/foray/foray-orthograp hy/src
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2026-07-30 16:19:28
|
Revision: 14952
http://sourceforge.net/p/foray/code/14952
Author: victormote
Date: 2026-07-30 16:19:25 +0000 (Thu, 30 Jul 2026)
Log Message:
-----------
1. Remove requirement for server to create a Lexer4a. 2. Roll up SpellChecker method, for clarity.
Modified Paths:
--------------
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerIcu4jBreakIterator.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerJavaBreakIterator.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4aStandard.java
trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerEnglishIcu4jTests.java
trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerEnglishJavaTests.java
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java 2026-07-30 14:13:14 UTC (rev 14951)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/Lexer4a.java 2026-07-30 16:19:25 UTC (rev 14952)
@@ -349,10 +349,8 @@
/**
* Constructor.
- * @param server The parent server.
*/
- public Lexer4a(final OrthographyServer4aStandard server) {
-// this.server = server;
+ public Lexer4a() {
this.isLocked = false;
this.iteratorIndex = 0;
}
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerIcu4jBreakIterator.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerIcu4jBreakIterator.java 2026-07-30 14:13:14 UTC (rev 14951)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerIcu4jBreakIterator.java 2026-07-30 16:19:25 UTC (rev 14952)
@@ -52,14 +52,6 @@
* are cached because they are expensive to create. */
private Map<WritingSystem, BreakIterator> iteratorMap = new HashMap<WritingSystem, BreakIterator>();
- /**
- * Constructor.
- * @param server The parent server.
- */
- public LexerIcu4jBreakIterator(final OrthographyServer4aStandard server) {
- super(server);
- }
-
@Override
protected IntSequence findRawBreaks(final CharSequence sequence, final WritingSystem writingSystem) {
BreakIterator wordBreakIterator = this.iteratorMap.get(writingSystem);
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerJavaBreakIterator.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerJavaBreakIterator.java 2026-07-30 14:13:14 UTC (rev 14951)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/LexerJavaBreakIterator.java 2026-07-30 16:19:25 UTC (rev 14952)
@@ -42,14 +42,6 @@
*/
public class LexerJavaBreakIterator extends Lexer4a {
- /**
- * Constructor.
- * @param server The parent server.
- */
- public LexerJavaBreakIterator(final OrthographyServer4aStandard server) {
- super(server);
- }
-
@Override
protected IntSequence findRawBreaks(final CharSequence sequence, final WritingSystem writingSystem) {
final IntArrayBuilder result = new IntArrayBuilder(sequence.length());
Modified: trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4aStandard.java
===================================================================
--- trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4aStandard.java 2026-07-30 14:13:14 UTC (rev 14951)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/OrthographyServer4aStandard.java 2026-07-30 16:19:25 UTC (rev 14952)
@@ -176,7 +176,7 @@
@Override
public Lexer4a getLexer() {
if (this.lexer == null) {
- this.lexer = new LexerJavaBreakIterator(this);
+ this.lexer = new LexerJavaBreakIterator();
}
return this.lexer;
}
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 2026-07-30 14:13:14 UTC (rev 14951)
+++ trunk/foray/foray-orthography/src/main/java/org/foray/orthography/util/SpellChecker.java 2026-07-30 16:19:25 UTC (rev 14952)
@@ -440,7 +440,18 @@
orthography = this.server.getOrthography(token.getWritingSystem());
}
lastWritingSystem = token.getWritingSystem();
- checkWord(orthography, token, element);
+ if (orthography == null) {
+ /* Treat as an error. */
+ final String message = "(no config) " + token.getText();
+ this.output.println(message);
+ } else {
+ final Word4a word = orthography.recognizeWord(token, this.lexer);
+ if (word == null) {
+ final String message = createNotFoundMessage(token, element);
+ this.output.println(message);
+ this.notFoundCounter ++;
+ }
+ }
}
}
lexer.clear();
@@ -447,30 +458,6 @@
}
/**
- * Spell-check a word.
- * @param orthography The orthography to be used to spell-check {@code word}.
- * @param token The word token to be checked.
- * @param element The element containing the content being tokenized.
- */
- private void checkWord(final Orthography4a orthography, final Lexer4a.Token4a token, final TextElement element) {
- if (orthography == null) {
- /* Treat as an error. */
- final String message = "(no config) " + token.getText();
- this.output.println(message);
- } else {
- final Word4a word = orthography.recognizeWord(token, this.lexer);
- if (word != null) {
- return;
- }
- }
-
- final String message = createNotFoundMessage(token, element);
- this.output.println(message);
- this.notFoundCounter ++;
- }
-
-
- /**
* Creates the text message to be reported to the user if a token is not found.
* @param token The token being reported.
* @param element The raw element containing {@code token}.
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerEnglishIcu4jTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerEnglishIcu4jTests.java 2026-07-30 14:13:14 UTC (rev 14951)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerEnglishIcu4jTests.java 2026-07-30 16:19:25 UTC (rev 14952)
@@ -54,8 +54,7 @@
*/
@BeforeEach
public void setupTest() throws IOException, OrthographyException {
- final OrthographyServer4aStandard server = createServer();
- this.out = new LexerIcu4jBreakIterator(server);
+ this.out = new LexerIcu4jBreakIterator();
}
@Override
Modified: trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerEnglishJavaTests.java
===================================================================
--- trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerEnglishJavaTests.java 2026-07-30 14:13:14 UTC (rev 14951)
+++ trunk/foray/foray-orthography/src/test/java/org/foray/orthography/LexerEnglishJavaTests.java 2026-07-30 16:19:25 UTC (rev 14952)
@@ -49,8 +49,7 @@
*/
@BeforeEach
public void setupTest() throws IOException, OrthographyException {
- final OrthographyServer4aStandard server = createServer();
- this.out = new LexerJavaBreakIterator(server);
+ this.out = new LexerJavaBreakIterator();
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|