Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ICTCLAS.I3S.AC.ICTCLAS30;
- import java.util.*;
- import java.io.*;
- public class TestICTCLAS30_2 {
- public static void main(String[] args) throws Exception
- {
- if ( args.length != 1) {
- if (args.length == 0)
- System.err.println("NO INPUT STRING GIVEN");
- else {
- System.err.println("TOO MUCH ARGUMENTS GIVEN");
- for (int i = 0; i < args.length; ++i) {
- System.err.println(args[i]);
- }
- }
- return;
- }
- try {
- //7V4J
- Split(args[0]);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- public static void Split(String sInput) {
- try{
- ICTCLAS30 testICTCLAS30 = new ICTCLAS30();
- String argu = ".";
- //if not gb2312 then fail!
- System.out.println( testICTCLAS30.ICTCLAS_Init(argu.getBytes("UTF-8")));
- if (testICTCLAS30.ICTCLAS_Init(argu.getBytes("GB2312")) == false) {
- System.err.println("FATAL ERROR: Something not encoded right!");
- return;
- }
- /* No idea what the fuck this means
- * IhVC4JPT1jW"</
- ID 4z1m4JPT</
- 1 <FKcKyR;<61jW"</
- 0 <FKcKy6~<61jW"</
- 2 114s6~<61jW"</
- 3 114sR;<61jW"</
- */
- testICTCLAS30.ICTCLAS_SetPOSmap(2);
- byte nativeBytes[] = testICTCLAS30.ICTCLAS_ParagraphProcess(sInput.getBytes("GB2312"), 1);
- String nativeStr = new String(nativeBytes, 0, nativeBytes.length, "GB2312");
- System.out.println(nativeStr);
- testICTCLAS30.ICTCLAS_Exit();
- }
- catch (Exception ex) {
- }
- }
- public static void Split2(String sInput)
- {
- try{
- ICTCLAS30 testICTCLAS30 = new ICTCLAS30();
- String argu = ".";
- //if not gb2312 then fail!
- if (testICTCLAS30.ICTCLAS_Init(argu.getBytes("GB2312")) == false)
- {
- System.out.println("Init Fail!");
- return;
- }
- /*
- * IhVC4JPT1jW"</
- ID 4z1m4JPT</
- 1 <FKcKyR;<61jW"</
- 0 <FKcKy6~<61jW"</
- 2 114s6~<61jW"</
- 3 114sR;<61jW"</
- */
- testICTCLAS30.ICTCLAS_SetPOSmap(2);
- //5<HkSC;'4J5dG0
- System.out.println(sInput.getBytes("GB2312"));
- byte nativeBytes[] = testICTCLAS30.ICTCLAS_ParagraphProcess(sInput.getBytes("GB2312"), 1);
- String nativeStr = new String(nativeBytes, 0, nativeBytes.length, "GB2312");
- System.out.println("N45<HkSC;'4J5d#: " + nativeStr);
- //JM7E7V4JWi<~WJT4
- testICTCLAS30.ICTCLAS_Exit();
- }
- catch (Exception ex)
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment