Yes, you might want to filter out unprintable characters. To indicate "no output character", use the Greek letter epsilon: ε .
Here is a testing program for a finite-state transducer.
The transducer's method is String transform( String )
.
It takes a string argument and returns a string value.
If the argument string is not accepted, the method
returns null
.
class FSTtester { public static void main (String[] args) { String inString = null; String outString = null; FST fst = new FST(); inString = args[0]; if ( (outString = fst.transform( inString )) != null ) System.out.println("The string is transformed to:" + outString ); else System.out.println("The string is rejected."); } }
(If you don't wish to use a command line argument for input,
replace args[0]
with some other means of input
or replace it with a string literal.)
(Java Review:) What is the value of this expression
(outString = fst.transform( inString ))
when transform()
returns null
?