commit 91e03ffb10220945fc73b9167f502ed50177d5c6 Author: polwex Date: Sun Oct 20 17:45:48 2024 +0700 init diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..5bf8fc1 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0=" + +use devenv \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d058db --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# Devenv +.devenv* +devenv.local.nix + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/data.ts b/data.ts new file mode 100644 index 0000000..3b4528c --- /dev/null +++ b/data.ts @@ -0,0 +1,20 @@ + + + +const data = { + nouns: { + animate: [], + inanimate: [], + countable: [], + uncountable: [], + genders: {}, + classifiers: {}, + }, + verbs: { + transitive: [], + intransitive: [], + action: [], + stative: [], + auxiliar: [], + } +} diff --git a/data/data.db b/data/data.db new file mode 100644 index 0000000..bdc0326 Binary files /dev/null and b/data/data.db differ diff --git a/data/schema.sql b/data/schema.sql new file mode 100644 index 0000000..8678b7e --- /dev/null +++ b/data/schema.sql @@ -0,0 +1,85 @@ +-- Enable foreign key support +PRAGMA foreign_keys = ON; + +-- Words table +CREATE TABLE words ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + spelling TEXT NOT NULL, + ipa TEXT NOT NULL, + language_id INTEGER NOT NULL, + FOREIGN KEY (language_id) REFERENCES languages(id) +); + +-- Languages table +CREATE TABLE languages ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL +); + +-- Parts of Speech table +CREATE TABLE parts_of_speech ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL +); + +-- Categories table (for noun and verb categories) +CREATE TABLE categories ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + name TEXT NOT NULL, + part_of_speech_id INTEGER NOT NULL, + FOREIGN KEY (part_of_speech_id) REFERENCES parts_of_speech(id) +); + +-- Word Categories junction table +CREATE TABLE word_categories ( + word_id INTEGER NOT NULL, + category_id INTEGER NOT NULL, + PRIMARY KEY (word_id, category_id), + FOREIGN KEY (word_id) REFERENCES words(id) +); + +-- Example data insertion +INSERT INTO languages (name) VALUES ('en-us'); +INSERT INTO languages (name) VALUES ('th'); +INSERT INTO languages (name) VALUES ('zh-cn'); +INSERT INTO languages (name) VALUES ('zh-hk'); +INSERT INTO languages (name) VALUES ('ja-jp'); + +INSERT INTO parts_of_speech (name) VALUES ('noun'), ('verb'), ('adjective'), ('adverb'), ('pronoun'), ('adposition'), ('conjunction'); + +INSERT INTO categories (name, part_of_speech_id) VALUES +('countable', 1), +('uncountable', 1), +('animate', 1), +('inanimate', 1), +('spatial', 1), +('temporal', 1), +('transitive', 2), +('intransitive', 2), +('action', 2), +('mental', 2), +('preposition', 6), +('postposition', 6), +('circumposition', 6); + +-- Example word insertion +INSERT INTO words (spelling, ipa, language_id) VALUES ('book', 'bʊk', 1); + +-- Categorize 'book' as a countable, inanimate noun +INSERT INTO word_categories (word_id, category_id) +SELECT + (SELECT id FROM words WHERE spelling = 'book'), + id +FROM categories +WHERE name IN ('countable', 'inanimate'); + +-- Example verb insertion +INSERT INTO words (spelling, ipa, language_id) VALUES ('think','θɪŋk', 1); + +-- Categorize 'think' as an intransitive, mental verb +INSERT INTO word_categories (word_id, category_id) +SELECT + (SELECT id FROM words WHERE spelling = 'think'), + id +FROM categories +WHERE name IN ('intransitive', 'mental'); diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..600f644 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,116 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1729277673, + "owner": "cachix", + "repo": "devenv", + "rev": "3c3ab087b53d3e4699a43018ac71b5e1091ed73d", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716977621, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1729181673, + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4eb33fe664af7b41a4c446f87d20c9a0a6321fa3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1729104314, + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..f3613c2 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,54 @@ +{ + pkgs, + lib, + config, + inputs, + ... +}: { + # https://devenv.sh/basics/ + env.GREET = "devenv"; + + # https://devenv.sh/packages/ + packages = with pkgs; [ + sqlite + ]; + + # https://devenv.sh/languages/ + # languages.rust.enable = true; + languages = { + elm.enable = true; + }; + + # https://devenv.sh/processes/ + # processes.cargo-watch.exec = "cargo-watch"; + + # https://devenv.sh/services/ + # services.postgres.enable = true; + + # https://devenv.sh/scripts/ + scripts.hello.exec = '' + echo hello from $GREET + ''; + + enterShell = '' + hello + git --version + ''; + + # https://devenv.sh/tasks/ + # tasks = { + # "myproj:setup".exec = "mytool build"; + # "devenv:enterShell".after = [ "myproj:setup" ]; + # }; + + # https://devenv.sh/tests/ + enterTest = '' + echo "Running tests" + git --version | grep --color=auto "${pkgs.git.version}" + ''; + + # https://devenv.sh/pre-commit-hooks/ + # pre-commit.hooks.shellcheck.enable = true; + + # See full reference at https://devenv.sh/reference/options/ +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..116a2ad --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,15 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + +# If you're using non-OSS software, you can set allowUnfree to true. +# allowUnfree: true + +# If you're willing to use a package that's vulnerable +# permittedInsecurePackages: +# - "openssl-1.1.1w" + +# If you have more than one devenv you can merge them +#imports: +# - ./backend diff --git a/ui/elm-stuff/0.19.1/d.dat b/ui/elm-stuff/0.19.1/d.dat new file mode 100644 index 0000000..565cbee Binary files /dev/null and b/ui/elm-stuff/0.19.1/d.dat differ diff --git a/ui/elm-stuff/0.19.1/i.dat b/ui/elm-stuff/0.19.1/i.dat new file mode 100644 index 0000000..5fe8016 Binary files /dev/null and b/ui/elm-stuff/0.19.1/i.dat differ diff --git a/ui/elm-stuff/0.19.1/lock b/ui/elm-stuff/0.19.1/lock new file mode 100644 index 0000000..e69de29 diff --git a/ui/elm-stuff/0.19.1/o.dat b/ui/elm-stuff/0.19.1/o.dat new file mode 100644 index 0000000..1df94ad Binary files /dev/null and b/ui/elm-stuff/0.19.1/o.dat differ diff --git a/ui/elm.json b/ui/elm.json new file mode 100644 index 0000000..5398be3 --- /dev/null +++ b/ui/elm.json @@ -0,0 +1,25 @@ +{ + "type": "application", + "source-directories": [ + "src" + ], + "elm-version": "0.19.1", + "dependencies": { + "direct": { + "elm/browser": "1.0.2", + "elm/core": "1.0.5", + "elm/html": "1.0.0", + "mdgriffith/elm-ui": "1.1.8" + }, + "indirect": { + "elm/json": "1.1.3", + "elm/time": "1.0.0", + "elm/url": "1.0.0", + "elm/virtual-dom": "1.0.3" + } + }, + "test-dependencies": { + "direct": {}, + "indirect": {} + } +} diff --git a/ui/index.html b/ui/index.html new file mode 100644 index 0000000..e69de29 diff --git a/ui/src/Main.elm b/ui/src/Main.elm new file mode 100644 index 0000000..628b7d7 --- /dev/null +++ b/ui/src/Main.elm @@ -0,0 +1,24 @@ +import Browser +import Html exposing (Html, button, div, text) +import Html.Events exposing (onClick) + +main = + Browser.sandbox { init = 0, update = update, view = view } + +-- user actions +type Msg = Increment | Decrement + +update msg model = + case msg of + Increment -> + model + 1 + + Decrement -> + model - 1 + +view model = + div [] + [ button [ onClick Decrement ] [ text "-" ] + , div [] [ text (String.fromInt model) ] + , button [ onClick Increment ] [ text "+" ] + ]