GithubHelp home page GithubHelp logo

大量匯入或調整詞彙 about pime HOT 13 OPEN

easyime avatar easyime commented on July 30, 2024
大量匯入或調整詞彙

from pime.

Comments (13)

PCMan avatar PCMan commented on July 30, 2024 1

@czchen 其實用網頁前端 + python + ctypes 來寫,理論上應該比 Qt 簡單 XD

from pime.

ottokang avatar ottokang commented on July 30, 2024

目前已經有使用者詞庫編輯工具(Chewing-editor),只是還沒有 Windows 版本的編譯

from pime.

PCMan avatar PCMan commented on July 30, 2024

@ottokang 你願意幫忙編譯嗎?
那個還得先編譯 Qt,有點小繁瑣,一時沒有空可以弄

from pime.

ottokang avatar ottokang commented on July 30, 2024

正在研究,我再試試看,如果不行再到 Chewing-editor 那邊問

from pime.

Chinan avatar Chinan commented on July 30, 2024

Windows 版本是這個嘛?
https://github.com/Chocobo1/chewing-editor-build
不過剛剛試了似乎與PIME的使用者詞庫不相容。

之前這位開發者也有做 TSF版新酷音 的非官方修正版?

from pime.

PCMan avatar PCMan commented on July 30, 2024

@Chinan Windows 版本可以請教原開發者 @czchen 看如何 build

from pime.

PCMan avatar PCMan commented on July 30, 2024

@ottokang 我剛抽空實驗了一下,其實挺簡單,以下 python code 可以列出所有使用者自訂辭

from libchewing import ChewingContext
from ctypes import *

def main():
    ctx = ChewingContext()
    phrase_len = c_uint(0)
    bopomofo_len = c_uint(0)
    ctx.userphrase_enumerate()
    while ctx.userphrase_has_next(byref(phrase_len), byref(bopomofo_len)):
        phrase_buf = create_string_buffer(phrase_len.value)
        bopomofo_buf = create_string_buffer(bopomofo_len.value)
        ctx.userphrase_get(phrase_buf, phrase_len, bopomofo_buf, bopomofo_len)
        phrase = phrase_buf.raw.decode("utf8")
        bopomofo = bopomofo_buf.raw.decode("utf8")
        print(phrase, " => ", bopomofo)

if __name__ == "__main__":
    main()

所有相關 API 可參考 libchewing 的 chewingio.h,大約就這些

CHEWING_API int chewing_userphrase_enumerate(ChewingContext *ctx);

CHEWING_API int chewing_userphrase_has_next(ChewingContext *ctx, unsigned int *phrase_len, unsigned int *bopomofo_len);

CHEWING_API int chewing_userphrase_get(ChewingContext *ctx,
                                       char *phrase_buf, unsigned int phrase_len,
                                       char *bopomofo_buf, unsigned int bopomofo_len);

CHEWING_API int chewing_userphrase_add(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);

CHEWING_API int chewing_userphrase_remove(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);

CHEWING_API int chewing_userphrase_lookup(ChewingContext *ctx, const char *phrase_buf, const char *bopomofo_buf);

from pime.

PCMan avatar PCMan commented on July 30, 2024

@ottokang 至於 UI 部分其實用 https://github.com/6pac/SlickGrid 來做效果很好
用 slick grid 的 dataview 來顯示表格,可以新增移除,分頁,還可以 search
請參考

from pime.

czchen avatar czchen commented on July 30, 2024

@ottokang Windows chewing-editor 很久以前有試著做過,Qt 那裡很難搞。如果要大量匯入,建議是直接使用 libchewing API。

from pime.

PCMan avatar PCMan commented on July 30, 2024

網頁 based 的辭庫編輯器,初版完成
6aace34

from pime.

ottokang avatar ottokang commented on July 30, 2024

感謝!最近真的忙到沒空研究,我再看看有沒有可以測試修改的地方

from pime.

ottokang avatar ottokang commented on July 30, 2024

剛剛測試了一下 Python code,沒辦法列出所有的使用者詞庫,似乎是 ChewingContext() 初始化沒有讀取到詞庫資料。

from pime.

PCMan avatar PCMan commented on July 30, 2024

@ottokang 感謝,已經修正 0.16-dev branch

from pime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.