{"id":18616915,"url":"https://github.com/sile/cl-dawg","last_synced_at":"2026-01-23T20:39:45.390Z","repository":{"id":1118023,"uuid":"989065","full_name":"sile/cl-dawg","owner":"sile","description":"Direct Acyclic Word Graph","archived":false,"fork":false,"pushed_at":"2018-01-02T09:24:55.000Z","size":70,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-13T14:35:15.359Z","etag":null,"topics":["common-lisp","dawg","double-array"],"latest_commit_sha":null,"homepage":"","language":"Common Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sile.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-10-15T04:43:57.000Z","updated_at":"2018-01-02T09:25:17.000Z","dependencies_parsed_at":"2022-07-17T11:46:49.056Z","dependency_job_id":null,"html_url":"https://github.com/sile/cl-dawg","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/sile/cl-dawg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fcl-dawg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fcl-dawg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fcl-dawg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fcl-dawg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sile","download_url":"https://codeload.github.com/sile/cl-dawg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sile%2Fcl-dawg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28699690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T17:25:48.045Z","status":"ssl_error","status_checked_at":"2026-01-23T17:25:47.153Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["common-lisp","dawg","double-array"],"created_at":"2024-11-07T03:38:21.866Z","updated_at":"2026-01-23T20:39:45.371Z","avatar_url":"https://github.com/sile.png","language":"Common Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"cl-dawg\n========\n\n- A map implementation based on DAWG (Directed Acyclic Word Graph)\n  - Maps are serialized to sequences of bytes using double array trie format\n- This takes static key set, and assigns the unique identifiers for the each keys\n  - Note that the input keys must be unique and lexically ordered\n  - The identifier assigned to a key is the zero-origin index of the key in the input sequence\n- This library aims to provide a handy way for building maps which have tens of millions of elements in Common Lisp\n\nBuild\n-----\n\n```lisp\n(require :asdf)\n(push *default-pathname-defaults* asdf:*central-registry*)\n(asdf:load-system :dawg)\n```\n\nExample\n-------\n\n```lisp\n(dawg:build :input \"/usr/share/dict/words\" :output \"words.dawg\")\n(defparameter *dawg* (dawg:load \"words.dawg\"))\n\n(dawg:member? \"hello\" *dawg*)\nT\n\n(dawg:get-id \"hello\" *dawg*)\n50195\n\n(dawg:each-common-prefix (id end) (\"hello\" *dawg*)\n  (print (list id (subseq \"hello\" 0 end))))\n(49012 \"h\")\n(49845 \"he\")\n(50183 \"hell\")\n(50195 \"hello\")\n```\n\nAPI\n---\n\n### `dawg:build (\u0026key input output byte-order show-progress) =\u003e t`\n\nBuilds a DAWG index file from the input key set.\n\n- `input`:\n  - The pathname of a key set file or a list of keys\n    - \"key set file\" is line delimitered plain text file (a line represents a key)\n  - Restrictions:\n    - The input keys must be unique and lexically ordered\n    - A key cannot contain null characters\n  - Type: `(or string pathname list)`\n- `output`:\n  - The pathname of the resulting DAWG index file\n  - Type: `(or string pathname)`\n- `byte-order`:\n  - The endianness of the output file\n  - Type: `(member :native :little :big)`\n  - Default: `:native`\n- `show-progress`:\n  - Indicates whether or not to show the progress\n  - Type: `boolean`\n  - Default: `nil`\n\n### `dawg:load (index-path \u0026key byte-order) =\u003e dawg:dawg`\n\nLoads the DAWG map from the specified index file.\n\n- `index-path`:\n  - The pathname of an index file that built via `dawg:build` function\n  - Type: `(or string pathname file-stream)`\n- `byte-order`:\n  - The endianness of the input file\n  - Type: `(member :native :little :big)`\n  - Default: `:native`\n\n### `dawg:member? (key dawg \u0026key start end) =\u003e boolean`\n\nReturns `t` if `dawg` contains the given key, otherwise `nil`.\n\n- `key`:\n  - Type: `(simple-array character)`\n- `dawg`:\n  - Type: `dawg:dawg`\n- `start`:\n  - The start position in `key`\n  - Type: `positive-fixnum`\n  - Default: `0`\n- `end`:\n  - The end position in `key`\n  - Type: `positive-fixnum`\n  - Default: `(length key)`\n\n### `dawg:get-id (key dawg \u0026key start end) =\u003e (or null fixnum)`\n\nReturns the identifier assigned to the given key.\nIf the key does not exist in `dawg`, this function will return `nil`.\n\n- `key`:\n  - Type: `(simple-array character)`\n- `dawg`:\n  - Type: `dawg:dawg`\n- `start`:\n  - The start position in `key`\n  - Type: `positive-fixnum`\n  - Default: `0`\n- `end`:\n  - The end position in `key`\n  - Type: `positive-fixnum`\n  - Default: `(length key)`\n　\n### `dawg:each-common-prefix ((match-id match-end) (key dawg \u0026key start end) \u0026body body)`\n\nExecutes common-prefix search for the given key.\n\nFor each key in `dawg` that matches the prefix part of `key`, `match-id` and `match-end` are bound then `body` is exeucted.\n\nBy using the `return` function, it is possible to break the loop halfway.\n\n- `match-id`:\n  - The identifier of the key matched with the prefix part of the input `key`\n  - Type: `positive-fixnum`\n- `match-end`:\n  - The end position of the matched part in the input `key` (i.e., the length of the matched key)\n  - Type: `positive-fixnum`\n- `key`:\n  - Type: `(simple-array character)`\n- `dawg`:\n  - Type: `dawg:dawg`\n- `start`:\n  - The start position in `key`\n  - Type: `positive-fixnum`\n  - Default: `0`\n- `end`:\n  - The end position in `key`\n  - Type: `positive-fixnum`\n  - Default: `(length key)`\n- `body`:\n  - The expression to be executed in each iteration\n\n### `dawg:each-predictive ((match-id) (key dawg \u0026key start end) \u0026body body)`\n\nA simplified version of `dawg:each-common-prefix` that does not bind the `match-end` variable in each iteration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Fcl-dawg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsile%2Fcl-dawg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsile%2Fcl-dawg/lists"}