Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
build:

runs-on: macos-13
runs-on: macos-latest

steps:
- name: Checkout repository
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

mavenized [JSR-113](https://jcp.org/en/jsr/detail?id=113) modified aka JSAPI2

* this JSAPI version 2.2.1 (**CAUTION** since 2.2.0, versions are my original (modified from SUN's original))
* this JSAPI version 2.2.1 (**CAUTION**: starting from version 2.2.0, these are my own versions, modified from SUN's original.)
* 2.0.6
* DOES NOT support the J2ME platform (like CLDC 1.0, MIDP 1.0)
* volume property is enabled
* 2.2.0 support service loader mechanism.
* `speech.properties` and `EngineManager#registerEngineListFactory` works, but no more needed
* 2.2.1 add voice comparison level for `SpeechLocal#match()`
* `speech.properties` and `EngineManager#registerEngineListFactory` work, but no longer needed
* 2.2.1 add voice comparison level for [`SpeechLocal#match()`](javax.speech/src/main/java/javax/speech/SpeechLocale.java)

## Install

Expand Down
2 changes: 1 addition & 1 deletion javax.speech/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jvoicexml</groupId>
<artifactId>jsapi2</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</parent>

<artifactId>javax.speech</artifactId>
Expand Down
18 changes: 9 additions & 9 deletions javax.speech/src/main/java/javax/speech/EngineManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* The EngineManager provides the ability to
* locate, select and create speech Engine instances.
* <p>
* The createEngine method creates create speech Engines.
* The createEngine method creates speech Engines.
* It accepts a single parameter that
* defines the required properties for the Engine to create.
* The parameter is a subclass of EngineMode corresponding to a
Expand Down Expand Up @@ -92,7 +92,7 @@
* Locale is treated specially in the selection to ensure that language is
* always considered when selecting an engine.
* If a locale is not provided, the default locale
* (java.util.Locale.getDefault) is used.
* ({@code java.util.Locale.getDefault}) is used.
* <p>
* The selection procedure is:
* <p>
Expand All @@ -109,7 +109,7 @@
* the required properties.
* Amongst the matching engines, give preference to:
* <p>
* A running engine (EngineMode.getRunning is true),
* A running engine ({@link EngineMode#getRunning} is true),
* An engine that matches the default Locale's country.
* <p>
* When more than one engine is a legal match in the final step,
Expand Down Expand Up @@ -149,8 +149,8 @@
* </pre>
* <p>
* This line is interpreted as "the EngineListFactory object for the
* com.acme.recognizer engine is the class called
* com.acme.recognizer.AcmeEngineListFactory.
* {@code com.acme.recognizer} engine is the class called
* {@code com.acme.recognizer.AcmeEngineListFactory}.
* When it is first called, the EngineManager class will attempt to create an
* instance of each EngineListFactory object and will ensure that it implements
* the EngineListFactory interface.
Expand Down Expand Up @@ -186,7 +186,7 @@ public class EngineManager {
Class<?> clazz = Class.forName("javax.speech.EngineManager");
input = clazz.getResourceAsStream("/speech.properties");
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException(e.getMessage());
throw new IllegalArgumentException(e);
}
if (input != null) {
Properties props = new Properties();
Expand All @@ -196,7 +196,7 @@ public class EngineManager {
// Close input
input.close();
} catch (IOException e) {
// Ignore.
logger.log(Level.DEBUG, e.getMessage(), e);
}

Enumeration<?> keys = props.keys();
Expand All @@ -206,7 +206,7 @@ public class EngineManager {
try {
registerEngineListFactory(className);
} catch (IllegalArgumentException | SecurityException | EngineException e) {
// Ignore.
logger.log(Level.DEBUG, e.getMessage(), e);
}
}
}
Expand All @@ -217,7 +217,7 @@ public class EngineManager {
* Lists EngineMode objects for available engine modes
* that match the required properties.
* <p>
* If the require parameter is null, then all known Engines are listed.
* If the {@code require} parameter is null, then all known Engines are listed.
* <p>
* Returns a zero-length list if no Engines are available or if no Engines
* have the required properties. (The method never returns null).
Expand Down
28 changes: 19 additions & 9 deletions javax.speech/src/main/java/javax/speech/SpeechLocale.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

package javax.speech;


import java.lang.System.Logger;
import java.lang.System.Logger.Level;

Expand All @@ -35,9 +34,10 @@

/**
* TODO this class should be replaced by Locale?
* <p>
* system property
* <li>javax.speech.SpeechLocale.comparisonStrictness ... set strictness for #match() method values are
* STRICT</li>
* LENIENT or STRICT (default)</li>
*
* @since 2.0.6
*/
Expand Down Expand Up @@ -66,26 +66,26 @@ public final class SpeechLocale {
FRENCH = new SpeechLocale("fr");
GERMAN = new SpeechLocale("de");

String defaultLanguage = System.getProperty("microedition.locale");
String defaultLanguage = System.getProperty("microedition.locale"); // TODO cldc is deprecated
if (defaultLanguage == null) {
defaultLanguage = "en";
}
DEFAULT_LOCALE = new SpeechLocale(defaultLanguage);
}

private String language;
private final String language;

private String country;
private final String country;

private String variant;
private final String variant;

/**
* Convert new iso639 codes to the old ones.
*
* @param language the language to check
* @return the appropriate code
*/
private String convertLanguage(String language) {
private static String convertLanguage(String language) {
if (language.isEmpty())
return language;
language = language.toLowerCase();
Expand Down Expand Up @@ -117,14 +117,17 @@ public static SpeechLocale[] getAvailableLocales() {
return new SpeechLocale[] {ENGLISH, US, FRENCH, GERMAN};
}

/** @return not null */
public String getLanguage() {
return language;
}

/** @return not null */
public String getCountry() {
return country;
}

/** @return not null */
public String getVariant() {
return variant;
}
Expand All @@ -139,9 +142,12 @@ public int hashCode() {
return result;
}

/** for {@link #match(SpeechLocale)} */
/**
* for {@link #match(SpeechLocale)}
* @since 2.2.1
*/
private enum ComparisonStrictness {
/** match if on of them is matched */
/** match if specified ones are matched */
LENIENT,
/** compare all */
STRICT;
Expand Down Expand Up @@ -198,6 +204,10 @@ public boolean equals(Object obj) {
}

/**
* when {@link #comparisonStrictness} is {@link ComparisonStrictness#STRICT} it's needed perfect match
* (country & language & variant), when {@link #comparisonStrictness} is {@link ComparisonStrictness#LENIENT}
* it's needed language & country (if it's specified).
*
* @since 2.2.1 using {@link #comparisonStrictness} for comparison strictness.
* @param require null means any match
*/
Expand Down
9 changes: 4 additions & 5 deletions org.jvoicexml.jsapi2.demo.helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jvoicexml</groupId>
<artifactId>jsapi2</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</parent>

<artifactId>org.jvoicexml.jsapi2.demo.helloworld</artifactId>
Expand All @@ -20,7 +20,6 @@
<trimStackTrace>false</trimStackTrace>
<argLine>
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
-Dvavi.util.logging.VaviFormatter.extraClassMethod=sun\.util\.logging\.internal\.LoggingProviderImpl\$JULWrapper#log
</argLine>
</configuration>
</plugin>
Expand All @@ -38,17 +37,17 @@
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>javax.speech</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>org.jvoicexml.jsapi2</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>org.jvoicexml.jsapi2.freetts</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
<exclusions>
<exclusion>
<groupId>com.github.umjammer</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=vavi.util.logging.VaviFormatter

vavi.util.logging.VaviFormatter.extraClassMethod=sun\.util\.logging\.internal\.LoggingProviderImpl\$JULWrapper#log

org.jvoicexml.jsapi2.level=ALL
10 changes: 5 additions & 5 deletions org.jvoicexml.jsapi2.demo.input/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jvoicexml</groupId>
<artifactId>jsapi2</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</parent>

<artifactId>org.jvoicexml.jsapi2.demo.input</artifactId>
Expand Down Expand Up @@ -37,22 +37,22 @@
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>javax.speech</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>org.jvoicexml.jsapi2</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>org.jvoicexml.jsapi2.freetts</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>org.jvoicexml.jsapi2.sphinx4</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>

<dependency>
Expand Down
8 changes: 4 additions & 4 deletions org.jvoicexml.jsapi2.demo.rtp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jvoicexml</groupId>
<artifactId>jsapi2</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</parent>

<artifactId>org.jvoicexml.jsapi2.demo.rtp</artifactId>
Expand Down Expand Up @@ -37,17 +37,17 @@
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>javax.speech</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>org.jvoicexml.jsapi2</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>
<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>org.jvoicexml.jsapi2.freetts</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>

<dependency>
Expand Down
7 changes: 3 additions & 4 deletions org.jvoicexml.jsapi2.freetts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jvoicexml</groupId>
<artifactId>jsapi2</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</parent>

<artifactId>org.jvoicexml.jsapi2.freetts</artifactId>
Expand All @@ -20,7 +20,6 @@
<trimStackTrace>false</trimStackTrace>
<argLine>
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
-Dvavi.util.logging.VaviFormatter.extraClassMethod=sun\.util\.logging\.internal\.LoggingProviderImpl\$JULWrapper#log
</argLine>
</configuration>
</plugin>
Expand All @@ -38,13 +37,13 @@
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.14</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.jvoicexml</groupId>
<artifactId>org.jvoicexml.jsapi2</artifactId>
<version>0.6.10</version>
<version>0.6.11</version>
</dependency>
<dependency>
<groupId>${freetts.groupId}</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=vavi.util.logging.VaviFormatter

vavi.util.logging.VaviFormatter.extraClassMethod=sun\.util\.logging\.internal\.LoggingProviderImpl\$JULWrapper#log

org.jvoicexml.jsapi2.level=ALL
javax.speech.level=ALL
#vavi.util.level=WARNING
5 changes: 2 additions & 3 deletions org.jvoicexml.jsapi2.mac/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<reuseForks>true</reuseForks>
<argLine>
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
-Dvavi.util.logging.VaviFormatter.extraClassMethod=sun\\.util\\.logging\\.internal\\.LoggingProviderImpl\\$JULWrapper#log
</argLine>
</configuration>
</plugin>
Expand All @@ -38,7 +37,7 @@
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.14</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jvoicexml</groupId>
Expand All @@ -53,7 +52,7 @@
<dependency>
<groupId>com.github.umjammer.rococoa</groupId>
<artifactId>rococoa-contrib</artifactId>
<version>0.8.7</version>
<version>0.8.13</version>
</dependency>

<dependency>
Expand Down
Loading
Loading