code: public boolean saveNGramToTxt(String path)
      {
          try
          {
              BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(IOUtil.newOutputStream(path)));
              for (Map.Entry<String, Integer> entry : trie.entrySet())
              {
                  bw.write(entry.getKey() + " " + entry.getValue());
                  bw.newLine();
              }
              bw.close();
          }
          catch (Exception e)
          {
              logger.warning("在保存NGram词典到" + path + "时发生异常" + e);
              return false;
          }
  
          return true;
      }
docs: 保存NGram词典
  
  @param path
  @return