<commit_before>
/*
 * Copyright 1999-2002 Carnegie Mellon University.  
 * Portions Copyright 2002 Sun Microsystems, Inc.  
 * Portions Copyright 2002 Mitsubishi Electronic Research Laboratories.
 * All Rights Reserved.  Use is subject to license terms.
 * 
 * See the file "license.terms" for information on usage and
 * redistribution of this file, and for a DISCLAIMER OF ALL 
 * WARRANTIES.
 *
 */

package edu.cmu.sphinx.knowledge.dictionary;

import edu.cmu.sphinx.knowledge.acoustic.Unit;

import java.io.Serializable;

/**
 *  Provides pronunciation information for a word.
 *
 */
public class Pronunciation implements Serializable {

    private String word; 	// the spelling of the word
    private int wordID;
    private WordClassification wordClassification;
    private Unit[] units;
    private String tag;
    private float probability;

    /**
     * Creates a pronunciation
     *
     * @param word the word this pronunciation represents
     * @param units represents the pronunciation
     * @param tag a grammar specific tag
     * @param wordClassification the classification for this word
     * @param probability the probability of this pronunciation
     * occurring
     */
    Pronunciation(String word,
                  int wordID,
                  Unit[] units,
                  String tag,
                  WordClassification wordClassification,
                  float probability) {
	this.word = word;
        this.wordID = wordID;
	this.wordClassification = wordClassification;
	this.units = units;
	this.tag = tag;
	this.probability = probability;
    }


    /**
     * Retrives the word that this Pronunciation object represents.
     * 
     * @return the word
     */
    public String getWord() {
	return word;
    }

    /**
     * Returns the word ID of this Pronunciation.
     *
     * @return the word ID
     */
    public int getWordID() {
        return wordID;
    }

    /**
     * Retrieves the word classification for this pronunciation
     * 
     * @return the word classification for this pronunciation.
     */
    public WordClassification getWordClassification() {
	return wordClassification;
    }<commit_msg>Added method getWord() and setWord() (setWord() can be call only if the field Word is non-null. There is no Word argument in the constructor because Word and Pronunication point to each other.<commit_after>
/*
 * Copyright 1999-2002 Carnegie Mellon University.  
 * Portions Copyright 2002 Sun Microsystems, Inc.  
 * Portions Copyright 2002 Mitsubishi Electronic Research Laboratories.
 * All Rights Reserved.  Use is subject to license terms.
 * 
 * See the file "license.terms" for information on usage and
 * redistribution of this file, and for a DISCLAIMER OF ALL 
 * WARRANTIES.
 *
 */

package edu.cmu.sphinx.knowledge.dictionary;

import edu.cmu.sphinx.knowledge.acoustic.Unit;

import java.io.Serializable;

/**
 *  Provides pronunciation information for a word.
 *
 */
public class Pronunciation implements Serializable {

    private Word word;
    private WordClassification wordClassification;
    private Unit[] units;
    private String tag;
    private float probability;

    /**
     * Creates a pronunciation
     *
     * @param word the word this pronunciation represents
     * @param units represents the pronunciation
     * @param tag a grammar specific tag
     * @param wordClassification the classification for this word
     * @param probability the probability of this pronunciation
     * occurring
     */
    Pronunciation(Unit[] units,
                  String tag,
                  WordClassification wordClassification,
                  float probability) {
        this.wordClassification = wordClassification;
	this.units = units;
	this.tag = tag;
	this.probability = probability;
    }

    /**
     * Sets the word this pronunciation represents.
     *
     * @param word the Word this Pronunciation represents
     */
    protected void setWord(Word word) {
        if (this.word == null) {
            this.word = word;
        } else {
            throw new Error("Word of Pronunciation cannot be set twice.");
        }
    }

    /**
     * Retrives the word that this Pronunciation object represents.
     * 
     * @return the word
     */
    public Word getWord() {
	return word;
    }

    /**
     * Retrieves the word classification for this pronunciation
     * 
     * @return the word classification for this pronunciation.
     */
    public WordClassification getWordClassification() {
	return wordClassification;
    }
{'fraction_non_alphanumeric': 0.0707070707070707, 'fraction_numerical': 0.007026789635485288, 'mean_word_length': 2.5725490196078433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2491543', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1153, 'n_words': 430}