From 5f495c1d4ee624f9d24f03e50700e7d9a9305b73 Mon Sep 17 00:00:00 2001 From: polwex Date: Sun, 22 Jun 2025 09:33:12 +0700 Subject: m --- .gitignore | 1 + CLAUDE.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ devenv.nix | 7 +++++-- 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 CLAUDE.md diff --git a/.gitignore b/.gitignore index 4d058db..b651cf1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ devenv.local.nix # pre-commit .pre-commit-config.yaml +base_trie diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..40e0fb0 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,54 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Build and Development Commands + +```bash +# Build the project +cd sorsyl && dune build + +# Run tests +cd sorsyl && dune test + +# Clean build artifacts +cd sorsyl && dune clean + +# Install dependencies (if needed) +opam install --deps-only . +``` + +## Project Architecture + +Sorsyl is an OCaml library for phonological analysis, specifically focused on sonority calculation for IPA (International Phonetic Alphabet) segments. + +### Core Components + +- **lib/sonority.ml**: Main sonority calculation logic using a decision tree based on phonological features (scale 1-9: voiceless stops to low vowels) +- **lib/feature.ml**: Phonological feature definitions and segment representation +- **lib/ipa_table.ml**: CSV data loading and IPA segment lookup functionality + +### Data Files + +The `data/` directory contains: +- `ipa_all.csv`: Main IPA character database with phonological features +- Various YAML configuration files for linguistic data (ASJP, diacritic definitions, etc.) + +### Decision Tree Sonority Scale + +The sonority calculation uses phonological features to classify segments: +- 9: Low vowels (most sonorous) +- 8: High vowels +- 7: Glides/approximants +- 6: Liquids +- 5: Nasals +- 4: Voiced fricatives +- 3: Voiceless fricatives +- 2: Voiced stops +- 1: Voiceless stops (least sonorous) + +### Development Environment + +Uses devenv.nix for development environment setup with OCaml toolchain and dependencies (csv, base, stdio libraries). + +The main executable (bin/main.ml) is currently incomplete - contains only a failwith placeholder. \ No newline at end of file diff --git a/devenv.nix b/devenv.nix index f5fd37b..3db693c 100644 --- a/devenv.nix +++ b/devenv.nix @@ -14,14 +14,17 @@ in { git pkg-config ]) - ++ (with oopkgs; [ocaml opam dune_3]) - ++ (with opkgs; [ + ++ (with pkgs; [ocaml opam dune_3]) + # ++ (with opkgs; [ + ++ (with pkgs.ocamlPackages; [ base + base_trie core utop ocamlformat csv ocaml-lsp + uunf uuseg ]); } -- cgit v1.2.3