congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
JPhonemiser
Code IndexAdd Tabnine to your IDE (free)

How to use
JPhonemiser
in
marytts.modules

Best Java code snippets using marytts.modules.JPhonemiser (Showing top 20 results out of 315)

origin: marytts/marytts

String result = userdictLookup(text, pos);
if (result != null) {
  g2pMethod.append("userdict");
result = lexiconLookup(text, pos);
if (result != null) {
  g2pMethod.append("lexicon");
String normalised = MaryUtils.normaliseUnicodeLetters(text, getLocale());
if (!normalised.equals(text)) {
  result = userdictLookup(normalised, pos);
  if (result != null) {
    g2pMethod.append("userdict");
    return result;
  result = lexiconLookup(normalised, pos);
  if (result != null) {
    g2pMethod.append("lexicon");
origin: marytts/marytts

if (isPosPunctuation(pos)) {
  return false;
if (isUnpronounceable(pos)) {
  return false;
origin: marytts/marytts

/**
 * Look a given text up in the (standard) lexicon. part-of-speech is used in case of ambiguity.
 *
 * @param text
 *            text
 * @param pos
 *            pos
 * @return null if text == null or text.length is 0, null if entries.length is 0, entries[0] otherwise
 */
public String lexiconLookup(String text, String pos) {
  if (text == null || text.length() == 0)
    return null;
  String[] entries;
  entries = lexiconLookupPrimitive(text, pos);
  // If entry is not found directly, try the following changes:
  // - lowercase the word
  // - all lowercase but first uppercase
  if (entries.length == 0) {
    text = text.toLowerCase(getLocale());
    entries = lexiconLookupPrimitive(text, pos);
  }
  if (entries.length == 0) {
    text = text.substring(0, 1).toUpperCase(getLocale()) + text.substring(1);
    entries = lexiconLookupPrimitive(text, pos);
  }
  if (entries.length == 0)
    return null;
  return entries[0];
}
origin: marytts/marytts

  if (maybePronounceable(text, pos)) {
      String graph = st.nextToken();
      StringBuilder helper = new StringBuilder();
      String phon = phonemise(graph, pos, helper);
      setPh(t, ph.toString());
      t.setAttribute("g2p_method", g2pMethod);
MaryData result = new MaryData(outputType(), d.getLocale());
result.setDocument(doc);
return result;
origin: marytts/marytts

  userdict = readLexicon(userdictFilename);
} else {
  logger.info("User dictionary '" + userdictFilename + "' for locale '" + getLocale()
      + "' does not exist. Ignoring.");
origin: marytts/marytts

/**
 * Compile a regex pattern used to determine whether tokens are processed as unprounounceable or not, based on whether their
 * <code>pos</code> attribute matches the pattern.
 *
 */
protected void setUnpronounceablePosRegex() {
  String language = getLocale().getLanguage();
  String propertyName = language + ".pos.unprounounceable.regex";
  String defaultRegex = "^[^a-zA-Z]+$";
  String regex = MaryProperties.getProperty(propertyName);
  if (regex == null) {
    logger.debug(String.format("Property %s not set, using default", propertyName));
    regex = defaultRegex;
  } else {
    logger.debug(String.format("Using property %s", propertyName));
  }
  try {
    unpronounceablePosRegex = Pattern.compile(regex);
  } catch (PatternSyntaxException e) {
    logger.error(String.format("Could not compile regex pattern /%s/, using default instead", regex));
    unpronounceablePosRegex = Pattern.compile(defaultRegex);
  }
  logger.debug(String.format("Punctuation regex pattern set to /%s/", unpronounceablePosRegex));
}
origin: marytts/marytts

  if (maybePronounceable(text, pos)) {
      String graph = st.nextToken();
      StringBuilder helper = new StringBuilder();
      String phon = phonemise(graph, pos, helper);
      setPh(t, ph.toString());
      t.setAttribute("g2p_method", g2pMethod);
MaryData result = new MaryData(outputType(), d.getLocale());
result.setDocument(doc);
return result;
origin: marytts/marytts

  userdict = readLexicon(userdictFilename);
} else {
  logger.info("User dictionary '" + userdictFilename + "' for locale '" + getLocale()
      + "' does not exist. Ignoring.");
origin: marytts/marytts

/**
 * Compile a regex pattern used to determine whether tokens are processed as punctuation or not, based on whether their
 * <code>pos</code> attribute matches the pattern.
 *
 */
protected void setPunctuationPosRegex() {
  String language = getLocale().getLanguage();
  String propertyName = language + ".pos.punct.regex";
  String defaultRegex = "\\$PUNCT";
  String regex = MaryProperties.getProperty(propertyName);
  if (regex == null) {
    logger.debug(String.format("Property %s not set, using default", propertyName));
    regex = defaultRegex;
  } else {
    logger.debug(String.format("Using property %s", propertyName));
  }
  try {
    punctuationPosRegex = Pattern.compile(regex);
  } catch (PatternSyntaxException e) {
    logger.error(String.format("Could not compile regex pattern /%s/, using default instead", regex));
    punctuationPosRegex = Pattern.compile(defaultRegex);
  }
  logger.debug(String.format("Punctuation regex pattern set to /%s/", punctuationPosRegex));
}
origin: de.dfki.mary/marytts-runtime

  if (maybePronounceable(text, pos)) {
      String graph = st.nextToken();
      StringBuilder helper = new StringBuilder();
      String phon = phonemise(graph, pos, helper);
      setPh(t, ph.toString());
      t.setAttribute("g2p_method", g2pMethod);
MaryData result = new MaryData(outputType(), d.getLocale());
result.setDocument(doc);
return result;
origin: marytts/marytts

String result = userdictLookup(text, pos);
if (result != null) {
  g2pMethod.append("userdict");
result = lexiconLookup(text, pos);
if (result != null) {
  g2pMethod.append("lexicon");
String normalised = MaryUtils.normaliseUnicodeLetters(text, getLocale());
if (!normalised.equals(text)) {
  result = userdictLookup(normalised, pos);
  if (result != null) {
    g2pMethod.append("userdict");
    return result;
  result = lexiconLookup(normalised, pos);
  if (result != null) {
    g2pMethod.append("lexicon");
origin: marytts/marytts

/**
 * Look a given text up in the (standard) lexicon. part-of-speech is used in case of ambiguity.
 *
 * @param text
 *            text
 * @param pos
 *            pos
 * @return null if text == null or text.length is 0, null if entries.length is 0, entries[0] otherwise
 */
public String lexiconLookup(String text, String pos) {
  if (text == null || text.length() == 0)
    return null;
  String[] entries;
  entries = lexiconLookupPrimitive(text, pos);
  // If entry is not found directly, try the following changes:
  // - lowercase the word
  // - all lowercase but first uppercase
  if (entries.length == 0) {
    text = text.toLowerCase(getLocale());
    entries = lexiconLookupPrimitive(text, pos);
  }
  if (entries.length == 0) {
    text = text.substring(0, 1).toUpperCase(getLocale()) + text.substring(1);
    entries = lexiconLookupPrimitive(text, pos);
  }
  if (entries.length == 0)
    return null;
  return entries[0];
}
origin: marytts/marytts

if (isPosPunctuation(pos)) {
  return false;
if (isUnpronounceable(pos)) {
  return false;
origin: de.dfki.mary/marytts-runtime

  userdict = readLexicon(userdictFilename);
} else {
  logger.info("User dictionary '" + userdictFilename + "' for locale '" + getLocale()
      + "' does not exist. Ignoring.");
origin: marytts/marytts

/**
 * Compile a regex pattern used to determine whether tokens are processed as unprounounceable or not, based on whether their
 * <code>pos</code> attribute matches the pattern.
 *
 */
protected void setUnpronounceablePosRegex() {
  String language = getLocale().getLanguage();
  String propertyName = language + ".pos.unprounounceable.regex";
  String defaultRegex = "^[^a-zA-Z]+$";
  String regex = MaryProperties.getProperty(propertyName);
  if (regex == null) {
    logger.debug(String.format("Property %s not set, using default", propertyName));
    regex = defaultRegex;
  } else {
    logger.debug(String.format("Using property %s", propertyName));
  }
  try {
    unpronounceablePosRegex = Pattern.compile(regex);
  } catch (PatternSyntaxException e) {
    logger.error(String.format("Could not compile regex pattern /%s/, using default instead", regex));
    unpronounceablePosRegex = Pattern.compile(defaultRegex);
  }
  logger.debug(String.format("Punctuation regex pattern set to /%s/", unpronounceablePosRegex));
}
origin: de.dfki.mary/marytts-runtime

String result = userdictLookup(text, pos);
if (result != null) {
  g2pMethod.append("userdict");
result = lexiconLookup(text, pos);
if (result != null) {
  g2pMethod.append("lexicon");
String normalised = MaryUtils.normaliseUnicodeLetters(text, getLocale());
if (!normalised.equals(text)) {
  result = userdictLookup(normalised, pos);
  if (result != null) {
    g2pMethod.append("userdict");
    return result;
  result = lexiconLookup(normalised, pos);
  if (result != null) {
    g2pMethod.append("lexicon");
origin: de.dfki.mary/marytts-runtime

/**
 * Look a given text up in the (standard) lexicon. part-of-speech is used in case of ambiguity.
 *
 * @param text
 *            text
 * @param pos
 *            pos
 * @return null if text == null or text.length is 0, null if entries.length is 0, entries[0] otherwise
 */
public String lexiconLookup(String text, String pos) {
  if (text == null || text.length() == 0)
    return null;
  String[] entries;
  entries = lexiconLookupPrimitive(text, pos);
  // If entry is not found directly, try the following changes:
  // - lowercase the word
  // - all lowercase but first uppercase
  if (entries.length == 0) {
    text = text.toLowerCase(getLocale());
    entries = lexiconLookupPrimitive(text, pos);
  }
  if (entries.length == 0) {
    text = text.substring(0, 1).toUpperCase(getLocale()) + text.substring(1);
    entries = lexiconLookupPrimitive(text, pos);
  }
  if (entries.length == 0)
    return null;
  return entries[0];
}
origin: de.dfki.mary/marytts-runtime

if (isPosPunctuation(pos)) {
  return false;
if (isUnpronounceable(pos)) {
  return false;
origin: marytts/marytts

/**
 * Compile a regex pattern used to determine whether tokens are processed as punctuation or not, based on whether their
 * <code>pos</code> attribute matches the pattern.
 *
 */
protected void setPunctuationPosRegex() {
  String language = getLocale().getLanguage();
  String propertyName = language + ".pos.punct.regex";
  String defaultRegex = "\\$PUNCT";
  String regex = MaryProperties.getProperty(propertyName);
  if (regex == null) {
    logger.debug(String.format("Property %s not set, using default", propertyName));
    regex = defaultRegex;
  } else {
    logger.debug(String.format("Using property %s", propertyName));
  }
  try {
    punctuationPosRegex = Pattern.compile(regex);
  } catch (PatternSyntaxException e) {
    logger.error(String.format("Could not compile regex pattern /%s/, using default instead", regex));
    punctuationPosRegex = Pattern.compile(defaultRegex);
  }
  logger.debug(String.format("Punctuation regex pattern set to /%s/", punctuationPosRegex));
}
origin: marytts/marytts

text = text.toLowerCase(getLocale());
entries = userdict.get(text);
text = text.substring(0, 1).toUpperCase(getLocale()) + text.substring(1);
entries = userdict.get(text);
marytts.modulesJPhonemiser

Javadoc

The phonemiser module -- java implementation.

Most used methods

  • getLocale
  • isPosPunctuation
    Based on the regex compiled in #setPunctuationPosRegex(), determine whether a given POS string is cl
  • isUnpronounceable
  • lexiconLookup
    Look a given text up in the (standard) lexicon. part-of-speech is used in case of ambiguity.
  • lexiconLookupPrimitive
  • maybePronounceable
    Determine whether token should be pronounceable, based on text and POS tag.
  • outputType
  • phonemise
    Phonemise the word text. This starts with a simple lexicon lookup, followed by some heuristics, and
  • readLexicon
    Read a lexicon. Lines must have the format graphemestring | phonestring | optional-parts-of-speech T
  • setPh
  • setPunctuationPosRegex
    Compile a regex pattern used to determine whether tokens are processed as punctuation or not, based
  • setUnpronounceablePosRegex
    Compile a regex pattern used to determine whether tokens are processed as unprounounceable or not, b
  • setPunctuationPosRegex,
  • setUnpronounceablePosRegex,
  • startup,
  • userdictLookup

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • compareTo (BigDecimal)
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Runner (org.openjdk.jmh.runner)
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now