how to read big5 files in Java


/*
  ReadBig5File.java
  
    read a file in big5 code
  
  > javac ReadBig5File.java
  > java ReadBig5File big5.txt
  Big5編碼文字檔
*/
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;

public class ReadBig5File
{
  public static void main(String args[]) throws
    java.io.FileNotFoundException,
    java.io.UnsupportedEncodingException,
    java.io.IOException
  {
    String file="big5.txt";
    FileInputStream fis = new FileInputStream(new File(file));
     // java.io.FileNotFoundException
    BufferedReader br =new BufferedReader(new InputStreamReader(fis,"BIG5"));
     // java.io.UnsupportedEncodingException
    
    // java.io.IOException
    while(br.ready())
    {
      String line=br.readLine();
      System.out.println(line);
      System.out.flush();
    }
    br.close();
  }
}

沒有留言:

how to deal with metric scale inconsistency in topn recommendation evaluation

🎯 推薦系統一般會回傳前 N 個排名的物品清單給用戶,稱為 Top‑N 推薦。 遇到推薦模型須要訓練及評估時,習慣先蒐集用戶與物品的互動資料,再將資料拆分成沒有重疊的訓練集及測試集。 模型在訓練時只看得到訓練集,評估時則拿測試集作為驗證的標準答案,以免作...

總網頁瀏覽量