Guest User

Untitled

a guest
Jun 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. import ICTCLAS.I3S.AC.ICTCLAS30;
  2.  
  3. import java.util.*;
  4. import java.io.*;
  5.  
  6. public class TestICTCLAS30_2 {
  7.  
  8. public static void main(String[] args) throws Exception
  9. {
  10.  
  11. if ( args.length != 1) {
  12. if (args.length == 0)
  13. System.err.println("NO INPUT STRING GIVEN");
  14.  
  15. else {
  16. System.err.println("TOO MUCH ARGUMENTS GIVEN");
  17.  
  18. for (int i = 0; i < args.length; ++i) {
  19. System.err.println(args[i]);
  20. }
  21. }
  22. return;
  23. }
  24.  
  25. try {
  26. //7V4J
  27. Split(args[0]);
  28. }
  29. catch (Exception e) {
  30. e.printStackTrace();
  31. }
  32. }
  33.  
  34. public static void Split(String sInput) {
  35. try{
  36.  
  37. ICTCLAS30 testICTCLAS30 = new ICTCLAS30();
  38.  
  39. String argu = ".";
  40.  
  41. //if not gb2312 then fail!
  42. System.out.println( testICTCLAS30.ICTCLAS_Init(argu.getBytes("UTF-8")));
  43. if (testICTCLAS30.ICTCLAS_Init(argu.getBytes("GB2312")) == false) {
  44. System.err.println("FATAL ERROR: Something not encoded right!");
  45. return;
  46. }
  47.  
  48. /* No idea what the fuck this means
  49. * IhVC4JPT1jW"</
  50. ID 4z1m4JPT</
  51. 1 <FKcKyR;<61jW"</
  52. 0 <FKcKy6~<61jW"</
  53. 2 114s6~<61jW"</
  54. 3 114sR;<61jW"</
  55. */
  56. testICTCLAS30.ICTCLAS_SetPOSmap(2);
  57.  
  58. byte nativeBytes[] = testICTCLAS30.ICTCLAS_ParagraphProcess(sInput.getBytes("GB2312"), 1);
  59. String nativeStr = new String(nativeBytes, 0, nativeBytes.length, "GB2312");
  60.  
  61. System.out.println(nativeStr);
  62. testICTCLAS30.ICTCLAS_Exit();
  63. }
  64.  
  65. catch (Exception ex) {
  66.  
  67. }
  68.  
  69. }
  70.  
  71.  
  72. public static void Split2(String sInput)
  73. {
  74. try{
  75. ICTCLAS30 testICTCLAS30 = new ICTCLAS30();
  76.  
  77. String argu = ".";
  78.  
  79. //if not gb2312 then fail!
  80. if (testICTCLAS30.ICTCLAS_Init(argu.getBytes("GB2312")) == false)
  81. {
  82. System.out.println("Init Fail!");
  83. return;
  84. }
  85.  
  86. /*
  87. * IhVC4JPT1jW"</
  88. ID 4z1m4JPT</
  89. 1 <FKcKyR;<61jW"</
  90. 0 <FKcKy6~<61jW"</
  91. 2 114s6~<61jW"</
  92. 3 114sR;<61jW"</
  93. */
  94.  
  95. testICTCLAS30.ICTCLAS_SetPOSmap(2);
  96.  
  97. //5<HkSC;'4J5dG0
  98. System.out.println(sInput.getBytes("GB2312"));
  99. byte nativeBytes[] = testICTCLAS30.ICTCLAS_ParagraphProcess(sInput.getBytes("GB2312"), 1);
  100. String nativeStr = new String(nativeBytes, 0, nativeBytes.length, "GB2312");
  101.  
  102. System.out.println("N45<HkSC;'4J5d#: " + nativeStr);
  103.  
  104. //JM7E7V4JWi<~WJT4
  105. testICTCLAS30.ICTCLAS_Exit();
  106. }
  107. catch (Exception ex)
  108. {
  109. }
  110.  
  111. }
  112.  
  113. }
Add Comment
Please, Sign In to add comment