crosseno / lexicon
Storage-neutral contracts for Crosseno language packs, lexical catalogs, and solver candidate queries.
Requires
- php: ^8.5
- ext-intl: *
- crosseno/core: ^0.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^12.5
This package is auto-updated.
Last update: 2026-07-26 18:56:50 UTC
README
Storage-neutral contracts for Crosseno language packs, lexical catalogs, and solver candidate queries.
The package defines solver indexes, cell patterns, candidate filtering, and stable lexical identity. An in-memory backend provides the reference behavior.
Installation
composer require crosseno/lexicon
The local workspace maps the sibling crosseno/core checkout to unreleased version 0.1.0. Published releases should resolve the tagged package from Packagist rather than retain the path repository.
Patterns and queries
<?php use Crosseno\Core\Grid\CellSymbol; use Crosseno\Lexicon\Candidate\CandidateConstraints; use Crosseno\Lexicon\Candidate\CandidateOrdering; use Crosseno\Lexicon\Candidate\CandidateQuery; use Crosseno\Lexicon\Pattern\CandidatePattern; use Crosseno\Lexicon\Pattern\PatternCell; $pattern = new CandidatePattern([ PatternCell::fixed(new CellSymbol('Ł')), PatternCell::unknown(), PatternCell::fixed(new CellSymbol('DŹ')), ]); $query = new CandidateQuery( $pattern, CandidateConstraints::permissive(), maximumResults: 100, ordering: CandidateOrdering::RankDescending, ); $candidates = $lexicon->candidates($query);
Patterns always have an exact cell count. A cell may contain multiple Unicode code points, and fixed symbols are compared exactly. Unknown cells may carry an allow/exclude CellEligibilityMask.
Language services
Language packs provide AnswerNormalizerInterface, CellTokenizerInterface, and LexicalEquivalenceInterface. The package defines no English, Polish, normalization, or morphology rules. Language tags use canonical BCP 47 form; matching must select exact, RFC 4647 basic-filtering, or RFC 4647 lookup behavior explicitly.
RuntimeLanguagePackInterface is the composition view for ordinary applications. It exposes the language pack, storage-neutral lexical clue catalog, solver index, exact ordinal keys, manifest-derived artifact/ordinal identity, and aggregate clue coverage. Concrete language packages load and validate artifacts; builders consume only this contract.
Stable identity
StableKeyFactory produces versioned answer, sense, and lexeme keys from ordered NFC canonical fields. Version 1 hashes an unambiguous length-prefixed byte stream with SHA-256. Keys include their entity type, source namespace, and algorithm major. See ADR 0001 for the byte-level contract.
Candidate semantics
CandidateConstraints explicitly controls inclusive/exclusive difficulty bounds, unknown difficulty, answer classes, tri-state proper-name and abbreviation flags, dialect matching, clue-language coverage, stable-key exclusions, themes, and the meaning of every empty set filter. Rich clue text is intentionally absent.
Non-goals
This package contains no SQLite adapter, binary-index reader, compiler, concrete language logic, clue assignment policy, generator, CMS integration, or persistence configuration. Lexical clue records are storage-neutral transfer records, not rendered or assigned clues.