Package com.sun.speech.freetts.lexicon

Examples of com.sun.speech.freetts.lexicon.Lexicon


  String stress = NO_STRESS;
  Relation syl = utterance.createRelation(Relation.SYLLABLE);
  Relation sylstructure =
            utterance.createRelation(Relation.SYLLABLE_STRUCTURE);
  Relation seg = utterance.createRelation(Relation.SEGMENT);
  Lexicon lex = utterance.getVoice().getLexicon();
  List syllableList = null;

  for (Item word = utterance.getRelation(Relation.WORD).getHead();
      word != null; word = word.getNext()) {
      Item ssword = sylstructure.appendItem(word);
      Item sylItem = null;   // item denoting syllable boundaries
      Item segItem = null;   // item denoting phonelist (segments)
      Item sssyl = null;     // item denoting syl in word

      String[] phones = null;

      Item token = word.getItemAs("Token");
      FeatureSet featureSet = null;

      if (token != null) {
    Item parent = token.getParent();
    featureSet = parent.getFeatures();
      }
     
      if (featureSet != null && featureSet.isPresent("phones")) {
    phones = (String[]) featureSet.getObject("phones");
      } else {
    phones = lex.getPhones(word.toString(), null);
      }

      for (int j = 0; j < phones.length; j++) {
    if (sylItem == null) {
        sylItem = syl.appendItem();
        sssyl = ssword.addDaughter(sylItem);
        stress = NO_STRESS;
        syllableList = new ArrayList();
    }
    segItem = seg.appendItem();
    if (isStressed(phones[j])) {
        stress = STRESS;
        phones[j] = deStress(phones[j]);
    }
    segItem.getFeatures().setString("name", phones[j]);
    sssyl.addDaughter(segItem);
    syllableList.add(phones[j]);
    if (lex.isSyllableBoundary(syllableList, phones, j + 1))  {
        sylItem =  null;
        if (sssyl != null) {
      sssyl.getFeatures().setString("stress", stress);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.speech.freetts.lexicon.Lexicon

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.