Sign in

    kbbi

    Unofficial KBBI (Kamus Besar Bahasa Indonesia) lookup for MoonBit: a library, a CLI, and an agent skill.

    kbbi
    indonesian
    dictionary
    cli
    skill
    agent
    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    25 days ago
    Downloads
    62

    #kbbi.mbt

    Unofficial MoonBit lookup library and CLI for KBBI Daring, with an agent skill in SKILL.md. It parses dictionary entries into typed data, including homographs, pronunciations, root words, labels, definitions, examples, and example meanings.

    #Library

    Import gaato/kbbi and provide any gaato/http transport. For an asynchronous executable using gaato/http-async:

    let transport = @http_async.AsyncTransport::new(timeout_ms=10000)
    defer transport.close()
    let result = @kbbi.lookup(transport, "rumah sakit")
    println(result.to_json().stringify(indent=2))

    lookup trims the query, sends one GET request, and raises KbbiError for empty input, transport failures, non-2xx status, or malformed UTF-8. parse(html, query~, url~) is pure and can parse saved HTML. entry_url lowercases and percent-encodes a trimmed query as one path segment. The library supports wasm, native, and js.

    #CLI

    moonx gaato/kbbi/cli@0.1.0 makan moonx gaato/kbbi/cli@0.1.0 rumah sakit moonx gaato/kbbi/cli@0.1.0 --help moonx --experimental-policy kbbi-policy.json gaato/kbbi/cli@0.1.0 gemas

    Arguments form one query, joined with spaces. Successful lookups print one pretty JSON document, including found: false for no match. Help and version are plain text. Exit codes: 0 success, 1 runtime failure, 2 usage error. Runtime and usage errors print error: ... to stderr. The CLI supports wasm and native.

    #Develop

    Use moon on PATH with the version in moonbit-version. Tests use embedded copies of testdata/*.html and make no network requests. Regenerate those copies after updating the source fixtures with moon run tools/regen_fixtures.mbtx followed by moon fmt.

    moon fmt moon info moon check --target wasm --deny-warn moon test --target wasm moon build --target wasm moon check --target native --deny-warn moon test --target native moon build --target native moon test --target js --package gaato/kbbi

    The live KBBI site is not exercised by these offline tests. The results are scraped from KBBI Daring; this project is not affiliated with KBBI or its operator. Avoid rapid bulk lookups.

    Licensed under Apache-2.0; see LICENSE.

    KbbiError

    pub suberror KbbiError {
    EmptyQuery
    Http(
    HttpError
    )
    Status(Int)
    Decode(String)
    } derive(
    Debug
    )

    Entry

    pub struct Entry {
    headword : String
    homograph : Int?
    pronunciation : String?
    root_words : Array[String]
    senses : Array[Sense]
    } derive(Eq, ToJson,
    Debug
    )

    Entry::equal

    fn Entry::equal(Entry, Entry) -> Bool

    Entry::not_equal

    fn Entry::not_equal(x : Entry, y : Entry) -> Bool

    Entry::to_json

    fn Entry::to_json(Entry) -> Json

    Entry::to_repr

    Example

    pub struct Example {
    text : String
    meaning : String?
    } derive(Eq, ToJson,
    Debug
    )

    Example::equal

    fn Example::equal(Example, Example) -> Bool

    Example::not_equal

    fn Example::not_equal(x : Example, y : Example) -> Bool

    Example::to_json

    fn Example::to_json(Example) -> Json

    Example::to_repr

    Label

    pub struct Label {
    code : String
    name : String
    description : String
    } derive(Eq, ToJson,
    Debug
    )

    Label::equal

    fn Label::equal(Label, Label) -> Bool

    Label::not_equal

    fn Label::not_equal(x : Label, y : Label) -> Bool

    Label::to_json

    fn Label::to_json(Label) -> Json

    Label::to_repr

    LookupResult

    pub struct LookupResult {
    found : Bool
    query : String
    url : String
    entries : Array[Entry]
    } derive(Eq, ToJson,
    Debug
    )

    LookupResult::equal

    LookupResult::not_equal

    fn LookupResult::not_equal(x : LookupResult, y : LookupResult) -> Bool

    LookupResult::to_json

    Sense

    pub struct Sense {
    labels : Array[Label]
    gloss : String
    examples : Array[Example]
    } derive(Eq, ToJson,
    Debug
    )

    Sense::equal

    fn Sense::equal(Sense, Sense) -> Bool

    Sense::not_equal

    fn Sense::not_equal(x : Sense, y : Sense) -> Bool

    Sense::to_json

    fn Sense::to_json(Sense) -> Json

    Sense::to_repr

    DEFAULT_BASE_URL

    let DEFAULT_BASE_URL : String

    entry_url

    fn entry_url(query : String, base_url? : String) -> String

    lookup

    async fn lookup(transport : &
    Transport
    , query : String, base_url? : String) -> LookupResult raise KbbiError

    parse

    fn parse(html : StringView, query~ : String, url~ : String) -> LookupResult

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io