1
0

thai-tokenizer.asciidoc 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. [[analysis-thai-tokenizer]]
  2. === Thai Tokenizer
  3. The `thai` tokenizer segments Thai text into words, using the Thai
  4. segmentation algorithm included with Java. Text in other languages in general
  5. will be treated the same as the
  6. <<analysis-standard-tokenizer,`standard` tokenizer>>.
  7. WARNING: This tokenizer may not be supported by all JREs. It is known to work
  8. with Sun/Oracle and OpenJDK. If your application needs to be fully portable,
  9. consider using the {plugins}/analysis-icu-tokenizer.html[ICU Tokenizer] instead.
  10. [float]
  11. === Example output
  12. [source,console]
  13. ---------------------------
  14. POST _analyze
  15. {
  16. "tokenizer": "thai",
  17. "text": "การที่ได้ต้องแสดงว่างานดี"
  18. }
  19. ---------------------------
  20. /////////////////////
  21. [source,console-result]
  22. ----------------------------
  23. {
  24. "tokens": [
  25. {
  26. "token": "การ",
  27. "start_offset": 0,
  28. "end_offset": 3,
  29. "type": "word",
  30. "position": 0
  31. },
  32. {
  33. "token": "ที่",
  34. "start_offset": 3,
  35. "end_offset": 6,
  36. "type": "word",
  37. "position": 1
  38. },
  39. {
  40. "token": "ได้",
  41. "start_offset": 6,
  42. "end_offset": 9,
  43. "type": "word",
  44. "position": 2
  45. },
  46. {
  47. "token": "ต้อง",
  48. "start_offset": 9,
  49. "end_offset": 13,
  50. "type": "word",
  51. "position": 3
  52. },
  53. {
  54. "token": "แสดง",
  55. "start_offset": 13,
  56. "end_offset": 17,
  57. "type": "word",
  58. "position": 4
  59. },
  60. {
  61. "token": "ว่า",
  62. "start_offset": 17,
  63. "end_offset": 20,
  64. "type": "word",
  65. "position": 5
  66. },
  67. {
  68. "token": "งาน",
  69. "start_offset": 20,
  70. "end_offset": 23,
  71. "type": "word",
  72. "position": 6
  73. },
  74. {
  75. "token": "ดี",
  76. "start_offset": 23,
  77. "end_offset": 25,
  78. "type": "word",
  79. "position": 7
  80. }
  81. ]
  82. }
  83. ----------------------------
  84. /////////////////////
  85. The above sentence would produce the following terms:
  86. [source,text]
  87. ---------------------------
  88. [ การ, ที่, ได้, ต้อง, แสดง, ว่า, งาน, ดี ]
  89. ---------------------------
  90. [float]
  91. === Configuration
  92. The `thai` tokenizer is not configurable.