foray-commit Mailing List for FOray (Page 77)
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-01 21:05:44
|
Revision: 11975
http://sourceforge.net/p/foray/code/11975
Author: victormote
Date: 2021-11-01 21:05:42 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
Move more word-checking logic to OrthographyConfig4a.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 20:57:25 UTC (rev 11974)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 21:05:42 UTC (rev 11975)
@@ -456,23 +456,10 @@
return;
}
- /* Check against any ad-hoc dictionaries. */
- for (int index = 0; index < this.currentDictionaries.size(); index ++) {
- final Dictionary dict = this.currentDictionaries.get(index);
- if (wordFound(dict, word)) {
- return;
- }
- }
-
final SegmentDictionary dictionary = this.currentOrthographyConfig.getDictionary();
- if (dictionary == null) {
- /* Treat as a misspelling. */
- this.output.println("(no dictionary) " + word);
- } else {
- if (! wordFound(dictionary, word)) {
- this.output.println("Not found: " + word + " " + locationString());
- this.notFoundCounter ++;
- }
+ if (! wordFound(dictionary, word)) {
+ this.output.println("Not found: " + word + " " + locationString());
+ this.notFoundCounter ++;
}
}
@@ -489,10 +476,7 @@
* be handled. */
/* Is the word itself directly in the dictionary. */
- Word dictWord = dictionary.getWord(word, null);
- if (dictWord != null) {
- return true;
- }
+ Word dictWord = null;
/* Starting here, we will change the word content in various ways, looking for a match. The changes are
* cumulative. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-01 20:57:27
|
Revision: 11974
http://sourceforge.net/p/foray/code/11974
Author: victormote
Date: 2021-11-01 20:57:25 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
Move more word-finding logic out of SpellChecker into OrthographyConfig4a.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java 2021-11-01 20:42:04 UTC (rev 11973)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java 2021-11-01 20:57:25 UTC (rev 11974)
@@ -253,7 +253,7 @@
public boolean isValidWord(final CharSequence wordChars, final PartOfSpeech pos,
final List<Dictionary> adhocDictionaries) {
- /* 1. Exact matches in adhoc dictionaries. */
+ /* 1. Check exact matches in adhoc dictionaries. */
if (adhocDictionaries != null) {
for (int index = 0; index < adhocDictionaries.size(); index ++) {
final Dictionary adhocDictionary = adhocDictionaries.get(index);
@@ -263,13 +263,18 @@
}
}
- /* 2. Exact matches in standard dictionaries for the orthography. */
+ /* 2. Check exact matches in standard dictionaries for the orthography. */
final Dictionary orthoDictionary = getDictionary();
if (orthoDictionary.getWord(wordChars, null) != null) {
return true;
}
- /* 3. Derivative matches in adhoc dictionaries. */
+ /* 3. Check the match rules. */
+ if (foundInMatchRules(wordChars)) {
+ return true;
+ }
+
+ /* 4. Derivative matches in adhoc dictionaries. */
if (adhocDictionaries != null) {
for (int index = 0; index < adhocDictionaries.size(); index ++) {
final Dictionary adhocDictionary = adhocDictionaries.get(index);
@@ -279,7 +284,7 @@
}
}
- /* 4. Derivative matches in standard dictionaries for the orthography. */
+ /* 5. Derivative matches in standard dictionaries for the orthography. */
if (orthoDictionary.getWord(wordChars, null) != null) {
return true;
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 20:42:04 UTC (rev 11973)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 20:57:25 UTC (rev 11974)
@@ -446,10 +446,16 @@
return;
}
- if (this.currentOrthographyConfig.foundInMatchRules(word)) {
+ if (this.currentOrthographyConfig == null) {
+ /* Treat as a misspelling. */
+ this.output.println("(no config) " + word);
return;
}
+ if (this.currentOrthographyConfig.isValidWord(word, null, this.currentDictionaries)) {
+ return;
+ }
+
/* Check against any ad-hoc dictionaries. */
for (int index = 0; index < this.currentDictionaries.size(); index ++) {
final Dictionary dict = this.currentDictionaries.get(index);
@@ -458,19 +464,14 @@
}
}
- if (this.currentOrthographyConfig == null) {
+ final SegmentDictionary dictionary = this.currentOrthographyConfig.getDictionary();
+ if (dictionary == null) {
/* Treat as a misspelling. */
- this.output.println("(no config) " + word);
+ this.output.println("(no dictionary) " + word);
} else {
- final SegmentDictionary dictionary = this.currentOrthographyConfig.getDictionary();
- if (dictionary == null) {
- /* Treat as a misspelling. */
- this.output.println("(no dictionary) " + word);
- } else {
- if (! wordFound(dictionary, word)) {
- this.output.println("Not found: " + word + " " + locationString());
- this.notFoundCounter ++;
- }
+ if (! wordFound(dictionary, word)) {
+ this.output.println("Not found: " + word + " " + locationString());
+ this.notFoundCounter ++;
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-01 20:42:07
|
Revision: 11973
http://sourceforge.net/p/foray/code/11973
Author: victormote
Date: 2021-11-01 20:42:04 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
For OrthographyConfig, provide a handle to the hyphenation server.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-11-01 20:25:59 UTC (rev 11972)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-11-01 20:42:04 UTC (rev 11973)
@@ -361,7 +361,7 @@
return;
}
if (localName.equals("configuration")) {
- this.currentOrthographyConfig = new OrthographyConfig4a();
+ this.currentOrthographyConfig = new OrthographyConfig4a(this.hyphenationServer);
return;
}
if (localName.equals("orthography")) {
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java 2021-11-01 20:25:59 UTC (rev 11972)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java 2021-11-01 20:42:04 UTC (rev 11973)
@@ -61,7 +61,18 @@
/** The word breaker for this orthography. */
private WordBreaker wordBreaker;
+ /** The parent hyphenation server. */
+ private HyphenationServer4a server;
+
/**
+ * Constructor.
+ * @param server The parent hyphenation server.
+ */
+ public OrthographyConfig4a(final HyphenationServer4a server) {
+ this.server = server;
+ }
+
+ /**
* Returns the list of match rule Ids.
* @return The list of match rule Ids.
*/
@@ -214,10 +225,9 @@
* 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.
- * @param server The hyphenation server.
* @return True if and only if {@code word} matches at least one match rule for this orthography.
*/
- public boolean foundInMatchRules(final CharSequence wordChars, final HyphenationServer4a server) {
+ 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);
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 20:25:59 UTC (rev 11972)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 20:42:04 UTC (rev 11973)
@@ -446,7 +446,7 @@
return;
}
- if (this.currentOrthographyConfig.foundInMatchRules(word, this.server)) {
+ if (this.currentOrthographyConfig.foundInMatchRules(word)) {
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-01 20:26:02
|
Revision: 11972
http://sourceforge.net/p/foray/code/11972
Author: victormote
Date: 2021-11-01 20:25:59 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
Conform to aXSL changes.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java 2021-11-01 18:54:05 UTC (rev 11971)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java 2021-11-01 20:25:59 UTC (rev 11972)
@@ -29,6 +29,9 @@
package org.foray.hyphen;
import org.axsl.hyphen.Dictionary;
+import org.axsl.hyphen.OrthographyConfig;
+import org.axsl.hyphen.PartOfSpeech;
+import org.axsl.hyphen.Word;
import java.util.ArrayList;
import java.util.List;
@@ -38,7 +41,7 @@
/**
* The resources (dictionaries, word wrappers, hyphenation patterns, etc.) that should be used by a given orthography.
*/
-public class OrthographyConfig4a {
+public class OrthographyConfig4a implements OrthographyConfig {
/** 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>();
@@ -229,21 +232,22 @@
return false;
}
- /**
- * Indicates whether a given word or its root can be found in any dictionar(ies) for this orthography, or in any
- * provided adhoc dictionaries.
- * @param wordChars The word to be tested.
- * @param server The hyphenation server.
- * @param adhocDictionaries The adhoc dictionaries against which {@code word} should be tested.
- * @return True if and only if {@code word} is found in a relevant dictionary, or can be derived from such a word.
- */
- public boolean foundInDictionaries(final CharSequence wordChars, final HyphenationServer4a server,
+ @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) {
+
/* 1. Exact matches in adhoc dictionaries. */
if (adhocDictionaries != null) {
for (int index = 0; index < adhocDictionaries.size(); index ++) {
final Dictionary adhocDictionary = adhocDictionaries.get(index);
- if (adhocDictionary.getExactWord(wordChars, null) != null) {
+ if (adhocDictionary.getWord(wordChars, null) != null) {
return true;
}
}
@@ -251,7 +255,7 @@
/* 2. Exact matches in standard dictionaries for the orthography. */
final Dictionary orthoDictionary = getDictionary();
- if (orthoDictionary.getExactWord(wordChars, null) != null) {
+ if (orthoDictionary.getWord(wordChars, null) != null) {
return true;
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-11-01 18:54:05 UTC (rev 11971)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-11-01 20:25:59 UTC (rev 11972)
@@ -122,15 +122,9 @@
@Override
public SegmentDictionaryWord getWord(final CharSequence rawWord, final PartOfSpeech pos) {
/* TODO: Implement PartOfSpeech logic. */
- return getExactWord(rawWord, pos);
+ return getExactWord(rawWord);
}
- @Override
- public SegmentDictionaryWord getExactWord(final CharSequence rawWord, final PartOfSpeech pos) {
- /* TODO: Implement PartOfSpeech logic. */
- return this.wordMap.get(rawWord);
- }
-
/**
* Retrieves a word from this dictionary.
* @param rawWord The raw word whose word should be retrieved.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-01 18:54:08
|
Revision: 11971
http://sourceforge.net/p/foray/code/11971
Author: victormote
Date: 2021-11-01 18:54:05 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
Rename class in preparation for extracting an aXSL interface for it.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/data/dictionaries/eng-999-Latn.dict.xml
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Added Paths:
-----------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java
Removed Paths:
-------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
Modified: trunk/foray/foray-hyphen/src/main/data/dictionaries/eng-999-Latn.dict.xml
===================================================================
--- trunk/foray/foray-hyphen/src/main/data/dictionaries/eng-999-Latn.dict.xml 2021-11-01 18:16:09 UTC (rev 11970)
+++ trunk/foray/foray-hyphen/src/main/data/dictionaries/eng-999-Latn.dict.xml 2021-11-01 18:54:05 UTC (rev 11971)
@@ -78969,7 +78969,7 @@
<w><t>in-ver-te-bra-cy</t></w>
<w><t>in-ver-tin</t></w>
<w><t>in-ver-tor</t></w>
-<w><t>in-vest</t></w>
+<w><t>in-vest</t><verb regular="true"/></w>
<w><t>in-vest-a-ble</t></w>
<w><t>in-vest-i-ble</t></w>
<w><t>in-vest-ment</t></w>
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-11-01 18:16:09 UTC (rev 11970)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-11-01 18:54:05 UTC (rev 11971)
@@ -113,7 +113,7 @@
private StringBuilder textAccumulator = new StringBuilder();
/** Stateful variable tracking the current orthography configuration. */
- private transient OrthographyConfig currentOrthographyConfig;
+ private transient OrthographyConfig4a currentOrthographyConfig;
// /** The map of match rule lists, keyed by id. */
// private Map<String, List<Pattern>> matchRuleLists = new HashMap<String, List<Pattern>>();
@@ -361,7 +361,7 @@
return;
}
if (localName.equals("configuration")) {
- this.currentOrthographyConfig = new OrthographyConfig();
+ this.currentOrthographyConfig = new OrthographyConfig4a();
return;
}
if (localName.equals("orthography")) {
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java 2021-11-01 18:16:09 UTC (rev 11970)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java 2021-11-01 18:54:05 UTC (rev 11971)
@@ -67,7 +67,7 @@
@Override
public Word hyphenate(final CharSequence word, final int offset, final int length, final Orthography orthography) {
- final OrthographyConfig orthographyConfig = this.server.getOrthographyConfig(orthography);
+ final OrthographyConfig4a orthographyConfig = this.server.getOrthographyConfig(orthography);
if (orthographyConfig == null) {
this.logger.warn("Configuration not found for orthography {}", orthography.toString());
return null;
@@ -135,7 +135,7 @@
final ParaConfig paraConfig) {
final ParaBranch4a wordSequence = new ParaBranch4a(paraConfig);
final CharSequence sequence = characters.subSequence(startIndex, startIndex + length);
- final OrthographyConfig orthographyConfig = this.server.getOrthographyConfig(paraConfig.getOrthography());
+ final OrthographyConfig4a orthographyConfig = this.server.getOrthographyConfig(paraConfig.getOrthography());
if (orthographyConfig == null) {
this.logger.error("Orthography not configured for: " + paraConfig.getOrthography());
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java 2021-11-01 18:16:09 UTC (rev 11970)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java 2021-11-01 18:54:05 UTC (rev 11971)
@@ -77,8 +77,8 @@
private EntityResolver entityResolver = null;
/** Map of orthographies and their configurations to be used by this server. */
- private Map<Orthography, OrthographyConfig> orthographyConfigurations =
- new HashMap<Orthography, OrthographyConfig>();
+ 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>>();
@@ -285,7 +285,7 @@
* @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 OrthographyConfig config) {
+ public void registerOrthographyConfig(final Orthography orthography, final OrthographyConfig4a config) {
this.orthographyConfigurations.put(orthography, config);
}
@@ -294,7 +294,7 @@
* @param orthography The orthography whose configuration should be returned.
* @return The configuration for {@code orthography}.
*/
- public OrthographyConfig getOrthographyConfig(final Orthography orthography) {
+ public OrthographyConfig4a getOrthographyConfig(final Orthography orthography) {
return this.orthographyConfigurations.get(orthography);
}
Deleted: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-11-01 18:16:09 UTC (rev 11970)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-11-01 18:54:05 UTC (rev 11971)
@@ -1,277 +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.hyphen;
-
-import org.axsl.hyphen.Dictionary;
-
-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 OrthographyConfig {
-
- /** 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;
-
- /**
- * 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.
- * @param server The hyphenation server.
- * @return True if and only if {@code word} matches at least one match rule for this orthography.
- */
- public boolean foundInMatchRules(final CharSequence wordChars, final HyphenationServer4a server) {
- 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;
- }
-
- /**
- * Indicates whether a given word or its root can be found in any dictionar(ies) for this orthography, or in any
- * provided adhoc dictionaries.
- * @param wordChars The word to be tested.
- * @param server The hyphenation server.
- * @param adhocDictionaries The adhoc dictionaries against which {@code word} should be tested.
- * @return True if and only if {@code word} is found in a relevant dictionary, or can be derived from such a word.
- */
- public boolean foundInDictionaries(final CharSequence wordChars, final HyphenationServer4a server,
- final List<Dictionary> adhocDictionaries) {
- /* 1. Exact matches in adhoc dictionaries. */
- if (adhocDictionaries != null) {
- for (int index = 0; index < adhocDictionaries.size(); index ++) {
- final Dictionary adhocDictionary = adhocDictionaries.get(index);
- if (adhocDictionary.getExactWord(wordChars, null) != null) {
- return true;
- }
- }
- }
-
- /* 2. Exact matches in standard dictionaries for the orthography. */
- final Dictionary orthoDictionary = getDictionary();
- if (orthoDictionary.getExactWord(wordChars, null) != null) {
- return true;
- }
-
- /* 3. Derivative 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, null) != null) {
- return true;
- }
- }
- }
-
- /* 4. Derivative matches in standard dictionaries for the orthography. */
- if (orthoDictionary.getWord(wordChars, null) != null) {
- return true;
- }
-
- /* Not found in any dictionary. */
- return false;
- }
-
-}
Copied: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java (from rev 11970, trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java)
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java (rev 0)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig4a.java 2021-11-01 18:54:05 UTC (rev 11971)
@@ -0,0 +1,277 @@
+/*
+ * 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.hyphen;
+
+import org.axsl.hyphen.Dictionary;
+
+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 {
+
+ /** 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;
+
+ /**
+ * 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.
+ * @param server The hyphenation server.
+ * @return True if and only if {@code word} matches at least one match rule for this orthography.
+ */
+ public boolean foundInMatchRules(final CharSequence wordChars, final HyphenationServer4a server) {
+ 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;
+ }
+
+ /**
+ * Indicates whether a given word or its root can be found in any dictionar(ies) for this orthography, or in any
+ * provided adhoc dictionaries.
+ * @param wordChars The word to be tested.
+ * @param server The hyphenation server.
+ * @param adhocDictionaries The adhoc dictionaries against which {@code word} should be tested.
+ * @return True if and only if {@code word} is found in a relevant dictionary, or can be derived from such a word.
+ */
+ public boolean foundInDictionaries(final CharSequence wordChars, final HyphenationServer4a server,
+ final List<Dictionary> adhocDictionaries) {
+ /* 1. Exact matches in adhoc dictionaries. */
+ if (adhocDictionaries != null) {
+ for (int index = 0; index < adhocDictionaries.size(); index ++) {
+ final Dictionary adhocDictionary = adhocDictionaries.get(index);
+ if (adhocDictionary.getExactWord(wordChars, null) != null) {
+ return true;
+ }
+ }
+ }
+
+ /* 2. Exact matches in standard dictionaries for the orthography. */
+ final Dictionary orthoDictionary = getDictionary();
+ if (orthoDictionary.getExactWord(wordChars, null) != null) {
+ return true;
+ }
+
+ /* 3. Derivative 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, null) != null) {
+ return true;
+ }
+ }
+ }
+
+ /* 4. Derivative matches in standard dictionaries for the orthography. */
+ if (orthoDictionary.getWord(wordChars, null) != null) {
+ return true;
+ }
+
+ /* Not found in any dictionary. */
+ return false;
+ }
+
+}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 18:16:09 UTC (rev 11970)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 18:54:05 UTC (rev 11971)
@@ -95,7 +95,7 @@
private Orthography orthography;
/** The orthography configuration for this element, only if {@link #orthography} is not null. */
- private OrthographyConfig orthographyConfig;
+ private OrthographyConfig4a orthographyConfig;
/**
* Checks whether a set of element descriptor items match this instance.
@@ -153,7 +153,7 @@
private Stack<Element> elementStack = new Stack<Element>();
/** The current orthography configuration. */
- private OrthographyConfig currentOrthographyConfig;
+ private OrthographyConfig4a currentOrthographyConfig;
/** The logger. */
private Logger logger = LoggerFactory.getLogger(SpellChecker.class);
@@ -353,7 +353,7 @@
countryString, script.getAlphaCode());
this.output.println(message + locationString());
} else {
- final OrthographyConfig config = this.server.getOrthographyConfig(element.orthography);
+ final OrthographyConfig4a config = this.server.getOrthographyConfig(element.orthography);
if (config == null) {
final String message = String.format(
"Unconfigured orthography. Language: %1$s, Country: %2$s, Script: %3$s ",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-01 18:16:11
|
Revision: 11970
http://sourceforge.net/p/foray/code/11970
Author: victormote
Date: 2021-11-01 18:16:09 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
1. Conform to aXSL changes adding method looking for an exact match. 2. Implement algorithm for searching through dictionaries for a match.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/SegmentDictionaryTests.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/SegmentDictionaryWordTests.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java 2021-11-01 17:28:10 UTC (rev 11969)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationConsumer4a.java 2021-11-01 18:16:09 UTC (rev 11970)
@@ -80,7 +80,7 @@
/* 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());
+ hyphenatedWord = dictionary.getWord(chars.toString().toLowerCase(), null);
if (hyphenatedWord == null) {
hyphenatedWord = orthographyConfig.findDerivatives(chars);
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-11-01 17:28:10 UTC (rev 11969)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-11-01 18:16:09 UTC (rev 11970)
@@ -210,17 +210,17 @@
/**
* 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 word The word to be tested.
+ * @param wordChars The word to be tested.
* @param server The hyphenation server.
- * @return True if and only if {code word} matches at least one match rule for this orthography.
+ * @return True if and only if {@code word} matches at least one match rule for this orthography.
*/
- public boolean foundInMatchRules(final CharSequence word, final HyphenationServer4a server) {
+ public boolean foundInMatchRules(final CharSequence wordChars, final HyphenationServer4a server) {
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(word);
+ final Matcher matcher = pattern.matcher(wordChars);
if (matcher.matches()) {
return true;
}
@@ -229,4 +229,49 @@
return false;
}
+ /**
+ * Indicates whether a given word or its root can be found in any dictionar(ies) for this orthography, or in any
+ * provided adhoc dictionaries.
+ * @param wordChars The word to be tested.
+ * @param server The hyphenation server.
+ * @param adhocDictionaries The adhoc dictionaries against which {@code word} should be tested.
+ * @return True if and only if {@code word} is found in a relevant dictionary, or can be derived from such a word.
+ */
+ public boolean foundInDictionaries(final CharSequence wordChars, final HyphenationServer4a server,
+ final List<Dictionary> adhocDictionaries) {
+ /* 1. Exact matches in adhoc dictionaries. */
+ if (adhocDictionaries != null) {
+ for (int index = 0; index < adhocDictionaries.size(); index ++) {
+ final Dictionary adhocDictionary = adhocDictionaries.get(index);
+ if (adhocDictionary.getExactWord(wordChars, null) != null) {
+ return true;
+ }
+ }
+ }
+
+ /* 2. Exact matches in standard dictionaries for the orthography. */
+ final Dictionary orthoDictionary = getDictionary();
+ if (orthoDictionary.getExactWord(wordChars, null) != null) {
+ return true;
+ }
+
+ /* 3. Derivative 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, null) != null) {
+ return true;
+ }
+ }
+ }
+
+ /* 4. Derivative matches in standard dictionaries for the orthography. */
+ if (orthoDictionary.getWord(wordChars, null) != null) {
+ return true;
+ }
+
+ /* Not found in any dictionary. */
+ return false;
+ }
+
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-11-01 17:28:10 UTC (rev 11969)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-11-01 18:16:09 UTC (rev 11970)
@@ -32,7 +32,6 @@
import org.axsl.hyphen.Dictionary;
import org.axsl.hyphen.PartOfSpeech;
-import org.axsl.hyphen.Word;
import java.util.Arrays;
import java.util.HashSet;
@@ -121,17 +120,23 @@
}
@Override
- public Word getWord(final CharSequence rawWord, final PartOfSpeech pos) {
+ public SegmentDictionaryWord getWord(final CharSequence rawWord, final PartOfSpeech pos) {
/* TODO: Implement PartOfSpeech logic. */
- return getWord(rawWord);
+ return getExactWord(rawWord, pos);
}
+ @Override
+ public SegmentDictionaryWord getExactWord(final CharSequence rawWord, final PartOfSpeech pos) {
+ /* TODO: Implement PartOfSpeech logic. */
+ return this.wordMap.get(rawWord);
+ }
+
/**
* Retrieves a word from this dictionary.
* @param rawWord The raw word whose word should be retrieved.
* @return The word matching {@code rawWord}, or null if none is found.
*/
- public SegmentDictionaryWord getWord(final CharSequence rawWord) {
+ public SegmentDictionaryWord getExactWord(final CharSequence rawWord) {
return this.wordMap.get(rawWord);
}
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/SegmentDictionaryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/SegmentDictionaryTests.java 2021-11-01 17:28:10 UTC (rev 11969)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/SegmentDictionaryTests.java 2021-11-01 18:16:09 UTC (rev 11970)
@@ -107,12 +107,12 @@
/* This is the expected case. */
}
- final SegmentDictionaryWord dictWord = out.getWord("attention");
+ final SegmentDictionaryWord dictWord = out.getWord("attention", null);
Assert.assertEquals("attention", dictWord.getActualContent());
Assert.assertEquals("at-ten-tion", dictWord.toString());
/* Make sure passing a bogus key returns null. */
- Assert.assertNull(out.getWord("test"));
+ Assert.assertNull(out.getWord("test", null));
}
/**
@@ -125,9 +125,9 @@
words.add(WORD_HARMONIOUS);
final SegmentDictionary dictionary = SegmentDictionary.make(words);
Assert.assertEquals(2, dictionary.getSize());
- Assert.assertEquals("at-ten-tion", dictionary.getWord("attention").toString());
- Assert.assertEquals("har-mo-ni-ous", dictionary.getWord("harmonious").toString());
- Assert.assertNull(dictionary.getWord("bogus"));
+ Assert.assertEquals("at-ten-tion", dictionary.getWord("attention", null).toString());
+ Assert.assertEquals("har-mo-ni-ous", dictionary.getWord("harmonious", null).toString());
+ Assert.assertNull(dictionary.getWord("bogus", null));
}
}
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/SegmentDictionaryWordTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/SegmentDictionaryWordTests.java 2021-11-01 17:28:10 UTC (rev 11969)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/SegmentDictionaryWordTests.java 2021-11-01 18:16:09 UTC (rev 11970)
@@ -66,7 +66,7 @@
*/
@Test
public void toStringTests() {
- Assert.assertEquals("am-bi-tion", dictionary.getWord("ambition").toString());
+ Assert.assertEquals("am-bi-tion", dictionary.getWord("ambition", null).toString());
}
/**
@@ -74,7 +74,7 @@
*/
@Test
public void getActualContentTests() {
- Assert.assertEquals("ambition", dictionary.getWord("ambition").getActualContent());
+ Assert.assertEquals("ambition", dictionary.getWord("ambition", null).getActualContent());
}
/**
@@ -82,7 +82,7 @@
*/
@Test
public void getQtyParaNodeChildrenTests() {
- Assert.assertEquals(5, dictionary.getWord("ambition").getQtyParaNodeChildren());
+ Assert.assertEquals(5, dictionary.getWord("ambition", null).getQtyParaNodeChildren());
}
/**
@@ -90,7 +90,7 @@
*/
@Test
public void getParaNodeChildTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals("am", word.getParaNodeChild(0).toString());
Assert.assertEquals("-", word.getParaNodeChild(1).toString());
Assert.assertEquals("bi", word.getParaNodeChild(2).toString());
@@ -117,7 +117,7 @@
*/
@Test
public void getParaConfigTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertNull(word.getParaConfig());
}
@@ -126,7 +126,7 @@
*/
@Test
public void getParaNodeTypeTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals(ParaNode.Type.BRANCH, word.getParaNodeType());
}
@@ -135,7 +135,7 @@
*/
@Test
public void asParaLeafTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertNull(word.asParaLeaf());
}
@@ -144,7 +144,7 @@
*/
@Test
public void asParaBranchTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
/* Test for identity equality. */
Assert.assertTrue(word.asParaBranch() == word);
}
@@ -154,7 +154,7 @@
*/
@Test
public void lengthTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals(8, word.length());
}
@@ -163,7 +163,7 @@
*/
@Test
public void charAtTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals('a', word.charAt(0));
Assert.assertEquals('m', word.charAt(1));
Assert.assertEquals('b', word.charAt(2));
@@ -195,7 +195,7 @@
@Ignore
/* @TODO: Fails in some Java 8 implementations. */
public void subSequenceTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals("mbi", word.subSequence(1, 4));
try {
word.subSequence(-1, 4);
@@ -225,7 +225,7 @@
*/
@Test
public void getNormalizedContentTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals("ambition", word.getNormalizedContent());
}
@@ -234,7 +234,7 @@
*/
@Test
public void getQtyHyphenationPointsTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals(2, word.getQtyHyphenationPoints());
}
@@ -243,7 +243,7 @@
*/
@Test
public void getHyphenationPointOffsetTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals(2, word.getHyphenationPointOffset(0));
Assert.assertEquals(4, word.getHyphenationPointOffset(1));
try {
@@ -267,7 +267,7 @@
*/
@Test
public void getHyphenationPointTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals(Quality.ACCEPTABLE, word.getHyphenationPoint(0).getQuality());
Assert.assertEquals(Quality.ACCEPTABLE, word.getHyphenationPoint(1).getQuality());
try {
@@ -291,7 +291,7 @@
*/
@Test
public void getHeinousPointsTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertNull(word.getHeinousPoints());
}
@@ -300,7 +300,7 @@
*/
@Test
public void getQtyWordSegmentsTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals(3, word.getQtyWordSegments());
}
@@ -311,7 +311,7 @@
@Ignore
/* @TODO: Fails in some Java 8 implementations. */
public void getWordSegmentTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals("am", word.getWordSegment(0).toString());
Assert.assertEquals("bi", word.getWordSegment(1).toString());
Assert.assertEquals("tion", word.getWordSegment(2).toString());
@@ -336,7 +336,7 @@
*/
@Test
public void getQtyWordComponentsTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals(5, word.getQtyWordComponents());
}
@@ -347,7 +347,7 @@
@Ignore
/* @TODO: Fails in some Java 8 implementations. */
public void getgetWordComponentTests() {
- final SegmentDictionaryWord word = dictionary.getWord("ambition");
+ final SegmentDictionaryWord word = dictionary.getWord("ambition", null);
Assert.assertEquals("am", word.getWordComponent(0).toString());
Assert.assertEquals("-", word.getWordComponent(1).toString());
Assert.assertEquals("bi", word.getWordComponent(2).toString());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-01 17:28:13
|
Revision: 11969
http://sourceforge.net/p/foray/code/11969
Author: victormote
Date: 2021-11-01 17:28:10 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
Move some spell-check logic to the orthography config.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-11-01 17:14:11 UTC (rev 11968)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-11-01 17:28:10 UTC (rev 11969)
@@ -32,6 +32,8 @@
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.
@@ -205,4 +207,26 @@
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 word The word to be tested.
+ * @param server The hyphenation server.
+ * @return True if and only if {code word} matches at least one match rule for this orthography.
+ */
+ public boolean foundInMatchRules(final CharSequence word, final HyphenationServer4a server) {
+ 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(word);
+ if (matcher.matches()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 17:14:11 UTC (rev 11968)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 17:28:10 UTC (rev 11969)
@@ -69,8 +69,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Stack;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
@@ -448,18 +446,8 @@
return;
}
- /* Check against patterns that are considered to be valid words, but that are not in the dictionary. */
- final List<String> matchRuleListIds = this.currentOrthographyConfig.getMatchRuleListIds();
- for (int idIndex = 0; idIndex < matchRuleListIds.size(); idIndex ++) {
- final String ruleListId = matchRuleListIds.get(idIndex);
- final List<Pattern> validWordPatterns = this.server.getMatchRules(ruleListId);
- for (int index = 0; index < validWordPatterns.size(); index ++) {
- final Pattern pattern = validWordPatterns.get(index);
- final Matcher matcher = pattern.matcher(word);
- if (matcher.matches()) {
- return;
- }
- }
+ if (this.currentOrthographyConfig.foundInMatchRules(word, this.server)) {
+ return;
}
/* Check against any ad-hoc dictionaries. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-01 17:14:12
|
Revision: 11968
http://sourceforge.net/p/foray/code/11968
Author: victormote
Date: 2021-11-01 17:14:11 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
Add parsing of new configuration options.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DerivativeRule.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-11-01 16:24:49 UTC (rev 11967)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-11-01 17:14:11 UTC (rev 11968)
@@ -89,6 +89,18 @@
private List<Pattern> currentMatchRuleList;
/** Stateful variable. */
+ private List<DerivativeRule> currentDerivativeRuleList;
+
+ /** Stateful variable. */
+ private DerivativeRule.Type currentDerivativeRuleType;
+
+ /** Stateful variable. */
+ private Pattern currentDerivativeRuleMatch;
+
+ /** Stateful variable. */
+ private String currentDerivativeRuleReplace;
+
+ /** Stateful variable. */
private List<WordWrapperFactory<?>> currentDerivateFactoryList;
/** Stateful variable. */
@@ -215,6 +227,17 @@
this.hyphenationServer.registerMatchRules(id, currentMatchRuleList);
return;
}
+ if (localName.equals("derivative-rule-list")) {
+ final String id = attributes.getValue("id");
+ this.currentDerivativeRuleList = new ArrayList<DerivativeRule>();
+ this.hyphenationServer.registerDerivativeRules(id, currentDerivativeRuleList);
+ return;
+ }
+ if (localName.equals("derivative-rule")) {
+ final String typeString = attributes.getValue("type");
+ this.currentDerivativeRuleType = DerivativeRule.Type.fromConfigDescriptor(typeString);
+ return;
+ }
if (localName.equals("derivative-factory-list")) {
final String id = attributes.getValue("id");
this.currentDerivateFactoryList = new ArrayList<WordWrapperFactory<?>>();
@@ -278,6 +301,17 @@
}
return;
}
+ if (localName.equals("derivative-rules")) {
+ final String reference = attributes.getValue("reference");
+ final List<DerivativeRule> rules = this.hyphenationServer.getDerivativeRules(reference);
+ if (rules == null) {
+ this.logger.error("derivative-rules not found: {}", reference);
+ this.logger.error(getContextMessage());
+ } else {
+ this.currentOrthographyConfig.registerDerivativeRuleListId(reference);
+ }
+ return;
+ }
if (localName.equals("derivative-factories")) {
final String reference = attributes.getValue("reference");
final List<WordWrapperFactory<?>> factories = this.derivativeLists.get(reference);
@@ -441,9 +475,32 @@
final String matchString = this.textAccumulator.toString();
StringUtils.clear(this.textAccumulator);
final Pattern pattern = Pattern.compile(matchString);
- this.currentMatchRuleList.add(pattern);
+ if (this.currentDerivativeRuleType != null) {
+ this.currentDerivativeRuleMatch = pattern;
+ } else {
+ this.currentMatchRuleList.add(pattern);
+ }
return;
}
+ if (localName.equals("derivative-rule")) {
+ final DerivativeRule rule = new DerivativeRule(this.currentDerivativeRuleType,
+ this.currentDerivativeRuleMatch, this.currentDerivativeRuleReplace);
+ this.currentDerivativeRuleList.add(rule);
+ this.currentDerivativeRuleType = null;
+ this.currentDerivativeRuleMatch = null;
+ this.currentDerivativeRuleReplace = null;
+ return;
+ }
+ if (localName.equals("derivative-rule-list")) {
+ this.currentDerivativeRuleList = null;
+ return;
+ }
+ if (localName.equals("replace")) {
+ final String replaceString = this.textAccumulator.toString();
+ StringUtils.clear(this.textAccumulator);
+ this.currentDerivativeRuleReplace = replaceString;
+ return;
+ }
if (localName.equals("derivative-factory-list")) {
this.currentDerivateFactoryList = null;
return;
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DerivativeRule.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DerivativeRule.java 2021-11-01 16:24:49 UTC (rev 11967)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DerivativeRule.java 2021-11-01 17:14:11 UTC (rev 11968)
@@ -28,6 +28,8 @@
package org.foray.hyphen;
+import java.util.Arrays;
+import java.util.List;
import java.util.regex.Pattern;
/**
@@ -42,14 +44,53 @@
* Enumeration of the types of derivative rules.
*/
public enum Type {
+
/** Matching word must be a regular noun. */
- REGULAR_NOUN,
+ REGULAR_NOUN("regular-noun"),
/** Matching word must be a regular verb. */
- REGULAR_VERB,
+ REGULAR_VERB("regular-verb"),
/** Matching word must be a regular adjective. */
- REGULAR_ADJECTIVE
+ REGULAR_ADJECTIVE("regular-adjective");
+
+ /** View of the underlying array that prevents it from being copied each time access is needed. */
+ private static final List<Type> AS_LIST = Arrays.asList(Type.values());
+ /** A descriptor suitable for use in configuration files. */
+
+ private String configDescriptor;
+
+ /**
+ * Constructor.
+ * @param configDescriptor A descriptor suitable for use in configuration files.
+ */
+ Type(final String configDescriptor) {
+ this.configDescriptor = configDescriptor;
+ }
+
+ /**
+ * Returns a descriptor suitable for use in configuration files.
+ * @return A descriptor suitable for use in configuration files.
+ */
+ public String getDescriptor() {
+ return this.configDescriptor;
+ }
+
+ /**
+ * Finds the instance of this enum, if any, matching {@code configDescriptor}.
+ * @param configDescriptor A descriptor suitable for use in configuration files.
+ * @return The instance of this enum matching {@code configDescriptor}, or null if not found.
+ */
+ public static Type fromConfigDescriptor(final String configDescriptor) {
+ for (int index = 0; index < AS_LIST.size(); index ++) {
+ final Type type = AS_LIST.get(index);
+ if (type.configDescriptor.equals(configDescriptor)) {
+ return type;
+ }
+ }
+ return null;
+ }
+
}
/** The type of words to which this rule applies. */
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java 2021-11-01 16:24:49 UTC (rev 11967)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java 2021-11-01 17:14:11 UTC (rev 11968)
@@ -83,6 +83,9 @@
/** 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<DerivativeRule>> derivativeRuleLists = new HashMap<String, List<DerivativeRule>>();
+
/**
* Constructor.
* @param config The configuration for this server.
@@ -308,7 +311,7 @@
}
/**
- * Returns the list of match rules for a given orthography.
+ * 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}.
*/
@@ -316,4 +319,25 @@
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<DerivativeRule> 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<DerivativeRule> getDerivativeRules(final String id) {
+ return this.derivativeRuleLists.get(id);
+ }
+
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-11-01 16:24:49 UTC (rev 11967)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-11-01 17:14:11 UTC (rev 11968)
@@ -41,6 +41,9 @@
/** 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;
@@ -74,6 +77,26 @@
}
/**
+ * 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.
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-01 16:24:51
|
Revision: 11967
http://sourceforge.net/p/foray/code/11967
Author: victormote
Date: 2021-11-01 16:24:49 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
Add class for storing derivative rules.
Added Paths:
-----------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DerivativeRule.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/DerivativeRuleTests.java
Added: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DerivativeRule.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DerivativeRule.java (rev 0)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DerivativeRule.java 2021-11-01 16:24:49 UTC (rev 11967)
@@ -0,0 +1,97 @@
+/*
+ * 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.hyphen;
+
+import java.util.regex.Pattern;
+
+/**
+ * A rule, 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 DerivativeRule {
+
+ /**
+ * Enumeration of the types of derivative rules.
+ */
+ public enum Type {
+ /** Matching word must be a regular noun. */
+ REGULAR_NOUN,
+
+ /** Matching word must be a regular verb. */
+ REGULAR_VERB,
+
+ /** Matching word must be a regular adjective. */
+ REGULAR_ADJECTIVE
+ }
+
+ /** The type of words to which this rule applies. */
+ private Type type;
+
+ /** The regex pattern to which input words must "match". */
+ private Pattern match;
+
+ /** The regex replacement string to obtain a possible root. */
+ private String replace;
+
+ /**
+ * Constructor.
+ * @param type The type of words to which this rule applies.
+ * @param match The regex pattern to which input words must "match".
+ * @param replace The regex replacement string to obtain a possible root.
+ */
+ public DerivativeRule(final Type type, final Pattern match, final String replace) {
+ /* Type is immutable. */
+ this.type = type;
+ /* Pattern is immutable. */
+ this.match = match;
+ /* String is immutable. */
+ this.replace = replace;
+ }
+
+ /**
+ * Returns the type of this derivative rule.
+ * @return The type of this derivative rule.
+ */
+ public Type getType() {
+ return this.type;
+ }
+
+ /**
+ * 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.
+ */
+ CharSequence applyRule(final CharSequence inputWord) {
+ return inputWord.toString().replaceAll(this.match.pattern(), replace);
+ }
+
+}
Property changes on: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DerivativeRule.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Added: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/DerivativeRuleTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/DerivativeRuleTests.java (rev 0)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/DerivativeRuleTests.java 2021-11-01 16:24:49 UTC (rev 11967)
@@ -0,0 +1,51 @@
+/*
+ * 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.hyphen;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.regex.Pattern;
+
+/**
+ * Tests of {@link DerivativeRule}.
+ */
+public class DerivativeRuleTests {
+
+ /**
+ * Test of {@link DerivativeRule#applyRule(CharSequence)}.
+ */
+ @Test
+ public void testApplyRule() {
+ final DerivativeRule out = new DerivativeRule(DerivativeRule.Type.REGULAR_VERB,
+ Pattern.compile("^([a-zA-Z\\-]+)ed$"), "$1");
+ Assert.assertEquals("trust", out.applyRule("trusted"));
+ }
+
+}
Property changes on: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/DerivativeRuleTests.java
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-11-01 16:21:53
|
Revision: 11966
http://sourceforge.net/p/foray/code/11966
Author: victormote
Date: 2021-11-01 16:21:50 +0000 (Mon, 01 Nov 2021)
Log Message:
-----------
Conform to aXSL change to Dictionary.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural1WordFactoryTests.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural2WordFactoryTests.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactoryTests.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactoryTests.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -31,6 +31,8 @@
import org.foray.common.data.TernaryTreeMap;
import org.axsl.hyphen.Dictionary;
+import org.axsl.hyphen.PartOfSpeech;
+import org.axsl.hyphen.Word;
import java.util.Arrays;
import java.util.HashSet;
@@ -118,6 +120,12 @@
return dictionary;
}
+ @Override
+ public Word getWord(final CharSequence rawWord, final PartOfSpeech pos) {
+ /* TODO: Implement PartOfSpeech logic. */
+ return getWord(rawWord);
+ }
+
/**
* Retrieves a word from this dictionary.
* @param rawWord The raw word whose word should be retrieved.
@@ -153,4 +161,5 @@
(TernaryTreeMap<SegmentDictionaryWord>) this.wordMap;
ternaryTreeMap.optimize();
}
+
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -500,7 +500,7 @@
* be handled. */
/* Is the word itself directly in the dictionary. */
- Word dictWord = dictionary.getWord(word);
+ Word dictWord = dictionary.getWord(word, null);
if (dictWord != null) {
return true;
}
@@ -512,7 +512,7 @@
/* If the first character is capitalized, convert to lowercase & check again. */
if (Character.isUpperCase(builder.charAt(0))) {
builder.setCharAt(0, Character.toLowerCase(builder.charAt(0)));
- dictWord = dictionary.getWord(builder);
+ dictWord = dictionary.getWord(builder, null);
}
if (dictWord != null) {
return true;
@@ -526,7 +526,7 @@
&& builder.charAt(builder.length() - 1) == '’') {
builder.deleteCharAt(builder.length() - 1);
}
- dictWord = dictionary.getWord(builder);
+ dictWord = dictionary.getWord(builder, null);
}
if (dictWord != null) {
return true;
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -53,7 +53,7 @@
final int qtyToRemove = LatinPast1Word.SUFFIX.length();
final String baseWordChars = CharSequenceUtils.removeTrailing(chars, qtyToRemove).toString();
- final Word baseWord = dictionary.getWord(baseWordChars);
+ final Word baseWord = dictionary.getWord(baseWordChars, null);
if (baseWord != null) {
return new LatinPast1Word(baseWord);
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -53,7 +53,7 @@
final int qtyToRemove = LatinPlural1Word.Segment.WRAPPED_FORM.length();
final String baseWordChars = CharSequenceUtils.removeTrailing(chars, qtyToRemove).toString();
- final Word baseWord = dictionary.getWord(baseWordChars);
+ final Word baseWord = dictionary.getWord(baseWordChars, null);
if (baseWord != null) {
return new LatinPlural1Word(baseWord);
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -72,7 +72,7 @@
builder.append('y');
final String baseWordChars = builder.toString();
- final Word baseWord = dictionary.getWord(baseWordChars);
+ final Word baseWord = dictionary.getWord(baseWordChars, null);
if (baseWord != null) {
return new LatinPlural2Word(baseWord);
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -53,7 +53,7 @@
final int qtyToRemove = LatinPossessive1Word.Segment.WRAPPED_FORM.length();
final String baseWordChars = CharSequenceUtils.removeTrailing(chars, qtyToRemove).toString();
- final Word baseWord = dictionary.getWord(baseWordChars);
+ final Word baseWord = dictionary.getWord(baseWordChars, null);
if (baseWord != null) {
return new LatinPossessive1Word(baseWord);
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -53,7 +53,7 @@
final int qtyToRemove = LatinPossessive2Word.Segment.WRAPPED_FORM.length();
final String baseWordChars = CharSequenceUtils.removeTrailing(chars, qtyToRemove).toString();
- final Word baseWord = dictionary.getWord(baseWordChars);
+ final Word baseWord = dictionary.getWord(baseWordChars, null);
if (baseWord != null) {
return new LatinPossessive2Word(baseWord);
}
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -55,7 +55,7 @@
public void before() {
this.out = new LatinPast1WordFactory();
this.dictionary = Mockito.mock(Dictionary.class);
- Mockito.when(dictionary.getWord("astonish")).thenReturn(StringWordTests.WORD_ASTONISH);
+ Mockito.when(dictionary.getWord("astonish", null)).thenReturn(StringWordTests.WORD_ASTONISH);
}
/**
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural1WordFactoryTests.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural1WordFactoryTests.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -55,7 +55,7 @@
public void before() {
this.out = new LatinPlural1WordFactory();
this.dictionary = Mockito.mock(Dictionary.class);
- Mockito.when(dictionary.getWord("daughter")).thenReturn(StringWordTests.WORD_DAUGHTER);
+ Mockito.when(dictionary.getWord("daughter", null)).thenReturn(StringWordTests.WORD_DAUGHTER);
}
/**
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural2WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural2WordFactoryTests.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural2WordFactoryTests.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -55,7 +55,7 @@
public void before() {
this.out = new LatinPlural2WordFactory();
this.dictionary = Mockito.mock(Dictionary.class);
- Mockito.when(dictionary.getWord("company")).thenReturn(StringWordTests.WORD_COMPANY);
+ Mockito.when(dictionary.getWord("company", null)).thenReturn(StringWordTests.WORD_COMPANY);
}
/**
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactoryTests.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactoryTests.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -55,7 +55,7 @@
public void before() {
this.out = new LatinPossessive1WordFactory();
this.dictionary = Mockito.mock(Dictionary.class);
- Mockito.when(dictionary.getWord("daughter")).thenReturn(StringWordTests.WORD_DAUGHTER);
+ Mockito.when(dictionary.getWord("daughter", null)).thenReturn(StringWordTests.WORD_DAUGHTER);
}
/**
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactoryTests.java 2021-10-30 20:01:08 UTC (rev 11965)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactoryTests.java 2021-11-01 16:21:50 UTC (rev 11966)
@@ -55,7 +55,7 @@
public void before() {
this.out = new LatinPossessive2WordFactory();
this.dictionary = Mockito.mock(Dictionary.class);
- Mockito.when(dictionary.getWord("daughter")).thenReturn(StringWordTests.WORD_DAUGHTER);
+ Mockito.when(dictionary.getWord("daughter", null)).thenReturn(StringWordTests.WORD_DAUGHTER);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-30 20:01:11
|
Revision: 11965
http://sourceforge.net/p/foray/code/11965
Author: victormote
Date: 2021-10-30 20:01:08 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
Push pattern-matching word handling out of the spell-checker code and into the configuration.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-10-30 16:59:56 UTC (rev 11964)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-10-30 20:01:08 UTC (rev 11965)
@@ -86,6 +86,9 @@
private HyphenationPatternsResource currentHyphenationPatternsResource;
/** Stateful variable. */
+ private List<Pattern> currentMatchRuleList;
+
+ /** Stateful variable. */
private List<WordWrapperFactory<?>> currentDerivateFactoryList;
/** Stateful variable. */
@@ -100,6 +103,9 @@
/** Stateful variable tracking the current orthography configuration. */
private transient OrthographyConfig currentOrthographyConfig;
+// /** The map of match rule lists, keyed by id. */
+// private Map<String, List<Pattern>> matchRuleLists = new HashMap<String, List<Pattern>>();
+//
/** The map of derivative factory lists, keyed by id. */
private Map<String, List<WordWrapperFactory<?>>> derivativeLists =
new HashMap<String, List<WordWrapperFactory<?>>>();
@@ -203,6 +209,12 @@
/* Nothing to do here. */
return;
}
+ if (localName.equals("match-rule-list")) {
+ final String id = attributes.getValue("id");
+ this.currentMatchRuleList = new ArrayList<Pattern>();
+ this.hyphenationServer.registerMatchRules(id, currentMatchRuleList);
+ return;
+ }
if (localName.equals("derivative-factory-list")) {
final String id = attributes.getValue("id");
this.currentDerivateFactoryList = new ArrayList<WordWrapperFactory<?>>();
@@ -255,6 +267,17 @@
}
return;
}
+ if (localName.equals("match-rules")) {
+ final String reference = attributes.getValue("reference");
+ final List<Pattern> patterns = this.hyphenationServer.getMatchRules(reference);
+ if (patterns == null) {
+ this.logger.error("match-rules not found: {}", reference);
+ this.logger.error(getContextMessage());
+ } else {
+ this.currentOrthographyConfig.registerMatchRuleListId(reference);
+ }
+ return;
+ }
if (localName.equals("derivative-factories")) {
final String reference = attributes.getValue("reference");
final List<WordWrapperFactory<?>> factories = this.derivativeLists.get(reference);
@@ -410,6 +433,17 @@
if (localName.equals("axsl-orthography-config")) {
return;
}
+ if (localName.equals("match-rule-list")) {
+ this.currentMatchRuleList = null;
+ return;
+ }
+ if (localName.equals("match")) {
+ final String matchString = this.textAccumulator.toString();
+ StringUtils.clear(this.textAccumulator);
+ final Pattern pattern = Pattern.compile(matchString);
+ this.currentMatchRuleList.add(pattern);
+ return;
+ }
if (localName.equals("derivative-factory-list")) {
this.currentDerivateFactoryList = null;
return;
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java 2021-10-30 16:59:56 UTC (rev 11964)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/HyphenationServer4a.java 2021-10-30 20:01:08 UTC (rev 11965)
@@ -55,7 +55,9 @@
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.
@@ -78,6 +80,9 @@
private Map<Orthography, OrthographyConfig> orthographyConfigurations =
new HashMap<Orthography, OrthographyConfig>();
+ /** The map of match rule lists, keyed by id. */
+ private Map<String, List<Pattern>> matchRuleLists = new HashMap<String, List<Pattern>>();
+
/**
* Constructor.
* @param config The configuration for this server.
@@ -290,4 +295,25 @@
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 orthography.
+ * @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);
+ }
+
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-10-30 16:59:56 UTC (rev 11964)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-10-30 20:01:08 UTC (rev 11965)
@@ -38,6 +38,9 @@
*/
public class OrthographyConfig {
+ /** 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 dictionary for this orthography.*/
private DictionaryResource dictionaryResource;
@@ -51,6 +54,26 @@
private WordBreaker wordBreaker;
/**
+ * 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 dictionary resource.
* @return The dictionary resource.
*/
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-30 16:59:56 UTC (rev 11964)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-30 20:01:08 UTC (rev 11965)
@@ -134,29 +134,6 @@
/** Format string for formatting the current location. */
private static final String LOCATION_FORMAT_STRING = "(%1$d:%2$d)";
- /** The list of patterns for which matching words should NOT be considered as misspelled. */
- private static final List<Pattern> VALID_WORD_PATTERNS = new ArrayList<Pattern>();
- static {
- /* The word is all Arabic digits. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]+$"));
- /* The word is all uppercase Roman numeral characters. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[IVXLCDM]+$"));
- /* The word is all lowercase Roman numeral characters. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[ivxlcdm]+$"));
- /* The word is currency. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[$£][0-9]+[0-9,\\.]*$"));
- /* The word is an English ordinal ending in 1. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]*1st$"));
- /* The word is an English ordinal ending in 2. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]*2n?d$"));
- /* The word is an English ordinal ending in 3. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]*3r?d$"));
- /* The word is an English ordinal ending in 0 or 4 thru 9. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]*[04-9]th$"));
- /* The word is a single capital letter, such as a person's initial. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[A-Z]$"));
- }
-
/** The input source to be spell-checked. */
private InputSource input;
@@ -472,11 +449,16 @@
}
/* Check against patterns that are considered to be valid words, but that are not in the dictionary. */
- for (int index = 0; index < VALID_WORD_PATTERNS.size(); index ++) {
- final Pattern pattern = VALID_WORD_PATTERNS.get(index);
- final Matcher matcher = pattern.matcher(word);
- if (matcher.matches()) {
- return;
+ final List<String> matchRuleListIds = this.currentOrthographyConfig.getMatchRuleListIds();
+ for (int idIndex = 0; idIndex < matchRuleListIds.size(); idIndex ++) {
+ final String ruleListId = matchRuleListIds.get(idIndex);
+ final List<Pattern> validWordPatterns = this.server.getMatchRules(ruleListId);
+ for (int index = 0; index < validWordPatterns.size(); index ++) {
+ final Pattern pattern = validWordPatterns.get(index);
+ final Matcher matcher = pattern.matcher(word);
+ if (matcher.matches()) {
+ return;
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-30 16:59:58
|
Revision: 11964
http://sourceforge.net/p/foray/code/11964
Author: victormote
Date: 2021-10-30 16:59:56 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
Use new aXSL interfaces for Dictionary and WordFactory.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/WordWrapperFactory.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural1WordFactoryTests.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural2WordFactoryTests.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactoryTests.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactoryTests.java
Removed Paths:
-------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/Dictionary.java
Deleted: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/Dictionary.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/Dictionary.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/Dictionary.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -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.hyphen;
-
-import org.axsl.hyphen.Word;
-
-import java.io.Serializable;
-
-/**
- * A collection of natural-language words, possibly useful for hyphenation, spell-checking, etc.
- */
-public interface Dictionary extends Serializable {
-
- /**
- * Retrieves a word from this dictionary.
- * @param wordString The String whose word should be retrieved.
- * @return The word matching {@code wordString}, or null if none is found.
- */
- Word getWord(CharSequence wordString);
-
-}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/OrthographyConfig.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -28,6 +28,8 @@
package org.foray.hyphen;
+import org.axsl.hyphen.Dictionary;
+
import java.util.ArrayList;
import java.util.List;
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SegmentDictionary.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -30,6 +30,8 @@
import org.foray.common.data.TernaryTreeMap;
+import org.axsl.hyphen.Dictionary;
+
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -36,6 +36,7 @@
import org.foray.common.primitive.XmlUtils;
import org.axsl.common.i18n.Orthography;
+import org.axsl.hyphen.Dictionary;
import org.axsl.hyphen.HyphenationException;
import org.axsl.hyphen.Word;
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/WordWrapperFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/WordWrapperFactory.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/WordWrapperFactory.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -28,11 +28,14 @@
package org.foray.hyphen;
+import org.axsl.hyphen.Dictionary;
+import org.axsl.hyphen.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> {
+public abstract class WordWrapperFactory<T extends WordWrapper> implements WordFactory<T> {
/**
* Checks a word against the pattern for this word wrapper, and creates an instance of it if there is a match.
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPast1WordFactory.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -29,9 +29,9 @@
package org.foray.hyphen.wrapper;
import org.foray.common.primitive.CharSequenceUtils;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.WordWrapperFactory;
+import org.axsl.hyphen.Dictionary;
import org.axsl.hyphen.Word;
/**
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural1WordFactory.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -29,9 +29,9 @@
package org.foray.hyphen.wrapper;
import org.foray.common.primitive.CharSequenceUtils;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.WordWrapperFactory;
+import org.axsl.hyphen.Dictionary;
import org.axsl.hyphen.Word;
/**
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPlural2WordFactory.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -29,9 +29,9 @@
package org.foray.hyphen.wrapper;
import org.foray.common.primitive.CharSequenceUtils;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.WordWrapperFactory;
+import org.axsl.hyphen.Dictionary;
import org.axsl.hyphen.Word;
/**
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactory.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -29,9 +29,9 @@
package org.foray.hyphen.wrapper;
import org.foray.common.primitive.CharSequenceUtils;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.WordWrapperFactory;
+import org.axsl.hyphen.Dictionary;
import org.axsl.hyphen.Word;
/**
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactory.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -29,9 +29,9 @@
package org.foray.hyphen.wrapper;
import org.foray.common.primitive.CharSequenceUtils;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.WordWrapperFactory;
+import org.axsl.hyphen.Dictionary;
import org.axsl.hyphen.Word;
/**
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPast1WordFactoryTests.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -28,9 +28,10 @@
package org.foray.hyphen.wrapper;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.StringWordTests;
+import org.axsl.hyphen.Dictionary;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural1WordFactoryTests.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural1WordFactoryTests.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -28,9 +28,10 @@
package org.foray.hyphen.wrapper;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.StringWordTests;
+import org.axsl.hyphen.Dictionary;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural2WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural2WordFactoryTests.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPlural2WordFactoryTests.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -28,9 +28,10 @@
package org.foray.hyphen.wrapper;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.StringWordTests;
+import org.axsl.hyphen.Dictionary;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactoryTests.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive1WordFactoryTests.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -28,9 +28,10 @@
package org.foray.hyphen.wrapper;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.StringWordTests;
+import org.axsl.hyphen.Dictionary;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactoryTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactoryTests.java 2021-10-30 15:36:57 UTC (rev 11963)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/wrapper/LatinPossessive2WordFactoryTests.java 2021-10-30 16:59:56 UTC (rev 11964)
@@ -28,9 +28,10 @@
package org.foray.hyphen.wrapper;
-import org.foray.hyphen.Dictionary;
import org.foray.hyphen.StringWordTests;
+import org.axsl.hyphen.Dictionary;
+
import org.junit.Assert;
import org.junit.Before;
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-10-30 15:36:59
|
Revision: 11963
http://sourceforge.net/p/foray/code/11963
Author: victormote
Date: 2021-10-30 15:36:57 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
1. Conform to changes to aXSL dictionary DTD. 2. Convert remaining instances of "word-list" to dictionary.
Modified Paths:
--------------
trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java
trunk/foray/foray-core/src/main/java/org/foray/core/SessionConfig.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/zzarchive/PatGen.java
trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/HyphenationServer4aTests.java
trunk/foray/foray-hyphen/src/test/resources/orthography-config.xml
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-10-30 15:35:41 UTC (rev 11962)
+++ trunk/foray/foray-app/src/main/java/org/foray/app/ForaySpecific.java 2021-10-30 15:36:57 UTC (rev 11963)
@@ -167,7 +167,7 @@
public static HyphenationServer makeHyphenationServer(final SessionConfig configuration) throws ForayException {
final HyphenationServerConfig config = new HyphenationServerConfig();
config.setOrthographyConfigurationLocation(configuration.optionOrthographyConfiguration());
- config.setWordListsBaseDirectory(configuration.optionWordListsBaseDirectory());
+ config.setWordListsBaseDirectory(configuration.optionDictionariesBaseDirectory());
config.setSerializedDictionariesBaseDirectory(configuration.optionSerializedDictionariesBaseDirectory());
config.setRawHyphenationPatternsBaseDirectory(configuration.optionRawHyphenationPatternsBaseDirectory());
config.setSerializedHyphenationPatternsBaseDirectory(
Modified: trunk/foray/foray-core/src/main/java/org/foray/core/SessionConfig.java
===================================================================
--- trunk/foray/foray-core/src/main/java/org/foray/core/SessionConfig.java 2021-10-30 15:35:41 UTC (rev 11962)
+++ trunk/foray/foray-core/src/main/java/org/foray/core/SessionConfig.java 2021-10-30 15:36:57 UTC (rev 11963)
@@ -47,7 +47,7 @@
public static final String ORTHOGRAPHY_CONFIG_KEY = "orthography-configuration";
/** The key value for finding the word lists base directory. */
- public static final String WORD_LISTS_BASE_DIRECTORY_KEY = "word-lists-base-directory";
+ public static final String DICTIONARIES_BASE_DIRECTORY_KEY = "dictionaries-base-directory";
/** The key value for finding the serialized dictionaries base directory. */
public static final String SERIALIZED_DICTIONARIES_BASE_DIRECTORY_KEY = "serialized-dictionaries-base-directory";
@@ -113,7 +113,7 @@
}
if (key.equals("base-directory")
|| key.equals("font-base-directory")
- || key.equals(SessionConfig.WORD_LISTS_BASE_DIRECTORY_KEY)
+ || key.equals(SessionConfig.DICTIONARIES_BASE_DIRECTORY_KEY)
|| key.equals(SessionConfig.SERIALIZED_DICTIONARIES_BASE_DIRECTORY_KEY)
|| key.equals(SessionConfig.RAW_HYPHENATION_PATTERNS_BASE_DIRECTORY_KEY)
|| key.equals(SessionConfig.SERIALIZED_HYPHENATION_PATTERNS_BASE_DIRECTORY_KEY)) {
@@ -223,11 +223,11 @@
}
/**
- * Returns the "word-lists-base-directory" configuration item.
- * @return The "word-lists-base-directory" configuration item.
+ * Returns the "dictionaries-base-directory" configuration item.
+ * @return The "dictionaries-base-directory" configuration item.
*/
- public URL optionWordListsBaseDirectory() {
- final URL value = (URL) getValue(SessionConfig.WORD_LISTS_BASE_DIRECTORY_KEY);
+ public URL optionDictionariesBaseDirectory() {
+ final URL value = (URL) getValue(SessionConfig.DICTIONARIES_BASE_DIRECTORY_KEY);
if (value == null) {
return optionBaseDirectory();
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-10-30 15:35:41 UTC (rev 11962)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/ConfigParser.java 2021-10-30 15:36:57 UTC (rev 11963)
@@ -290,11 +290,11 @@
}
return;
}
- if (localName.equals("unparsed-word-list")) {
+ if (localName.equals("unparsed-dictionary")) {
/* All processing is done at endElement. */
return;
}
- if (localName.equals("word-list-element")) {
+ if (localName.equals("dictionary-element")) {
this.currentWordListElement = this.currentDictionaryResource.new WordListElement();
this.currentDictionaryResource.addWordListElement(this.currentWordListElement);
return;
@@ -476,10 +476,10 @@
this.currentResourceLocation = null;
return;
}
- if (localName.equals("unparsed-word-list")) {
+ if (localName.equals("unparsed-dictionary")) {
return;
}
- if (localName.equals("word-list-element")) {
+ if (localName.equals("dictionary-element")) {
this.currentWordListElement = null;
return;
}
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/zzarchive/PatGen.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/zzarchive/PatGen.java 2021-10-30 15:35:41 UTC (rev 11962)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/zzarchive/PatGen.java 2021-10-30 15:36:57 UTC (rev 11963)
@@ -3645,7 +3645,7 @@
private static Options getCommandLineOptions() {
final Options clOptions = new Options();
- final Option dictionary = new Option("dictionary", true, "path to the input dictionary (word-list)");
+ final Option dictionary = new Option("dictionary", true, "path to the input dictionary");
dictionary.setRequired(true);
dictionary.setArgName("file");
clOptions.addOption(dictionary);
@@ -3673,7 +3673,7 @@
* @param args The command-line arguments.
* There are four possible:
* <ul>
- * <li>-dictionary [file] path to the input dictionary (word-list)</li>
+ * <li>-dictionary [file] path to the input dictionary</li>
* <li>-patterns [file] path to the existing patterns file (optional)</li>
* <li>-translate [file] path to the translate file (optional)</li>
* <li>-patout [file] path to the output patterns file</li>
Modified: trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/HyphenationServer4aTests.java
===================================================================
--- trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/HyphenationServer4aTests.java 2021-10-30 15:35:41 UTC (rev 11962)
+++ trunk/foray/foray-hyphen/src/test/java/org/foray/hyphen/HyphenationServer4aTests.java 2021-10-30 15:36:57 UTC (rev 11963)
@@ -71,7 +71,7 @@
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/word-lists/";
+ final String rawDictionaryPath = foraySandbox + "/foray-hyphen/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";
Modified: trunk/foray/foray-hyphen/src/test/resources/orthography-config.xml
===================================================================
--- trunk/foray/foray-hyphen/src/test/resources/orthography-config.xml 2021-10-30 15:35:41 UTC (rev 11962)
+++ trunk/foray/foray-hyphen/src/test/resources/orthography-config.xml 2021-10-30 15:36:57 UTC (rev 11963)
@@ -6,7 +6,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 word-list-url can be absolute or relative. The values in this file are relative, starting 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.
-->
@@ -23,17 +23,17 @@
<dictionary-resource id="dictionary-eng-moby">
<parsed-resource>
- <resource-location type="classpath">/resources/org/foray/dictionaries/en-moby.jbso</resource-location>
+ <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-word-list-moby.jbso</resource-location>
+ <resource-location type="url">file:../foray-hyphen/src/main/resources/resources/org/foray/dictionaries/eng-999-Latn.jbso</resource-location>
</parsed-resource>
- <unparsed-word-list>
- <word-list-element>
- <resource-location type="url">file:../foray-hyphen/src/main/data/word-lists/eng-word-list-moby.txt</resource-location>
+ <unparsed-dictionary>
+ <dictionary-element>
+ <resource-location type="url">file:../foray-hyphen/src/main/data/dictionaries/eng-999-Latn.dict.xml</resource-location>
<exclusion regex-pattern="^[A-Z]"/>
- </word-list-element>
- </unparsed-word-list>
+ </dictionary-element>
+ </unparsed-dictionary>
</dictionary-resource>
<hyphenation-patterns-resource id="hyph-patterns-eng">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-30 15:35:43
|
Revision: 11962
http://sourceforge.net/p/foray/code/11962
Author: victormote
Date: 2021-10-30 15:35:41 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
Fix javadoc problems.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DictionaryParserXml.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DictionaryParserXml.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DictionaryParserXml.java 2021-10-30 15:35:07 UTC (rev 11961)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DictionaryParserXml.java 2021-10-30 15:35:41 UTC (rev 11962)
@@ -131,8 +131,8 @@
* @param description Description of {@literal inputStream}, useful for user messages.
* @throws IOException For IO errors during parsing.
* @return The parsed dictionary.
- * @throws ParserConfigurationException
- * @throws SAXException
+ * @throws ParserConfigurationException For errors during parser configuration.
+ * @throws SAXException For errors found by the SAX parser.
*/
public List<SegmentDictionary> parse(final InputSource inputSource, final String description)
throws IOException, SAXException, ParserConfigurationException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-30 15:35:09
|
Revision: 11961
http://sourceforge.net/p/foray/code/11961
Author: victormote
Date: 2021-10-30 15:35:07 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
Fix javadoc and character encoding problems.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-30 15:31:38 UTC (rev 11960)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-30 15:35:07 UTC (rev 11961)
@@ -63,7 +63,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
-import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -144,7 +143,7 @@
/* The word is all lowercase Roman numeral characters. */
VALID_WORD_PATTERNS.add(Pattern.compile("^[ivxlcdm]+$"));
/* The word is currency. */
- VALID_WORD_PATTERNS.add(Pattern.compile("^[$\xA3][0-9]+[0-9,\\.]*$"));
+ VALID_WORD_PATTERNS.add(Pattern.compile("^[$£][0-9]+[0-9,\\.]*$"));
/* The word is an English ordinal ending in 1. */
VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]*1st$"));
/* The word is an English ordinal ending in 2. */
@@ -204,9 +203,9 @@
* 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 ParserConfigurationException
- * @throws SAXException
- * @throws URISyntaxException
+ * @throws IOException For input/output errors during parsing.
+ * @throws ParserConfigurationException For errors configuring the parser.
+ * @throws SAXException For errors found by the SAX parser.
*/
public SpellChecker(final InputSource input, final PrintStream output, final URL orthographyConfigPath,
final List<URL> adhocDictionaryPaths)
@@ -541,7 +540,7 @@
if (builder.charAt(builder.length() - 1) == 's') {
builder.deleteCharAt(builder.length() - 1);
if (builder.length() > 0
- && builder.charAt(builder.length() - 1) == '\x92') {
+ && builder.charAt(builder.length() - 1) == '’') {
builder.deleteCharAt(builder.length() - 1);
}
dictWord = dictionary.getWord(builder);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-30 15:31:53
|
Revision: 11960
http://sourceforge.net/p/foray/code/11960
Author: victormote
Date: 2021-10-30 15:31:38 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
Fix javadoc problem.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTree.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTree.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTree.java 2021-10-30 15:30:26 UTC (rev 11959)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/data/TernaryTree.java 2021-10-30 15:31:38 UTC (rev 11960)
@@ -769,7 +769,7 @@
* The key is not, as such, stored directly in the tree.
* It can be obtained one of two ways:
* 1. Spending the memory to track the parent of each node.
- * This approach is used in {@link #recoverKey(TernaryNodeParents, int).
+ * This approach is used in {@link #recoverKey(TernaryNodeParents, int)}.
* 2. As an iterator traverses the tree, it can accumulate the keyChars from each node, which is the approach
* assumed by this method.
* The accumulated keyChars are passed to this method as {@code cumulativeKey}.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-30 15:30:29
|
Revision: 11959
http://sourceforge.net/p/foray/code/11959
Author: victormote
Date: 2021-10-30 15:30:26 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
Tell javadoc that input files are UTF-8.
Modified Paths:
--------------
trunk/foray/master/build.gradle
trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch
Modified: trunk/foray/master/build.gradle
===================================================================
--- trunk/foray/master/build.gradle 2021-10-30 13:07:44 UTC (rev 11958)
+++ trunk/foray/master/build.gradle 2021-10-30 15:30:26 UTC (rev 11959)
@@ -155,6 +155,7 @@
/* Configure the common parts of the project javadocs. */
javadoc {
failOnError = true
+ options.encoding = 'UTF-8'
options.author = false
options.version = true
options.use = true
Modified: trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch
===================================================================
--- trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2021-10-30 13:07:44 UTC (rev 11958)
+++ trunk/foray/master/ide/eclipse/launch-configurations/DictionarySerializer.launch 2021-10-30 15:30:26 UTC (rev 11959)
@@ -15,6 +15,7 @@
</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.PROGRAM_ARGUMENTS" value="--input ${project_loc}/src/main/data/word-lists --output ${project_loc}/src/main/resources/resources/org/foray/dictionaries --pattern "eng-word-list-moby.txt""/>
+ <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="foray-hyphen"/>
+ <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"/>
</launchConfiguration>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-30 13:00:47
|
Revision: 11957
http://sourceforge.net/p/foray/code/11957
Author: victormote
Date: 2021-10-30 13:00:46 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
Rename directory for clarity.
Added Paths:
-----------
trunk/foray/foray-hyphen/src/main/data/dictionaries/
Removed Paths:
-------------
trunk/foray/foray-hyphen/src/main/data/word-lists/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-30 12:07:30
|
Revision: 11955
http://sourceforge.net/p/foray/code/11955
Author: victormote
Date: 2021-10-30 12:07:28 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
Include the dictionary DTD in the resolvable items.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/AxslDtdUtil.java
Modified: trunk/foray/foray-common/src/main/java/org/foray/common/AxslDtdUtil.java
===================================================================
--- trunk/foray/foray-common/src/main/java/org/foray/common/AxslDtdUtil.java 2021-10-30 00:17:56 UTC (rev 11954)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/AxslDtdUtil.java 2021-10-30 12:07:28 UTC (rev 11955)
@@ -46,8 +46,8 @@
/** The public id of the "hyphenation" DTD. */
public static final String HYPHENATION_PUBLIC_ID = "-//aXSL//DTD Hyphenation V0.1//EN";
- /** The public id of the "word list" DTD. */
- public static final String WORD_LIST_PUBLIC_ID = "-//aXSL//DTD Word List V0.1//EN";
+ /** The public id of the "dictionary" DTD. */
+ public static final String DICTIONARY_PUBLIC_ID = "-//aXSL//DTD Dictionary V0.1//EN";
/** The public id of the "font config" DTD. */
public static final String FONT_CONFIG_PUBLIC_ID = "-//aXSL//DTD Font Configuration V0.1//EN";
@@ -86,8 +86,8 @@
inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-natural-language.dtd");
} else if (AxslDtdUtil.HYPHENATION_PUBLIC_ID.equals(publicId)) {
inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-hyphenation.dtd");
- } else if (AxslDtdUtil.WORD_LIST_PUBLIC_ID.equals(publicId)) {
- inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-word-list.dtd");
+ } else if (AxslDtdUtil.DICTIONARY_PUBLIC_ID.equals(publicId)) {
+ inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-dictionary.dtd");
} else if (AxslDtdUtil.FONT_CONFIG_PUBLIC_ID.equals(publicId)) {
inputStream = AxslDtdUtil.getAxslDtdAsInputStream("axsl-font-config.dtd");
} else if (AxslDtdUtil.ORTHOGRAPHY_CONFIG_PUBLIC_ID.equals(publicId)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-30 00:17:57
|
Revision: 11954
http://sourceforge.net/p/foray/code/11954
Author: victormote
Date: 2021-10-30 00:17:56 +0000 (Sat, 30 Oct 2021)
Log Message:
-----------
Add methods simplifying obtaining Country and Orthography instances.
Modified Paths:
--------------
trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Country4a.java
trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.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-10-29 16:40:35 UTC (rev 11953)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Country4a.java 2021-10-30 00:17:56 UTC (rev 11954)
@@ -416,6 +416,15 @@
return theInstance;
}
theInstance = findFrom3Char(normalizedCountryCode);
+ if (theInstance != null) {
+ return theInstance;
+ }
+ try {
+ final int numericCode = Integer.parseInt(countryCode);
+ theInstance = findFromNumeric(numericCode);
+ } catch (final NumberFormatException e) {
+ /* The parameter is not an integer. This is not an error, just an indication that this path is not valid. */
+ }
return theInstance;
}
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-10-29 16:40:35 UTC (rev 11953)
+++ trunk/foray/foray-common/src/main/java/org/foray/common/i18n/Orthography4a.java 2021-10-30 00:17:56 UTC (rev 11954)
@@ -152,6 +152,21 @@
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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-28 20:35:27
|
Revision: 11951
http://sourceforge.net/p/foray/code/11951
Author: victormote
Date: 2021-10-28 20:35:25 +0000 (Thu, 28 Oct 2021)
Log Message:
-----------
1. Remove no-longer-needed file. 2. Rename archaic word list to new file naming standard.
Added Paths:
-----------
trunk/foray/foray-hyphen/src/main/data/word-lists/eng-999-latn-archaic.word-list.xml
Removed Paths:
-------------
trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list.txt
trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt
Copied: trunk/foray/foray-hyphen/src/main/data/word-lists/eng-999-latn-archaic.word-list.xml (from rev 11949, trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt)
===================================================================
--- trunk/foray/foray-hyphen/src/main/data/word-lists/eng-999-latn-archaic.word-list.xml (rev 0)
+++ trunk/foray/foray-hyphen/src/main/data/word-lists/eng-999-latn-archaic.word-list.xml 2021-10-28 20:35:25 UTC (rev 11951)
@@ -0,0 +1,3 @@
+pre"\xEBm"i"nence
+seek"est
+speak"eth
Deleted: trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list.txt
===================================================================
--- trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list.txt 2021-10-28 20:33:14 UTC (rev 11950)
+++ trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list.txt 2021-10-28 20:35:25 UTC (rev 11951)
@@ -1,11 +0,0 @@
-# English (eng) word list with discretionary hyphens marked.
-# This file was created on an ad-hoc basis, and is in the public domain.
-# It may be freely supplemented or used in any way.
-
-com-put-er
-fre-quen-cy
-in-quire
-pass-port
-star-light
-
-# Last Line of File
Deleted: trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt
===================================================================
--- trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt 2021-10-28 20:33:14 UTC (rev 11950)
+++ trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt 2021-10-28 20:35:25 UTC (rev 11951)
@@ -1,3 +0,0 @@
-pre"\xEBm"i"nence
-seek"est
-speak"eth
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-27 18:01:41
|
Revision: 11949
http://sourceforge.net/p/foray/code/11949
Author: victormote
Date: 2021-10-27 18:01:38 +0000 (Wed, 27 Oct 2021)
Log Message:
-----------
Add patterns for ordinal expressions.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list-moby.txt
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Added Paths:
-----------
trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt
Modified: trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list-moby.txt
===================================================================
--- trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list-moby.txt 2021-10-27 16:15:02 UTC (rev 11948)
+++ trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list-moby.txt 2021-10-27 18:01:38 UTC (rev 11949)
@@ -365,7 +365,6 @@
ab"sorb"ing"ly
ab"sorp"tance
ab"sorp"tion
-ab"sorp"tion fac"tor
ab"sorp"tion spec"trum
ab"sorp"tive
ab"sorp"tive"ness
@@ -30291,7 +30290,6 @@
com"mon di"vi"sor
Com"mon En"trance
Com"mon E"ra
-com"mon fac"tor
com"mon fee
com"mon frac"tion
com"mon good
@@ -32793,7 +32791,6 @@
corn bun"ting
corn ear"worm
corn ex"change
-corn fac"tor
corn lil"y
corn mar"i"gold
corn pop"py
@@ -69520,7 +69517,7 @@
high"er ed"u"ca"tion
high"er math"e"mat"ics
high"er-up
-high"est com"mon fac"tor
+high"est
High"et
high"fa"lu"tin
high"fa"lu"tin'
@@ -71018,7 +71015,6 @@
house
house ar"rest
house a"gent
-house fac"tor
house mar"tin
House of As"sem"bly
House of Com"mons
@@ -81953,7 +81949,6 @@
jun"ior
Jun"ior
jun"ior col"lege
-jun"ior com"mon room
jun"ior light"weight
jun"ior mid"dle"weight
jun"ior school
@@ -88623,7 +88618,6 @@
loach
load
load dis"place"ment
-load fac"tor
load shed"ding
loads
load"ed
@@ -94990,7 +94984,6 @@
Mid"dle A"mer"i"ca
mid"dle C
mid"dle class
-mid"dle com"mon room
Mid"dle Con"go
Mid"dle Dutch
mid"dle ear
@@ -98799,7 +98792,6 @@
mul"ti"plat"ed
mul"ti"ple
mul"ti"ple al"leles
-mul"ti"ple fac"tors
mul"ti"ple fruit
mul"ti"ple per"son"al"i"ty
mul"ti"ple scle"ro"sis
@@ -135183,7 +135175,6 @@
re"flec"tance
re"flec"tion
re"flec"tion den"si"ty
-re"flec"tion fac"tor
re"flec"tive
re"flec"tive"ly
re"flec"tive"ness
@@ -137923,7 +137914,7 @@
RFC
RGS
Rgt
-Rh fac"tor
+Rh
Rh neg"a"tive
Rh pos"i"tive
Rh-neg"a"tive
@@ -138024,7 +138015,7 @@
rhe"sian
Rhe"sus
rhe"sus ba"by
-rhe"sus fac"tor
+rhe"sus
rhe"sus mon"key
Rhe"tian
Rhe"tic
@@ -140327,7 +140318,6 @@
safe"ty
safe"ty belt
safe"ty cur"tain
-safe"ty fac"tor
safe"ty film
safe"ty fuse
safe"ty glass
@@ -145032,7 +145022,6 @@
Sen"ior
sen"ior
sen"ior cit"i"zen
-sen"ior com"mon room
sen"ior"i"ty
Sen"lac
sen"na
@@ -179176,7 +179165,6 @@
u"nit
u"nit cell
u"nit char"ac"ter
-u"nit fac"tor
u"nit mag"net"ic pole
u"nit of ac"count
u"nit price
Added: trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt
===================================================================
--- trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt (rev 0)
+++ trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt 2021-10-27 18:01:38 UTC (rev 11949)
@@ -0,0 +1,3 @@
+pre"\xEBm"i"nence
+seek"est
+speak"eth
Property changes on: trunk/foray/foray-hyphen/src/main/data/word-lists/eng-xx-archaic-word-list.txt
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Rev
\ No newline at end of property
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-27 16:15:02 UTC (rev 11948)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-27 18:01:38 UTC (rev 11949)
@@ -145,6 +145,14 @@
VALID_WORD_PATTERNS.add(Pattern.compile("^[ivxlcdm]+$"));
/* The word is currency. */
VALID_WORD_PATTERNS.add(Pattern.compile("^[$\xA3][0-9]+[0-9,\\.]*$"));
+ /* The word is an English ordinal ending in 1. */
+ VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]*1st$"));
+ /* The word is an English ordinal ending in 2. */
+ VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]*2n?d$"));
+ /* The word is an English ordinal ending in 3. */
+ VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]*3r?d$"));
+ /* The word is an English ordinal ending in 0 or 4 thru 9. */
+ VALID_WORD_PATTERNS.add(Pattern.compile("^[0-9]*[04-9]th$"));
/* The word is a single capital letter, such as a person's initial. */
VALID_WORD_PATTERNS.add(Pattern.compile("^[A-Z]$"));
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-27 16:15:05
|
Revision: 11948
http://sourceforge.net/p/foray/code/11948
Author: victormote
Date: 2021-10-27 16:15:02 +0000 (Wed, 27 Oct 2021)
Log Message:
-----------
Add location information to flagged items.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-27 15:33:18 UTC (rev 11947)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-27 16:15:02 UTC (rev 11948)
@@ -131,6 +131,9 @@
/** Command-line return status constant indicating that there was an error parsing the input file. */
public static final byte STATUS_PARSING_ERROR = 3;
+ /** Format string for formatting the current location. */
+ private static final String LOCATION_FORMAT_STRING = "(%1$d:%2$d)";
+
/** The list of patterns for which matching words should NOT be considered as misspelled. */
private static final List<Pattern> VALID_WORD_PATTERNS = new ArrayList<Pattern>();
static {
@@ -339,10 +342,7 @@
if (languageAttr == null) {
if (this.currentOrthographyConfig == null) {
- final String message = String.format(
- "Line %1$d, Column %2$d: Orthography not specified.",
- this.locator.getLineNumber(), this.locator.getColumnNumber());
- this.output.println(message);
+ this.output.println("Orthography not specified. " + this.locationString());
}
} else {
/* Is there a country code? */
@@ -363,19 +363,16 @@
element.orthography = Orthography4a.find(language, country, script);
if (element.orthography == null) {
final String message = String.format(
- "Line %1$d, Column %2$d: Orthography not found. Language: %3$s, Country: %4$s, Script: %5$s",
- this.locator.getLineNumber(), this.locator.getColumnNumber(), languageString, countryString,
- script.getAlphaCode());
- this.output.println(message);
+ "Orthography not found. Language: %1$s, Country: %2$s, Script: %3$s ", languageString,
+ countryString, script.getAlphaCode());
+ this.output.println(message + locationString());
} else {
final OrthographyConfig config = this.server.getOrthographyConfig(element.orthography);
if (config == null) {
final String message = String.format(
- "Line %1$d, Column %2$d: Unconfigured orthography. Language: %3$s, Country: %4$s,"
- + " Script: %5$s",
- this.locator.getLineNumber(), this.locator.getColumnNumber(), languageString, countryString,
- script.getAlphaCode());
- this.output.println(message);
+ "Unconfigured orthography. Language: %1$s, Country: %2$s, Script: %3$s ",
+ languageString, countryString, script.getAlphaCode());
+ this.output.println(message + locationString());
} else {
element.orthographyConfig = config;
}
@@ -430,6 +427,14 @@
/**
+ * Returns the current location in the input document as a formatted string.
+ * @return The current location in the input document as a formatted string.
+ */
+ private String locationString() {
+ return String.format(LOCATION_FORMAT_STRING, this.locator.getLineNumber(), this.locator.getColumnNumber());
+ }
+
+ /**
* Spell-check each word in a sequence of words.
* @param words The words to be checked.
*/
@@ -482,7 +487,7 @@
this.output.println("(no dictionary) " + word);
} else {
if (! wordFound(dictionary, word)) {
- this.output.println("Not found: " + word);
+ this.output.println("Not found: " + word + " " + locationString());
this.notFoundCounter ++;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-27 15:33:20
|
Revision: 11947
http://sourceforge.net/p/foray/code/11947
Author: victormote
Date: 2021-10-27 15:33:18 +0000 (Wed, 27 Oct 2021)
Log Message:
-----------
Add capability of checking against ad-hoc dictionaries.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list-moby.txt
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
Modified: trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list-moby.txt
===================================================================
--- trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list-moby.txt 2021-10-27 15:32:34 UTC (rev 11946)
+++ trunk/foray/foray-hyphen/src/main/data/word-lists/eng-word-list-moby.txt 2021-10-27 15:33:18 UTC (rev 11947)
@@ -27279,6 +27279,7 @@
chris"mon
chris"om
Chris"sie
+Christ
Chris"ta"bel
Chris"ta"del"phi"an
chris"ten
@@ -43341,6 +43342,7 @@
di"dym"i"um
di"dyn"a"mous
di"dyn"a"my
+died
di"ene
di"en"ceph"a"lon
di"en"ce"phal"ic
@@ -94190,7 +94192,7 @@
mes"sieurs
mes"sin
Mes"sines
-Mes"si"ah
+mes"si"ah
mes"si"an"ic
Mes"si"an"i"cal"ly
Mes"si"dor
@@ -138711,6 +138713,7 @@
road"less"ness
road"roll"er
road"run"ner
+road"side
road"stead
road"ster
road"way
@@ -179527,6 +179530,7 @@
V-eight
V-sign
V-type en"gine
+Va # Abbreviation for Virginia
Vaal
Vaa"sa
vac
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-27 15:32:34 UTC (rev 11946)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/SpellChecker.java 2021-10-27 15:33:18 UTC (rev 11947)
@@ -63,6 +63,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -178,7 +179,7 @@
private List<String> elementIgnoreList = Arrays.asList(new String[] {"Page"});
/** The list of dictionaries that are currently active, i.e. that match the current orthography. */
-// private List<Dictionary> currentDictionaries;
+ private List<Dictionary> currentDictionaries = new ArrayList<Dictionary>();
/** The counter for "Not found" words. */
private int notFoundCounter = 0;
@@ -188,10 +189,15 @@
* @param input The input source encapsulating the document to be spell-checked.
* @param output The output stream to which the spelling errors should be written.
* @param orthographyConfigPath The path to the orthography configuration.
+ * @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 URISyntaxException
*/
- public SpellChecker(final InputSource input, final PrintStream output, final URL orthographyConfigPath)
- throws HyphenationException {
+ public SpellChecker(final InputSource input, final PrintStream output, final URL orthographyConfigPath,
+ final List<URL> adhocDictionaryPaths)
+ throws HyphenationException, IOException {
this.input = input;
this.output = output;
@@ -198,6 +204,15 @@
final HyphenationServerConfig serverConfig = new HyphenationServerConfig();
serverConfig.setOrthographyConfigurationLocation(orthographyConfigPath);
this.server = new HyphenationServer4a(serverConfig);
+
+ if (adhocDictionaryPaths != null) {
+ for (URL adhocDictionaryPath : adhocDictionaryPaths) {
+ final DictionaryParser dictParser = new DictionaryParser();
+ final InputStream dictInput = adhocDictionaryPath.openStream();
+ final Dictionary dictionary = dictParser.parse(dictInput, adhocDictionaryPath.toString());
+ this.currentDictionaries.add(dictionary);
+ }
+ }
}
public void start() throws SAXException, ParserConfigurationException, IOException {
@@ -390,31 +405,7 @@
words = this.currentOrthographyConfig.getWordBreaker().breakIntoWords(this.charBuffer);
}
- if (words != null) {
- for (int index = 0; index < words.size(); index ++) {
- if (index % 2 == 0) {
- final CharSequence word = words.get(index);
- /* The word breaker can return empty words when the parsed text begins with non-word content. */
- if (word.length() > 0) {
- if (this.currentOrthographyConfig == null) {
- /* Treat as a misspelling. */
- this.output.println("(no config) " + word);
- } else {
- final SegmentDictionary dictionary = this.currentOrthographyConfig.getDictionary();
- if (dictionary == null) {
- /* Treat as a misspelling. */
- this.output.println("(no dictionary) " + word);
- } else {
- if (flagThisWord(dictionary, word)) {
- this.output.println("Not found: " + word);
- this.notFoundCounter ++;
- }
- }
- }
- }
- }
- }
- }
+ checkWords(words);
/* Clear the character buffer. */
this.charBuffer.delete(0, this.charBuffer.length());
@@ -439,14 +430,74 @@
/**
+ * Spell-check each word in a sequence of words.
+ * @param words The words to be checked.
+ */
+ private void checkWords(final List<CharSequence> words) {
+ if (words == null) {
+ return;
+ }
+ for (int index = 0; index < words.size(); index ++) {
+ if (index % 2 == 0) {
+ final CharSequence word = words.get(index);
+ checkWord(word);
+ }
+ }
+ }
+
+ /**
+ * Spell-check a word.
+ * @param word The word to be checked.
+ */
+ private void checkWord(final CharSequence word) {
+ /* The word breaker can return empty words when the parsed text begins with non-word content. */
+ if (word.length() < 1) {
+ return;
+ }
+
+ /* Check against patterns that are considered to be valid words, but that are not in the dictionary. */
+ for (int index = 0; index < VALID_WORD_PATTERNS.size(); index ++) {
+ final Pattern pattern = VALID_WORD_PATTERNS.get(index);
+ final Matcher matcher = pattern.matcher(word);
+ if (matcher.matches()) {
+ return;
+ }
+ }
+
+ /* Check against any ad-hoc dictionaries. */
+ for (int index = 0; index < this.currentDictionaries.size(); index ++) {
+ final Dictionary dict = this.currentDictionaries.get(index);
+ if (wordFound(dict, word)) {
+ return;
+ }
+ }
+
+ if (this.currentOrthographyConfig == null) {
+ /* Treat as a misspelling. */
+ this.output.println("(no config) " + word);
+ } else {
+ final SegmentDictionary dictionary = this.currentOrthographyConfig.getDictionary();
+ if (dictionary == null) {
+ /* Treat as a misspelling. */
+ this.output.println("(no dictionary) " + word);
+ } else {
+ if (! wordFound(dictionary, word)) {
+ this.output.println("Not found: " + word);
+ this.notFoundCounter ++;
+ }
+ }
+ }
+ }
+
+ /**
* Indicates whether a given word should be marked as misspelled, i.e. cannot be found in the appropriate
* dictionary(s) and cannot be accepted as a legitimate word any other way.
* @param dictionary The dictionary in which {@code word} is being sought.
* @param word The word being tested.
- * @return True if and only if {@code word} is not found in {@code dict} and cannot be accepted as a legitimate
- * word for any other reason.
+ * @return True if and only if {@code word} is found in {@code dict} or can be accepted as a legitimate word for
+ * some other reason.
*/
- private boolean flagThisWord(final SegmentDictionary dictionary, final CharSequence word) {
+ private boolean wordFound(final Dictionary dictionary, final CharSequence word) {
/* TODO: This is all eng-us-lat specific. Need to think about how plurals and other almost-the-same cases should
* be handled. */
@@ -453,18 +504,9 @@
/* Is the word itself directly in the dictionary. */
Word dictWord = dictionary.getWord(word);
if (dictWord != null) {
- return false;
+ return true;
}
- /* Check against patterns that are considered to be valid words, but that are not in the dictionary. */
- for (int index = 0; index < VALID_WORD_PATTERNS.size(); index ++) {
- final Pattern pattern = VALID_WORD_PATTERNS.get(index);
- final Matcher matcher = pattern.matcher(word);
- if (matcher.matches()) {
- return false;
- }
- }
-
/* Starting here, we will change the word content in various ways, looking for a match. The changes are
* cumulative. */
final StringBuilder builder = new StringBuilder(word);
@@ -475,7 +517,7 @@
dictWord = dictionary.getWord(builder);
}
if (dictWord != null) {
- return false;
+ return true;
}
/* If the last character is a lowercase "s" or "'s" (apostrophe "s"), this may be a plural noun, a
@@ -489,10 +531,10 @@
dictWord = dictionary.getWord(builder);
}
if (dictWord != null) {
- return false;
+ return true;
}
- return true;
+ return false;
}
@Override
@@ -508,12 +550,12 @@
final Options clOptions = new Options();
final Option input = new Option("i", "input", true, "path to the input file");
input.setRequired(true);
-// final Option output = new Option("o", "output", true, "path to the output (pretty-printed) file");
-// output.setRequired(true);
-// output.setRequired(true);
- final Option dictionaries = new Option("c", "config", true, "path to orthography configuration");
+ final Option config = new Option("c", "config", true, "path to orthography configuration");
+ final Option dictionaries = new Option("d", "dictionary", true, "path(s) to ad-hoc dictionary(ies)");
+ dictionaries.setArgs(Option.UNLIMITED_VALUES);
+
clOptions.addOption(input);
-// clOptions.addOption(output);
+ clOptions.addOption(config);
clOptions.addOption(dictionaries);
return clOptions;
}
@@ -545,6 +587,7 @@
final String input = parsedCommandLine.getOptionValue("input");
final String config = parsedCommandLine.getOptionValue("config");
+ final String[] dictionariesArray = parsedCommandLine.getOptionValues("dictionary");
InputStream inputStream = null;
try {
@@ -562,7 +605,16 @@
try {
final URL orthographyConfigPath = new URL(config);
- final SpellChecker checker = new SpellChecker(inputSource, output, orthographyConfigPath);
+ List<URL> dictionaries = null;
+ if (dictionariesArray != null) {
+ dictionaries = new ArrayList<URL>();
+ for (String path : dictionariesArray) {
+ final URL dictionary = new URL(path);
+ dictionaries.add(dictionary);
+ }
+ }
+
+ final SpellChecker checker = new SpellChecker(inputSource, output, orthographyConfigPath, dictionaries);
checker.start();
} catch (final HyphenationException | IOException | SAXException | ParserConfigurationException e) {
logger.error("Error configuring or running: " + input, e);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vic...@us...> - 2021-10-27 15:32:37
|
Revision: 11946
http://sourceforge.net/p/foray/code/11946
Author: victormote
Date: 2021-10-27 15:32:34 +0000 (Wed, 27 Oct 2021)
Log Message:
-----------
Add parsing of inline comments.
Modified Paths:
--------------
trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DictionaryParser.java
Modified: trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DictionaryParser.java
===================================================================
--- trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DictionaryParser.java 2021-10-26 23:47:05 UTC (rev 11945)
+++ trunk/foray/foray-hyphen/src/main/java/org/foray/hyphen/DictionaryParser.java 2021-10-27 15:32:34 UTC (rev 11946)
@@ -96,6 +96,11 @@
inputLine = reader.readLine();
continue;
}
+ final int charIndex = inputLine.indexOf('#');
+ if (charIndex > -1) {
+ inputLine = inputLine.substring(0, charIndex - 1);
+ }
+ inputLine = inputLine.trim();
int inputLineIndex = 0;
while (inputLineIndex < inputLine.length()) {
final char theChar = inputLine.charAt(inputLineIndex);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|