Step 1 - Task Grammar

Windows Command Prompt

The Windows Command Prompt (also called the Windows terminal) is where you will execute all your HTK/Julius commands and scripts, and VoxForge scripts. 

Open your Command Prompt window by clicking:

Start>All Programs>Accessories>Command Prompt

How-to

Create a new folder in your home directory and call it 'voxforge'.  Create another directory within this folder and call it 'howto'.

Create a file called sample.grammar in your 'voxforge/howto' folder, and add the following:

S : NS_B SENT NS_E
SENT: CALL_V NAME_N
SENT: DIAL_V DIGIT

Still in your 'voxforge/howto' folder, create a file called sample.voca, and add the following:

% NS_B
<s>        sil

% NS_E
</s>        sil

% CALL_V
PHONE        f ow n
CALL        k ao l

% DIAL_V
DIAL        d ay ah l

% NAME_N
STEVE        s t iy v
YOUNG        y ah ng

% DIGIT
FIVE        f ay v
FOUR        f ao r
NINE        n ay n
EIGHT        ey t
OH        ow
ONE        w ah n
SEVEN        s eh v ah n
SIX        s ih k s
THREE        th r iy
TWO        t uw
ZERO        z iy r ow

For details on the file formats, see Step 1 - Task Grammar, in the Tutorial.

Compiling your Grammar

The .grammar and .voca files now need to be compiled into ".dfa"  and ".dict" files so that Julius can use them. 

Download the Julia mkdfa.jl grammar compiler script to your 'voxforge/bin' folder.

Note: the mkdfa.jl script assumes that  the following julius programs:

  • Linux: dfa_minimize and mkfa,
  • Windows:  dfa_minimize.exe and mkfa.exe

are accessible from your PATH (which should be the case since they are included as part of the Julius executable you just downloaded). 

The .grammar and .voca files need to have the same file prefix, and this prefix is then specified to the mkdfa.jl script.  From a command prompt in your 'voxforge/tutorial' directory, compile your files (sample.grammar and sample.voca) using the following command:

julia ../bin/mkdfa.jl sample

Where 'julia' is the name of the julia programming language; and "../bin/mkdfa.jl" tells Julia to go up one directory, then down into the bin directory to execute the "mkdfa.jl" script; and "sample" is the name of the prefix for your grammar files (i.e. your grammar files are "sample.grammar" and "sample.dfa").

The following shows the expected output from running the mkdfa.jl script:

julia ../bin/mkdfa.jl sample

sample.grammar has 3 rules
---
sample.voca has 6 categories and 23 words
generated: sample.term
---
Now parsing grammar file
Now modifying grammar to minimize states[-1]
Now parsing vocabulary file
Now making nondeterministic finite automaton[6/6]
Now making deterministic finite automaton[6/6]
Now making triplet list[6/6]
6 categories, 6 nodes, 6 arcs
-> minimized: 6 nodes, 6 arcs
generated: sample.dict

 

The generated sample.dfa and sample.term files contain finite automaton information, and the sample.dict  file contains word dictionary information.  All are in Julius format.

Comments

By Wageesha - 11/4/2016 - 1 Replies Hi I'm new to Julia. I want to compile mkdfa.jl script with .grammar file and .voca file. I have followed all the steps as mentioned in the site and have creates ./bin and ./tutorial folders.

By spirit1920 - 2/21/2016 - 2 Replies Hi everyone,i am new to this and i am facing a problem. When i run the command "julia ../bin/mkdfa.jl sample" the result i get is this:

By Visitor - 6/30/2014 - 1 Replies I'm a begginer. my system don't know mkdfa.pl and show this message error 'mkdfa.pl' is not recognized as an internal or external command

By oohmygod - 6/20/2012 i'm also comfimed convert it to unix with notepad++ it's worked !!

By cvani - 4/1/2011 - 3 Replies hi

By Giovanni - 11/15/2010 - 2 Replies When i did

By swbluto - 9/8/2010 I had this problem when running the script:

By aspirant - 8/22/2010 - 4 Replies i did the same as given in the instructions of converting to juliun.

By LGL - 4/19/2010 Try to use http://www.repository.voxforge1.org/downloads/software/julius-3.5.2-multipath-win32bin.zip

By kpap - 3/3/2010 - 1 Replies I'm running the mkdfa.pl script from the same folder I've already put sample.grammar and sample.voca files. My OS is Windows 7. I got the following error :

By Amit Surana - 4/3/2009 I know its way too late reply for above question. But someday someone might find it useful.

By ethan oconnors - 6/6/2008 - 7 Replies When I try to convert to the Julian format I put in mkdfa.pl sample and get this message cannot open "sample.grammar" at /Julius/bin/mkdfa.pl line 66. What am I doing wrong? HELP!!!

By royerfa - 2/22/2008 - 2 Replies Hello, I am new in VoxForge. I try to follow the Tuto, and I have a Lexical error step 1. In fact this is my problem. royerfa@royerfa-laptop:~/voxforge/auto$ mkdfa.pl sample sample.grammar has 3 rules sample.voca has 6 categories and 18 words --- Now parsing grammar file "rror: Lexical mistake " Error: cannot open "sample.dfa.tmp" --- no .dfa or .dict file generated And I am surprise because with the example from http://julius.sourceforge.jp/en/grammar.html It Works without problem. Do you have any sugggestion for me .