Package com.sun.speech.freetts

Examples of com.sun.speech.freetts.FeatureSet


     * Convert the given digit token into (word) Items in the WordRelation.
     *
     * @param tokenVal  the digit string
     */
    private void digitsToWords(String tokenVal) {
  FeatureSet featureSet = tokenItem.getFeatures();
  String nsw = "";
  if (featureSet.isPresent("nsw")) {
      nsw = featureSet.getString("nsw");
  }

  if (nsw.equals("nide")) {
      NumberExpander.expandID(tokenVal, wordRelation);
  } else {
      String rName = featureSet.getString("name");
      String digitsType = null;
     
      if (tokenVal.equals(rName)) {
    digitsType = (String) cart.interpret(tokenItem);
      } else {
    featureSet.setString("name", tokenVal);
    digitsType = (String) cart.interpret(tokenItem);
    featureSet.setString("name", rName);
      }
     
      if (digitsType.equals("ordinal")) {
    NumberExpander.expandOrdinal(tokenVal, wordRelation);
      } else if (digitsType.equals("digits")) {
View Full Code Here


  } else {
      street = "drive";
      saint = "doctor";
  }
 
  FeatureSet featureSet = tokenItem.getFeatures();
  String punctuation = featureSet.getString("punc");

  String featPunctuation = (String) tokenItem.findFeature("punc");

  if (tokenItem.getNext() == null ||
      punctuation.indexOf(',') != -1) {
      wordRelation.addWord(street);
  } else if (featPunctuation.equals(",")) {
      wordRelation.addWord(saint);
  } else {
      String pName = (String) tokenItem.findFeature("p.name");
      String nName = (String) tokenItem.findFeature("n.name");

      char p0 = pName.charAt(0);
      char n0 = nName.charAt(0);

      if (isUppercaseLetter(p0) && isLowercaseLetter(n0)) {
    wordRelation.addWord(street);
      } else if (NumberExpander.isDigit(p0) && isLowercaseLetter(n0)) {
    wordRelation.addWord(street);
      } else if (isLowercaseLetter(p0) && isUppercaseLetter(n0)) {
    wordRelation.addWord(saint);
      } else {
    String whitespace = (String) tokenItem.findFeature("n.whitespace");
    if (whitespace.equals(" ")) {
        wordRelation.addWord(saint);
    } else {
        wordRelation.addWord(street);
    }
      }
  }

  if (punctuation != null && punctuation.equals(".")) {
      featureSet.setString("punc", "");
  }
    }
View Full Code Here

  int index = tokenVal.indexOf('-');
  String aaa = tokenVal.substring(0, index);
  String bbb = tokenVal.substring(index+1, tokenVal.length());

  if (matches(digitsPattern, aaa) && matches(digitsPattern, bbb)) {
      FeatureSet featureSet = tokenItem.getFeatures();
      featureSet.setString("name", aaa);
      tokenToWords(aaa);
      wordRelation.addWord("to");
      featureSet.setString("name", bbb);
      tokenToWords(bbb);
      featureSet.setString("name", "");
  } else {     
      tokenToWords(aaa);
      tokenToWords(bbb);
  }
    }
View Full Code Here

  }
 
  String aaa = tokenVal.substring(0, index+1);
  String bbb = tokenVal.substring(index+1, tokenLength);
 
  FeatureSet featureSet = tokenItem.getFeatures();
  featureSet.setString("nsw", "nide");
  tokenToWords(aaa);
  tokenToWords(bbb);
    }
View Full Code Here

                // System.out.println("previous = " + previous);
                // System.out.println("next = " + next);
               
                int nextLength = next.length();
                FeatureSet featureSet = tokenItem.getFeatures();
               
                // check if the previous word starts with a capital letter,
                // is at least 3 letters long, is an alphabet sequence,
                // and has a comma.
                boolean previousIsCity =
                    (isUppercaseLetter(previous.charAt(0))
                     && previous.length() > 2
                     && matches(alphabetPattern, previous)
                     && tokenItem.findFeature("p.punc").equals(","));
               
                // check if next token starts with a lower case, or
                // this is the end of sentence, or if next token
                // is a period (".") or a zip code (5 or 10 digits).
                boolean nextIsGood =
                    (isLowercaseLetter(next.charAt(0))
                     || tokenItem.getNext() == null
                     || featureSet.getString("punc").equals(".")
                     || ((nextLength == 5 || nextLength == 10) &&
                         matches(digitsPattern, next)));
               
                if (previousIsCity && nextIsGood) {
                    expandState = true;
View Full Code Here

     *
     * @throws IOException if an I/O error occurs
     */
    protected void setupFeatureSet() throws IOException {
  BulkTimer.LOAD.start("FeatureSet");
        FeatureSet features = getFeatures();
  features.setString(FEATURE_SILENCE, "pau");
  features.setString("join_type", "simple_join");
  BulkTimer.LOAD.stop("FeatureSet");
    }
View Full Code Here

  // get the last in the list of number strings
  Item lastItem = wordRelation.getTail();

  if (lastItem != null) {

      FeatureSet featureSet = lastItem.getFeatures();
      String lastNumber = featureSet.getString("name");
      String ordinal = findMatchInArray(lastNumber, digit2num, ord2num);

      if (ordinal == null) {
    ordinal = findMatchInArray(lastNumber, digit2teen, ord2teen);
      }
View Full Code Here

TOP

Related Classes of com.sun.speech.freetts.FeatureSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.