Socket
Book a DemoInstallSign in
Socket

thai_keyboard_corrector

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thai_keyboard_corrector

0.2.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

🇹🇭 Thai Keyboard Corrector – แก้ไขข้อความไทยพิมพ์ผิด

Thai Keyboard Corrector (TKC) แก้ปัญหาการพิมพ์ สลับแป้น ระหว่างแป้นพิมพ์ภาษาไทยเกษมณี (Thai Kedmanee) และแป้นภาษาอังกฤษ QWERTY
ตัวอย่าง l;ylfuสวัสดี │ ฟหกดasdf

Features

Detects text that looks like Thai-in-English (:thai_in_en) or English-in-Thai (:en_in_th).ตรวจจับข้อความที่พิมพ์สลับแป้น ทั้ง ไทยในอังกฤษ และ อังกฤษในไทย
Converts both directions with a fixed key-position map (no locale files).แปลงกลับได้ทั้งสองทางด้วยตารางแมปคีย์ถาวร
Pure Ruby, zero dependencies – works ≥ Ruby 2.7.เขียนด้วย Ruby ล้วน ๆ ไม่พึ่งไลบรารีภายนอก
Offers a clean Ruby API and a CLI tool (thai_kbd_correct).ใช้ง่ายผ่านโค้ด Ruby หรือ CLI

Installation

gem install thai_keyboard_corrector

(หรือเพิ่ม gem "thai_keyboard_corrector" ใน Gemfile)

Usage – Ruby API

require "thai_keyboard_corrector"

# 1. Auto-correct if layout seems wrong
ThaiKeyboardCorrector.correct("l;ylfu")   # => "สวัสดี"
ThaiKeyboardCorrector.correct("้รทัืฟทำ รห")     # => "asdf"

# 2. Detect layout (returns a Symbol)
ThaiKeyboardCorrector.detect_layout("้รทัืฟทำรห")  # => :thai
ThaiKeyboardCorrector.detect_layout("l;ylfu")  # => :thai_in_en
ThaiKeyboardCorrector.detect_layout("ฟหกด")    # => :en_in_th
ThaiKeyboardCorrector.detect_layout("helloส")  # => :mixed

Detection Symbols

SymbolMeaning
:thaiNormal Thai text
:enNormal English text
:thai_in_enThai characters typed on EN layout (needs flip EN→TH)
:en_in_thEnglish characters typed on TH layout (needs flip TH→EN)
:mixedContains both Thai & English letters in correct positions
:unknownBlank or symbols only

Usage – CLI

$ thai_kbd_correct "l;ylfu"
สวัสดี

$ echo "ฟหกด" | thai_kbd_correct
asdf

Flags:

Flagใช้ทำอะไร
-f thบังคับแปลง EN→TH (ข้ามการตรวจจับ)
-f enบังคับแปลง TH→EN
-hแสดงวิธีใช้

🛠️ Development

git clone https://github.com/<you>/thai_keyboard_corrector.git
cd thai_keyboard_corrector
bundle install
bundle exec rspec          # ✅  tests should pass
bundle exec rubocop -A     # ✅  style conforms

License

© 2025 Chayut Orapinpatipat Released under the MIT License. See LICENSE.txt for details.

FAQs

Package last updated on 21 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.