Package edu.cmu.sphinx.linguist.dictionary

Examples of edu.cmu.sphinx.linguist.dictionary.Word


     * @param beginTime
     * @param endTime
     * @return the new Node
     */
    public Node addNode(String id, String word, int beginTime, int endTime) {
        Word w = new Word(word, new Pronunciation[0], false);
        return addNode(id, w, beginTime, endTime);
    }
View Full Code Here


     * @param token
     * @return the new Node
     */
    protected Node addNode(Token token, int beginTime, int endTime) {
        assert (token.getSearchState() instanceof WordSearchState);
        Word word = ((WordSearchState) (token.getSearchState()))
                .getPronunciation().getWord();
        return addNode(Integer.toString(token.hashCode()),
                word, beginTime, endTime);
    }
View Full Code Here

            float minProb = LogMath.LOG_ZERO;
            for (String path : paths) {
                List<Word> wordList = new LinkedList<Word>();
                for (String pathWord : path.split(" ")) {
                    wordList.add(new Word(pathWord, null, false));
                }
                wordList.add(edge.getToNode().getWord());

                WordSequence seq = new WordSequence(wordList);
                float prob = model.getProbability(seq) * languageWeigth;
 
View Full Code Here

     */
    private Set<Word> getAllWords() {
        if (allWords == null) {
            allWords = new HashSet<Word>();
            for (String spelling : lm.getVocabulary()) {
                Word word = dictionary.getWord(spelling);
                if (word != null) {
                    allWords.add(word);
                }
            }

View Full Code Here

        Sausage sausage = new Sausage(clusters.size());
        int index = 0;
        for (Cluster cluster : clusters) {
            HashSet<String> seenWords = new HashSet<String>();
            for (Node node : cluster) {
                Word word = node.getWord();
                if (seenWords.contains(word.getSpelling())) {
                    continue;
                }
                seenWords.add(word.getSpelling());
                WordResult swr =
                    new WordResult(
                            node,
                            wordSubClusterProbability(
                                cluster, word.getSpelling()));
                sausage.addWordHypothesis(index, swr);
            }
            index++;
        }
        sausage.fillInBlanks();
View Full Code Here

         */
        protected SearchStateArc createWordStateArc(WordNode wordNode,
                                                    HMMNode lastUnit, LexTreeState previous) {
            // System.out.println("CWSA " + wordNode + " fup " + fixupProb);
            float languageProbability = logOne;
            Word nextWord = wordNode.getWord();
            float smearTerm = previous.getSmearTerm();

            if (nextWord.isFiller() && nextWord != sentenceEndWord) {
                return new LexTreeWordState(wordNode, lastUnit,
                        wordSequence,
                        smearTerm, logOne, languageProbability, collapsed);
            }

View Full Code Here

    /** @see edu.cmu.sphinx.result.Path#getTranscriptionNoFiller() */
    public String getTranscriptionNoFiller() {
        StringBuilder sb = new StringBuilder();
        for (WordResult wordResult : path) {
            Word word = wordResult.getPronunciation().getWord();
            if (!word.isFiller() && !word.getSpelling().equals("<unk>")) {
                sb.append(word.getSpelling()).append(' ');
            }
        }
        return sb.toString().trim();
    }
View Full Code Here

        dictionary.allocate();
        model.allocate();
        assertThat(model.getMaxDepth(), equalTo(3));

        Word[] words = {
            new Word("huggins", null, false),
            new Word("daines", null, false)};
        assertThat((double) model.getProbability(new WordSequence(words)),
                   closeTo(-830.862, .001));

        Word[] words1 = {
            new Word("huggins", null, false),
            new Word("daines", null, false),
            new Word("david", null, false)};
        assertThat((double) model.getProbability(new WordSequence(words1)),
                   closeTo(-67625.77, .01));
    }
View Full Code Here

     * */
    private void buildUnigramIDMap(Dictionary dictionary) {
        int missingWords = 0;
        String[] words = loader.getWords();
        for (int i = 0; i < words.length; i++) {
            Word word = dictionary.getWord(words[i]);

            if (word == null) {
                logger.warning("The dictionary is missing a phonetic transcription for the word '" +
                               words[i] + "'");
                missingWords++;
View Full Code Here

    }

    private void buildUnigramIDMap() {
        String[] words = loader.getWords();
        for (int i = 0; i < words.length; i++) {
            Word word = new Word(words[i], null, false);

            unigramIDMap.put(word, unigrams[i]);
        }
    }
View Full Code Here

TOP

Related Classes of edu.cmu.sphinx.linguist.dictionary.Word

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.