public void toFrequencyFile ( String filePath ) throws IOException { BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( filePath ) , "UTF-8" ) ) ; for ( TrieNodeCnt child : root . children . values ( ) ) { child . writeFrequencies ( writer , new char [ 0 ] ) ; // recursive } writer . close ( ) ; }
one entry per line . word first then tab then frequency