kotoshu 1.0.2-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.kotoshu-baseline.json +1 -0
- data/.pre-commit-hooks.yaml +18 -0
- data/.rspec +3 -0
- data/.rubocop.yml +351 -0
- data/.yardopts +8 -0
- data/CHANGELOG.md +813 -0
- data/CLAUDE.md +176 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Cargo.lock +359 -0
- data/Cargo.toml +15 -0
- data/LICENSE +31 -0
- data/README.adoc +1292 -0
- data/Rakefile +150 -0
- data/SECURITY.md +93 -0
- data/TODO.impl/00-cut-0.1.md +121 -0
- data/TODO.impl/00-cut-0.2.md +175 -0
- data/TODO.impl/00-vision.md +281 -0
- data/TODO.impl/01-hunspell-correctness.md +111 -0
- data/TODO.impl/02-cli-unification.md +74 -0
- data/TODO.impl/03-dynamic-download.md +107 -0
- data/TODO.impl/04-language-modules.md +89 -0
- data/TODO.impl/05-semantic-path.md +83 -0
- data/TODO.impl/06-cjk-support.md +105 -0
- data/TODO.impl/07-rtl-support.md +71 -0
- data/TODO.impl/08-grammar-engine.md +106 -0
- data/TODO.impl/09-integrity-security.md +90 -0
- data/TODO.impl/10-testing-ci.md +98 -0
- data/TODO.impl/100-full-feature-batch3.md +28 -0
- data/TODO.impl/101-int4-tier-experiment.md +32 -0
- data/TODO.impl/102-lid-chain.md +28 -0
- data/TODO.impl/103-oov-bucket-tables.md +27 -0
- data/TODO.impl/104-vscode-marketplace-readiness.md +32 -0
- data/TODO.impl/105-personal-dictionary-in-check.md +34 -0
- data/TODO.impl/106-native-lid-detection.md +36 -0
- data/TODO.impl/107-basic-support-every-staged-language.md +42 -0
- data/TODO.impl/108-ko-ne-full-feature.md +37 -0
- data/TODO.impl/109-ten-audit.md +26 -0
- data/TODO.impl/11-release-v1.md +95 -0
- data/TODO.impl/110-sr-latn-and-polish.md +33 -0
- data/TODO.impl/111-embedding-bakeoff.md +33 -0
- data/TODO.impl/112-deployability-and-gating.md +26 -0
- data/TODO.impl/113-language-packs.md +26 -0
- data/TODO.impl/114-typo-biencoder-thread.md +33 -0
- data/TODO.impl/115-hybrid-retrieval-pricing.md +22 -0
- data/TODO.impl/116-baseline-suggestion-skip.md +81 -0
- data/TODO.impl/117-deterministic-frequency-tiers.md +110 -0
- data/TODO.impl/118-server-gem-floor.md +33 -0
- data/TODO.impl/119-embedded-kelly-tiers.md +56 -0
- data/TODO.impl/120-setup-metadata-refresh.md +35 -0
- data/TODO.impl/121-jekyll-baseline-skip.md +33 -0
- data/TODO.impl/122-pack-compression-kpk2.md +66 -0
- data/TODO.impl/123-typo-corpus-synthesis.md +55 -0
- data/TODO.impl/124-owner-residue.md +19 -0
- data/TODO.impl/125-consumer-floor-guards.md +43 -0
- data/TODO.impl/126-tier-error-budgets.md +33 -0
- data/TODO.impl/127-suggestion-feedback-loop.md +34 -0
- data/TODO.impl/128-hybrid-pricing-verdict.md +47 -0
- data/TODO.impl/129-pt-fr-corpora.md +23 -0
- data/TODO.impl/130-news-truth-0912.md +23 -0
- data/TODO.impl/131-hybrid-productization.md +42 -0
- data/TODO.impl/132-techniques-page-and-prose.md +27 -0
- data/TODO.impl/133-rust-first-distribution.md +68 -0
- data/TODO.impl/20-encapsulation-cleanup.md +47 -0
- data/TODO.impl/21-autoload-migration.md +64 -0
- data/TODO.impl/22-url-pin-single-source-of-truth.md +120 -0
- data/TODO.impl/23-fix-url-defaults.md +57 -0
- data/TODO.impl/24-cli-auto-setup-prompt.md +76 -0
- data/TODO.impl/25-soft-onnxruntime-require.md +75 -0
- data/TODO.impl/26-onnx-vocab-json-generation.md +96 -0
- data/TODO.impl/27-end-to-end-smoke-spec.md +113 -0
- data/TODO.impl/28-readme-quickstart-verification.md +68 -0
- data/TODO.impl/29-status-command.md +84 -0
- data/TODO.impl/30-language-auto-detection.md +74 -0
- data/TODO.impl/31-download-progress.md +58 -0
- data/TODO.impl/32-sarif-output-verification.md +72 -0
- data/TODO.impl/33-audit-log-rotation.md +54 -0
- data/TODO.impl/34-cache-eviction.md +59 -0
- data/TODO.impl/35-shell-completion.md +61 -0
- data/TODO.impl/36-cleanup-regressions-0.3.1.md +134 -0
- data/TODO.impl/37-hunspell-correctness-tier2.md +203 -0
- data/TODO.impl/38-onnx-semantic-gating.md +218 -0
- data/TODO.impl/39-tier3-and-beyond.md +232 -0
- data/TODO.impl/40-spec-drift-cleanup.md +134 -0
- data/TODO.impl/50-structure-aware-document-api.md +194 -0
- data/TODO.impl/51-grammar-engine-expansion.md +75 -0
- data/TODO.impl/52-multi-language-documents.md +95 -0
- data/TODO.impl/53-document-plugin-architecture.md +94 -0
- data/TODO.impl/54-cjk-support.md +117 -0
- data/TODO.impl/55-rtl-support.md +109 -0
- data/TODO.impl/56-t4-t5-t6-quality-architecture-ecosystem.md +126 -0
- data/TODO.impl/57-t5.1-step3-pure-function-strategies.md +138 -0
- data/TODO.impl/58-t5.2-configuration-as-data.md +113 -0
- data/TODO.impl/59-yard-api-documentation.md +75 -0
- data/TODO.impl/60-lsp-server.md +174 -0
- data/TODO.impl/61-editor-ecosystem.md +167 -0
- data/TODO.impl/62-framework-integrations.md +159 -0
- data/TODO.impl/63-web-playground-wasm.md +186 -0
- data/TODO.impl/64-http-api-and-sdks.md +191 -0
- data/TODO.impl/65-universal-kotoshu.md +251 -0
- data/TODO.impl/66-kotoshu-core.md +169 -0
- data/TODO.impl/67-kotoshu-rs-and-access-libraries.md +137 -0
- data/TODO.impl/68-sota-adoption.md +152 -0
- data/TODO.impl/69-sota-typo-eval.md +74 -0
- data/TODO.impl/70-sota-confidence-cascade.md +59 -0
- data/TODO.impl/71-sota-nested-model.md +63 -0
- data/TODO.impl/72-model2vec-evaluation.md +49 -0
- data/TODO.impl/73-rl-reranker.md +42 -0
- data/TODO.impl/74-distilled-reranker.md +36 -0
- data/TODO.impl/75-llm-evaluator.md +35 -0
- data/TODO.impl/76-optional-llm-backend.md +37 -0
- data/TODO.impl/77-model-coverage-expansion.md +96 -0
- data/TODO.impl/78-in-browser-playground.md +69 -0
- data/TODO.impl/79-news-and-releases.md +60 -0
- data/TODO.impl/80-ecosystem-docs.md +56 -0
- data/TODO.impl/81-editor-reach.md +68 -0
- data/TODO.impl/82-doc-formats-and-ignores.md +81 -0
- data/TODO.impl/83-models-batch-2.md +56 -0
- data/TODO.impl/84-language-modules-wave2.md +75 -0
- data/TODO.impl/85-wasm-model-api.md +48 -0
- data/TODO.impl/86-site-truth-wave2.md +45 -0
- data/TODO.impl/87-lsp-personal-dictionary.md +36 -0
- data/TODO.impl/88-cli-directory-mode.md +54 -0
- data/TODO.impl/89-framework-integrations-exec.md +59 -0
- data/TODO.impl/90-gem-correctness-residues.md +44 -0
- data/TODO.impl/91-unicode-and-sv-aff.md +47 -0
- data/TODO.impl/92-tier-mirror-cors.md +88 -0
- data/TODO.impl/93-python-wheels.md +32 -0
- data/TODO.impl/94-site-integrations-docs.md +35 -0
- data/TODO.impl/95-editor-action-polish.md +27 -0
- data/TODO.impl/96-server-semantic-models.md +50 -0
- data/TODO.impl/97-yard-execution.md +73 -0
- data/TODO.impl/98-campaign-cleanup.md +78 -0
- data/TODO.impl/99-site-truth-performance-docs.md +31 -0
- data/conformance/vectors.jsonl +2630 -0
- data/data/en/grammar/rules.yaml +851 -0
- data/docs/STABILITY-1.0-AUDIT.md +251 -0
- data/docs/STABILITY-1.0.md +137 -0
- data/docs/cache-architecture.md +502 -0
- data/docs/verification-evidence/correct3/pr_body.md +37 -0
- data/docs/verification-evidence/correct3/rspec_final.log +5588 -0
- data/docs/verification-evidence/correct3/rspec_full.log +4504 -0
- data/docs/verification-evidence/correct3/sv.aff +856 -0
- data/docs/verification-evidence/correct3/sv.dic +153717 -0
- data/examples/01_basic_word_checking.rb +38 -0
- data/examples/02_text_document_checking.rb +77 -0
- data/examples/03_dictionary_backends.rb +137 -0
- data/examples/04_trie_data_structure.rb +146 -0
- data/examples/05_suggestion_algorithms.rb +239 -0
- data/examples/06_configuration_advanced.rb +287 -0
- data/examples/07_multi_language_dictionaries.rb +278 -0
- data/exe/kotoshu +6 -0
- data/lib/kotoshu/algorithms/capitalization.rb +276 -0
- data/lib/kotoshu/algorithms/edit_distance.rb +128 -0
- data/lib/kotoshu/algorithms/lookup/affix_form.rb +132 -0
- data/lib/kotoshu/algorithms/lookup/compound_checks.rb +209 -0
- data/lib/kotoshu/algorithms/lookup/compound_form.rb +50 -0
- data/lib/kotoshu/algorithms/lookup.rb +841 -0
- data/lib/kotoshu/algorithms/ngram_suggest.rb +367 -0
- data/lib/kotoshu/algorithms/permutations.rb +283 -0
- data/lib/kotoshu/algorithms/phonet_suggest.rb +162 -0
- data/lib/kotoshu/algorithms/soundex.rb +92 -0
- data/lib/kotoshu/algorithms/suggest.rb +794 -0
- data/lib/kotoshu/algorithms.rb +23 -0
- data/lib/kotoshu/analyzers/semantic_analyzer.rb +405 -0
- data/lib/kotoshu/analyzers.rb +8 -0
- data/lib/kotoshu/baseline/application.rb +18 -0
- data/lib/kotoshu/baseline/entry.rb +33 -0
- data/lib/kotoshu/baseline/store.rb +175 -0
- data/lib/kotoshu/baseline.rb +20 -0
- data/lib/kotoshu/cache/base_cache.rb +778 -0
- data/lib/kotoshu/cache/cache.rb +91 -0
- data/lib/kotoshu/cache/eviction_policy.rb +66 -0
- data/lib/kotoshu/cache/frequency_cache.rb +283 -0
- data/lib/kotoshu/cache/language_cache.rb +511 -0
- data/lib/kotoshu/cache/lookup_cache.rb +166 -0
- data/lib/kotoshu/cache/model_cache.rb +1147 -0
- data/lib/kotoshu/cache/model_registry.rb +109 -0
- data/lib/kotoshu/cache/staged_languages.rb +45 -0
- data/lib/kotoshu/cache/suggestion_cache.rb +113 -0
- data/lib/kotoshu/cache.rb +49 -0
- data/lib/kotoshu/cli/auto_setup.rb +71 -0
- data/lib/kotoshu/cli/baseline_command.rb +119 -0
- data/lib/kotoshu/cli/batch_reporter.rb +321 -0
- data/lib/kotoshu/cli/cache_command.rb +282 -0
- data/lib/kotoshu/cli/completions_command.rb +210 -0
- data/lib/kotoshu/cli/dict_command.rb +64 -0
- data/lib/kotoshu/cli/directory_check.rb +146 -0
- data/lib/kotoshu/cli/directory_walker.rb +132 -0
- data/lib/kotoshu/cli/display_formatter.rb +429 -0
- data/lib/kotoshu/cli/errors.rb +36 -0
- data/lib/kotoshu/cli/ignore_matcher.rb +205 -0
- data/lib/kotoshu/cli/interactive_reviewer.rb +314 -0
- data/lib/kotoshu/cli/language_resolver.rb +91 -0
- data/lib/kotoshu/cli/navigation_manager.rb +273 -0
- data/lib/kotoshu/cli/personal_command.rb +113 -0
- data/lib/kotoshu/cli/progress_reporter.rb +114 -0
- data/lib/kotoshu/cli/status_report.rb +130 -0
- data/lib/kotoshu/cli.rb +880 -0
- data/lib/kotoshu/components/passthrough_spell_checker.rb +70 -0
- data/lib/kotoshu/components/pos_tagger.rb +98 -0
- data/lib/kotoshu/components/spell_checker.rb +73 -0
- data/lib/kotoshu/components/synthesizer.rb +60 -0
- data/lib/kotoshu/components/tokenizer.rb +58 -0
- data/lib/kotoshu/components/whitespace_tokenizer.rb +94 -0
- data/lib/kotoshu/components.rb +13 -0
- data/lib/kotoshu/configuration/builder.rb +207 -0
- data/lib/kotoshu/configuration/resolver.rb +124 -0
- data/lib/kotoshu/configuration.rb +829 -0
- data/lib/kotoshu/conformance_exporter.rb +256 -0
- data/lib/kotoshu/conformance_runner.rb +176 -0
- data/lib/kotoshu/core/exceptions.rb +186 -0
- data/lib/kotoshu/core/indexed_dictionary.rb +293 -0
- data/lib/kotoshu/core/models/affix_rule.rb +262 -0
- data/lib/kotoshu/core/models/result/document_result.rb +132 -0
- data/lib/kotoshu/core/models/result/word_result.rb +131 -0
- data/lib/kotoshu/core/models/word.rb +131 -0
- data/lib/kotoshu/core/trie/builder.rb +119 -0
- data/lib/kotoshu/core/trie/node.rb +94 -0
- data/lib/kotoshu/core/trie/trie.rb +249 -0
- data/lib/kotoshu/core.rb +28 -0
- data/lib/kotoshu/data/common_words/de.yml +1800 -0
- data/lib/kotoshu/data/common_words/en.yml +1215 -0
- data/lib/kotoshu/data/common_words/es.yml +750 -0
- data/lib/kotoshu/data/common_words/fr.yml +1015 -0
- data/lib/kotoshu/data/common_words/pt.yml +870 -0
- data/lib/kotoshu/data/common_words/ru.yml +484 -0
- data/lib/kotoshu/data/common_words_loader.rb +141 -0
- data/lib/kotoshu/data/frozen_kelly/en.json +1154 -0
- data/lib/kotoshu/data/frozen_kelly.rb +38 -0
- data/lib/kotoshu/data.rb +8 -0
- data/lib/kotoshu/data_structures/bloom_filter.rb +188 -0
- data/lib/kotoshu/data_structures.rb +8 -0
- data/lib/kotoshu/debug_logger.rb +146 -0
- data/lib/kotoshu/debug_mode.rb +136 -0
- data/lib/kotoshu/defaults.rb +84 -0
- data/lib/kotoshu/dictionaries/catalog.rb +814 -0
- data/lib/kotoshu/dictionaries.rb +8 -0
- data/lib/kotoshu/dictionary/base.rb +324 -0
- data/lib/kotoshu/dictionary/cspell.rb +243 -0
- data/lib/kotoshu/dictionary/custom.rb +225 -0
- data/lib/kotoshu/dictionary/hunspell.rb +520 -0
- data/lib/kotoshu/dictionary/plain_text.rb +302 -0
- data/lib/kotoshu/dictionary/repository.rb +246 -0
- data/lib/kotoshu/dictionary/unified.rb +236 -0
- data/lib/kotoshu/dictionary/unix_words.rb +218 -0
- data/lib/kotoshu/dictionary.rb +15 -0
- data/lib/kotoshu/documents/document.rb +120 -0
- data/lib/kotoshu/documents/plain_text_document.rb +73 -0
- data/lib/kotoshu/documents/source_position.rb +45 -0
- data/lib/kotoshu/documents/source_range.rb +76 -0
- data/lib/kotoshu/documents/suppressions/scanner.rb +149 -0
- data/lib/kotoshu/documents/suppressions/suppression.rb +75 -0
- data/lib/kotoshu/documents/suppressions.rb +44 -0
- data/lib/kotoshu/documents/text_node.rb +49 -0
- data/lib/kotoshu/documents.rb +178 -0
- data/lib/kotoshu/embeddings/embedding_pipeline.rb +238 -0
- data/lib/kotoshu/embeddings/lru_cache.rb +244 -0
- data/lib/kotoshu/embeddings/onnx_runtime_model.rb +411 -0
- data/lib/kotoshu/embeddings/protocol.rb +96 -0
- data/lib/kotoshu/embeddings/protocols.rb +23 -0
- data/lib/kotoshu/embeddings/registry.rb +184 -0
- data/lib/kotoshu/embeddings/search.rb +204 -0
- data/lib/kotoshu/embeddings/similarity_engine.rb +278 -0
- data/lib/kotoshu/embeddings/similarity_search.rb +328 -0
- data/lib/kotoshu/embeddings/vocabulary.rb +306 -0
- data/lib/kotoshu/embeddings.rb +87 -0
- data/lib/kotoshu/fluent_checker.rb +94 -0
- data/lib/kotoshu/grammar/pattern_matchers/base_matcher.rb +48 -0
- data/lib/kotoshu/grammar/pattern_matchers/double_negative_matcher.rb +179 -0
- data/lib/kotoshu/grammar/pattern_matchers/phrase_matcher.rb +86 -0
- data/lib/kotoshu/grammar/pattern_matchers/possessive_context_matcher.rb +75 -0
- data/lib/kotoshu/grammar/pattern_matchers/possessive_contraction_matcher.rb +87 -0
- data/lib/kotoshu/grammar/pattern_matchers/sentence_start_matcher.rb +84 -0
- data/lib/kotoshu/grammar/pattern_matchers/vowel_sound_matcher.rb +81 -0
- data/lib/kotoshu/grammar/pattern_matchers/word_list_matcher.rb +66 -0
- data/lib/kotoshu/grammar/rule.rb +99 -0
- data/lib/kotoshu/grammar/rule_engine.rb +96 -0
- data/lib/kotoshu/grammar/rule_loader.rb +30 -0
- data/lib/kotoshu/grammar.rb +24 -0
- data/lib/kotoshu/integrity/audit_log.rb +167 -0
- data/lib/kotoshu/integrity/manifest.rb +116 -0
- data/lib/kotoshu/integrity/net_http.rb +51 -0
- data/lib/kotoshu/integrity/rotation_policy.rb +88 -0
- data/lib/kotoshu/integrity.rb +26 -0
- data/lib/kotoshu/jekyll.rb +101 -0
- data/lib/kotoshu/keyboard/layout.rb +116 -0
- data/lib/kotoshu/keyboard/layouts/arabic.rb +59 -0
- data/lib/kotoshu/keyboard/layouts/azerty.rb +55 -0
- data/lib/kotoshu/keyboard/layouts/bulgarian.rb +57 -0
- data/lib/kotoshu/keyboard/layouts/devanagari_inscript.rb +52 -0
- data/lib/kotoshu/keyboard/layouts/dubeolsik.rb +56 -0
- data/lib/kotoshu/keyboard/layouts/dvorak.rb +54 -0
- data/lib/kotoshu/keyboard/layouts/greek.rb +52 -0
- data/lib/kotoshu/keyboard/layouts/hebrew.rb +57 -0
- data/lib/kotoshu/keyboard/layouts/hrsl.rb +94 -0
- data/lib/kotoshu/keyboard/layouts/jcuken.rb +57 -0
- data/lib/kotoshu/keyboard/layouts/latin.rb +266 -0
- data/lib/kotoshu/keyboard/layouts/persian.rb +58 -0
- data/lib/kotoshu/keyboard/layouts/qwerty.rb +52 -0
- data/lib/kotoshu/keyboard/layouts/qwertz.rb +55 -0
- data/lib/kotoshu/keyboard/layouts/serbian.rb +59 -0
- data/lib/kotoshu/keyboard/layouts/turkish_q.rb +52 -0
- data/lib/kotoshu/keyboard/layouts/ukrainian.rb +51 -0
- data/lib/kotoshu/keyboard/registry.rb +201 -0
- data/lib/kotoshu/keyboard.rb +96 -0
- data/lib/kotoshu/kotoshu_native.so +0 -0
- data/lib/kotoshu/language/detector.rb +242 -0
- data/lib/kotoshu/language/identifier.rb +376 -0
- data/lib/kotoshu/language/languages/base.rb +271 -0
- data/lib/kotoshu/language/lid_detector.rb +188 -0
- data/lib/kotoshu/language/normalizer/arabic.rb +113 -0
- data/lib/kotoshu/language/normalizer/base.rb +133 -0
- data/lib/kotoshu/language/normalizer/greek.rb +63 -0
- data/lib/kotoshu/language/normalizer/hebrew.rb +72 -0
- data/lib/kotoshu/language/normalizer/persian.rb +36 -0
- data/lib/kotoshu/language/normalizer/turkish.rb +38 -0
- data/lib/kotoshu/language/registry.rb +209 -0
- data/lib/kotoshu/language/resources/ar/common_words.txt +6753 -0
- data/lib/kotoshu/language/resources/ar/confusion_sets.txt +11 -0
- data/lib/kotoshu/language/resources/de/common_words.txt +10003 -0
- data/lib/kotoshu/language/resources/de/confusion_sets.txt +246 -0
- data/lib/kotoshu/language/resources/en/common_words.txt +9979 -0
- data/lib/kotoshu/language/resources/en/confusion_sets.txt +871 -0
- data/lib/kotoshu/language/resources/es/common_words.txt +9992 -0
- data/lib/kotoshu/language/resources/es/confusion_sets.txt +17 -0
- data/lib/kotoshu/language/resources/fr/common_words.txt +9993 -0
- data/lib/kotoshu/language/resources/fr/confusion_sets.txt +76 -0
- data/lib/kotoshu/language/resources/pt/common_words.txt +9977 -0
- data/lib/kotoshu/language/resources/pt/confusion_sets.txt +18 -0
- data/lib/kotoshu/language/resources/ru/common_words.txt +9951 -0
- data/lib/kotoshu/language/resources/ru/confusion_sets.txt +5 -0
- data/lib/kotoshu/language/script.rb +128 -0
- data/lib/kotoshu/language/segmenter.rb +122 -0
- data/lib/kotoshu/language/suika.rb +38 -0
- data/lib/kotoshu/language/tokenizer/base.rb +187 -0
- data/lib/kotoshu/language/tokenizer/cyrillic_tokenizer.rb +76 -0
- data/lib/kotoshu/language/tokenizer/devanagari_tokenizer.rb +70 -0
- data/lib/kotoshu/language/tokenizer/french_tokenizer.rb +172 -0
- data/lib/kotoshu/language/tokenizer/german_tokenizer.rb +41 -0
- data/lib/kotoshu/language/tokenizer/greek_tokenizer.rb +72 -0
- data/lib/kotoshu/language/tokenizer/hangul_tokenizer.rb +70 -0
- data/lib/kotoshu/language/tokenizer/japanese_tokenizer.rb +55 -0
- data/lib/kotoshu/language/tokenizer/latin_tokenizer.rb +153 -0
- data/lib/kotoshu/language/tokenizer/portuguese_tokenizer.rb +160 -0
- data/lib/kotoshu/language/tokenizer/russian_tokenizer.rb +93 -0
- data/lib/kotoshu/language/tokenizer/script_tokenizer.rb +62 -0
- data/lib/kotoshu/language/tokenizer/spanish_tokenizer.rb +122 -0
- data/lib/kotoshu/language.rb +127 -0
- data/lib/kotoshu/languages/ar/language.rb +98 -0
- data/lib/kotoshu/languages/bg/language.rb +37 -0
- data/lib/kotoshu/languages/ca/language.rb +22 -0
- data/lib/kotoshu/languages/cs/language.rb +22 -0
- data/lib/kotoshu/languages/da/language.rb +22 -0
- data/lib/kotoshu/languages/de/language.rb +554 -0
- data/lib/kotoshu/languages/el/language.rb +50 -0
- data/lib/kotoshu/languages/en/language.rb +470 -0
- data/lib/kotoshu/languages/es/language.rb +476 -0
- data/lib/kotoshu/languages/et/language.rb +24 -0
- data/lib/kotoshu/languages/fa/language.rb +91 -0
- data/lib/kotoshu/languages/fr/language.rb +505 -0
- data/lib/kotoshu/languages/he/language.rb +98 -0
- data/lib/kotoshu/languages/hr/language.rb +24 -0
- data/lib/kotoshu/languages/hu/language.rb +22 -0
- data/lib/kotoshu/languages/id/language.rb +25 -0
- data/lib/kotoshu/languages/it/language.rb +22 -0
- data/lib/kotoshu/languages/ja/language.rb +476 -0
- data/lib/kotoshu/languages/ko/language.rb +56 -0
- data/lib/kotoshu/languages/latin_base.rb +53 -0
- data/lib/kotoshu/languages/lt/language.rb +24 -0
- data/lib/kotoshu/languages/lv/language.rb +24 -0
- data/lib/kotoshu/languages/nb/language.rb +25 -0
- data/lib/kotoshu/languages/ne/language.rb +60 -0
- data/lib/kotoshu/languages/nl/language.rb +22 -0
- data/lib/kotoshu/languages/nn/language.rb +26 -0
- data/lib/kotoshu/languages/pl/language.rb +22 -0
- data/lib/kotoshu/languages/pt/language.rb +439 -0
- data/lib/kotoshu/languages/ro/language.rb +22 -0
- data/lib/kotoshu/languages/ru/language.rb +420 -0
- data/lib/kotoshu/languages/sk/language.rb +25 -0
- data/lib/kotoshu/languages/sl/language.rb +25 -0
- data/lib/kotoshu/languages/sr/language.rb +39 -0
- data/lib/kotoshu/languages/sr-Latn/language.rb +35 -0
- data/lib/kotoshu/languages/sv/language.rb +22 -0
- data/lib/kotoshu/languages/tr/language.rb +36 -0
- data/lib/kotoshu/languages/uk/language.rb +38 -0
- data/lib/kotoshu/languages/vi/language.rb +22 -0
- data/lib/kotoshu/languages.rb +64 -0
- data/lib/kotoshu/metrics_collector.rb +238 -0
- data/lib/kotoshu/metrics_module.rb +121 -0
- data/lib/kotoshu/models/context.rb +119 -0
- data/lib/kotoshu/models/embedding_model.rb +181 -0
- data/lib/kotoshu/models/fasttext_model.rb +212 -0
- data/lib/kotoshu/models/nearest_neighbor.rb +96 -0
- data/lib/kotoshu/models/onnx_model.rb +330 -0
- data/lib/kotoshu/models/semantic_error.rb +204 -0
- data/lib/kotoshu/models/suggestion.rb +106 -0
- data/lib/kotoshu/models/word_embedding.rb +97 -0
- data/lib/kotoshu/models.rb +27 -0
- data/lib/kotoshu/multi_language_checker.rb +127 -0
- data/lib/kotoshu/native.rb +83 -0
- data/lib/kotoshu/native_backend.rb +131 -0
- data/lib/kotoshu/paths.rb +79 -0
- data/lib/kotoshu/personal_dictionary.rb +105 -0
- data/lib/kotoshu/plugins/plugin.rb +61 -0
- data/lib/kotoshu/plugins/registry.rb +118 -0
- data/lib/kotoshu/plugins.rb +9 -0
- data/lib/kotoshu/project_config.rb +76 -0
- data/lib/kotoshu/readers/aff_data.rb +530 -0
- data/lib/kotoshu/readers/aff_reader.rb +393 -0
- data/lib/kotoshu/readers/condition_checker.rb +125 -0
- data/lib/kotoshu/readers/dic_reader.rb +208 -0
- data/lib/kotoshu/readers/file_reader.rb +377 -0
- data/lib/kotoshu/readers/lookup_builder.rb +584 -0
- data/lib/kotoshu/readers/readers.rb +17 -0
- data/lib/kotoshu/readers.rb +25 -0
- data/lib/kotoshu/resource_bundle.rb +55 -0
- data/lib/kotoshu/resource_manager.rb +600 -0
- data/lib/kotoshu/results/result.rb +165 -0
- data/lib/kotoshu/results.rb +8 -0
- data/lib/kotoshu/rspec.rb +163 -0
- data/lib/kotoshu/scripts/fasttext_to_onnx.py +275 -0
- data/lib/kotoshu/source_registry.rb +104 -0
- data/lib/kotoshu/spellchecker/parallel_checker.rb +90 -0
- data/lib/kotoshu/spellchecker.rb +406 -0
- data/lib/kotoshu/string_metrics.rb +153 -0
- data/lib/kotoshu/suggestions/context.rb +43 -0
- data/lib/kotoshu/suggestions/frequency_provider.rb +80 -0
- data/lib/kotoshu/suggestions/generator.rb +169 -0
- data/lib/kotoshu/suggestions/pipeline.rb +135 -0
- data/lib/kotoshu/suggestions/semantic_cascade.rb +73 -0
- data/lib/kotoshu/suggestions/strategies/base_strategy.rb +315 -0
- data/lib/kotoshu/suggestions/strategies/composite_strategy.rb +197 -0
- data/lib/kotoshu/suggestions/strategies/edit_distance_strategy.rb +631 -0
- data/lib/kotoshu/suggestions/strategies/keyboard_proximity_strategy.rb +207 -0
- data/lib/kotoshu/suggestions/strategies/ngram_strategy.rb +165 -0
- data/lib/kotoshu/suggestions/strategies/phonetic_strategy.rb +284 -0
- data/lib/kotoshu/suggestions/strategies/semantic_strategy.rb +317 -0
- data/lib/kotoshu/suggestions/strategies/symspell_strategy.rb +270 -0
- data/lib/kotoshu/suggestions/strategies/word_index.rb +78 -0
- data/lib/kotoshu/suggestions/suggestion.rb +154 -0
- data/lib/kotoshu/suggestions/suggestion_set.rb +270 -0
- data/lib/kotoshu/suggestions/sweep_index.rb +137 -0
- data/lib/kotoshu/suggestions.rb +29 -0
- data/lib/kotoshu/tasks/check_task.rb +104 -0
- data/lib/kotoshu/tasks.rb +11 -0
- data/lib/kotoshu/validators/spelling_validator.rb +101 -0
- data/lib/kotoshu/validators.rb +9 -0
- data/lib/kotoshu/version.rb +5 -0
- data/lib/kotoshu.rb +538 -0
- data/rakelib/compile.rake +10 -0
- data/script/validate_all_dictionaries.rb +444 -0
- data/scripts/build_native_gem.rb +45 -0
- data/scripts/extract_eval_grids.rb +37 -0
- data/scripts/generate_frozen_tiers.rb +44 -0
- data/sig/kotoshu.rbs +435 -0
- data/test_oop.rb +79 -0
- metadata +546 -0
|
@@ -0,0 +1,4504 @@
|
|
|
1
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/jekyll_generator_spec.rb:16: warning: already initialized constant EN_AFF
|
|
2
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/cli/check_directory_spec.rb:14: warning: previous definition of EN_AFF was here
|
|
3
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/jekyll_generator_spec.rb:17: warning: already initialized constant EN_DIC
|
|
4
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/cli/check_directory_spec.rb:15: warning: previous definition of EN_DIC was here
|
|
5
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/rspec_spec.rb:13: warning: already initialized constant EN_AFF
|
|
6
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/jekyll_generator_spec.rb:16: warning: previous definition of EN_AFF was here
|
|
7
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/rspec_spec.rb:14: warning: already initialized constant EN_DIC
|
|
8
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/jekyll_generator_spec.rb:17: warning: previous definition of EN_DIC was here
|
|
9
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/tasks/check_task_spec.rb:12: warning: already initialized constant EN_AFF
|
|
10
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/rspec_spec.rb:13: warning: previous definition of EN_AFF was here
|
|
11
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/tasks/check_task_spec.rb:13: warning: already initialized constant EN_DIC
|
|
12
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/rspec_spec.rb:14: warning: previous definition of EN_DIC was here
|
|
13
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/validators/spelling_validator_spec.rb:18: warning: already initialized constant EN_AFF
|
|
14
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/tasks/check_task_spec.rb:12: warning: previous definition of EN_AFF was here
|
|
15
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/validators/spelling_validator_spec.rb:19: warning: already initialized constant EN_DIC
|
|
16
|
+
/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/tasks/check_task_spec.rb:13: warning: previous definition of EN_DIC was here
|
|
17
|
+
Run options: exclude {onnx: true, slow: true, network: true}
|
|
18
|
+
|
|
19
|
+
Randomized with seed 63564
|
|
20
|
+
|
|
21
|
+
Kotoshu::Language::Segmenter
|
|
22
|
+
#segment
|
|
23
|
+
groups consecutive same-language nodes into one Segment
|
|
24
|
+
every segment carries a language_code
|
|
25
|
+
raises ArgumentError for a non-Document argument
|
|
26
|
+
every segment carries its text_nodes in source order
|
|
27
|
+
returns [] for a document with no text nodes
|
|
28
|
+
with a custom detector
|
|
29
|
+
uses the injected detector
|
|
30
|
+
|
|
31
|
+
en_US Hunspell correctness
|
|
32
|
+
affix-driven inflections
|
|
33
|
+
accepts "quickly" (adverb)
|
|
34
|
+
accepts "taller" (comparative)
|
|
35
|
+
accepts "running" (gerund)
|
|
36
|
+
accepts "happiest" (superlative)
|
|
37
|
+
accepts "cats" (plural)
|
|
38
|
+
accepts "dogs" (plural)
|
|
39
|
+
common misspellings
|
|
40
|
+
rejects "accross"
|
|
41
|
+
rejects "enviroment"
|
|
42
|
+
rejects "helo"
|
|
43
|
+
rejects "recieve"
|
|
44
|
+
rejects "wrld"
|
|
45
|
+
rejects "programmng"
|
|
46
|
+
rejects "seperate"
|
|
47
|
+
rejects "beleive"
|
|
48
|
+
rejects "tesst"
|
|
49
|
+
release acceptance suggestion test
|
|
50
|
+
suggests 'hello' as the top correction for 'helo'
|
|
51
|
+
correctly-spelled English words
|
|
52
|
+
accepts "cats"
|
|
53
|
+
accepts "computer"
|
|
54
|
+
accepts "keyboard"
|
|
55
|
+
accepts "dictionary"
|
|
56
|
+
accepts "test"
|
|
57
|
+
accepts "world"
|
|
58
|
+
accepts "language"
|
|
59
|
+
accepts "hello"
|
|
60
|
+
accepts "quickly"
|
|
61
|
+
accepts "happiest"
|
|
62
|
+
accepts "programming"
|
|
63
|
+
accepts "taller"
|
|
64
|
+
accepts "ruby"
|
|
65
|
+
accepts "dogs"
|
|
66
|
+
accepts "running"
|
|
67
|
+
loading the dictionary
|
|
68
|
+
detects ISO-8859-1 encoding from the SET directive
|
|
69
|
+
loads a non-trivial number of words
|
|
70
|
+
|
|
71
|
+
Kotoshu::Readers::DicReader
|
|
72
|
+
#initialize
|
|
73
|
+
defaults encoding, flag_format, and flag_synonyms
|
|
74
|
+
exposes path, encoding, flag_format, flag_synonyms readers
|
|
75
|
+
Kotoshu::Readers::Word
|
|
76
|
+
.from_line (morph data via key:value fallback)
|
|
77
|
+
splits before the first key:value token when no tab is present
|
|
78
|
+
.parse_morph_data
|
|
79
|
+
splits whitespace-separated tokens
|
|
80
|
+
collapses runs of whitespace
|
|
81
|
+
returns empty array for nil
|
|
82
|
+
returns empty array for empty string
|
|
83
|
+
returns a single token
|
|
84
|
+
.parse_flags
|
|
85
|
+
resolves AF aliases for pure-digit strings when synonyms exist
|
|
86
|
+
does not consult aliases for non-digit strings even with synonyms
|
|
87
|
+
splits chars for short format
|
|
88
|
+
returns empty set for empty string
|
|
89
|
+
returns empty set for nil
|
|
90
|
+
falls back to char splitting for unknown formats
|
|
91
|
+
does not consult aliases when synonyms is empty
|
|
92
|
+
groups 2-char tokens for long format
|
|
93
|
+
splits chars for UTF-8 format
|
|
94
|
+
extracts digit runs for num format
|
|
95
|
+
.from_line (bare stem)
|
|
96
|
+
strips surrounding whitespace from the head
|
|
97
|
+
parses a bare stem with no flags or morph data
|
|
98
|
+
.from_line (stem/flags with FLAG short)
|
|
99
|
+
returns empty flags when flags string is empty
|
|
100
|
+
splits stem and flags at the unescaped slash
|
|
101
|
+
returns empty flags when no flag_format is in context
|
|
102
|
+
.unescaped_slash_index
|
|
103
|
+
skips an escaped slash and finds the next unescaped one
|
|
104
|
+
returns the index of the first unescaped slash
|
|
105
|
+
returns nil when every slash is escaped
|
|
106
|
+
finds a slash at position 0
|
|
107
|
+
returns nil for a string with no slash
|
|
108
|
+
.from_line (FLAG long format)
|
|
109
|
+
groups flag chars into 2-char tokens
|
|
110
|
+
.from_line (AF flag aliases)
|
|
111
|
+
resolves a numeric alias through flag_synonyms
|
|
112
|
+
does not consult aliases when synonyms is empty
|
|
113
|
+
returns empty set for an unknown alias index
|
|
114
|
+
.from_line (morph data via tab)
|
|
115
|
+
splits stem from morph data on the tab
|
|
116
|
+
preserves the slash-split before the morph split
|
|
117
|
+
.from_line (FLAG UTF-8 format)
|
|
118
|
+
treats flag string as chars
|
|
119
|
+
.from_line (escaped slash)
|
|
120
|
+
treats \/ as a literal slash inside the stem
|
|
121
|
+
treats \/ as literal and splits at the next unescaped slash
|
|
122
|
+
.from_line (leading slash)
|
|
123
|
+
treats a leading slash as part of the stem, not empty-stem+flags
|
|
124
|
+
parses a single-slash entry as a word whose only char is /
|
|
125
|
+
.from_line (FLAG num format)
|
|
126
|
+
extracts numeric flag tokens
|
|
127
|
+
.split_stem_and_morph
|
|
128
|
+
splits before the first key:value token when no tab is present
|
|
129
|
+
splits on a tab when one is present
|
|
130
|
+
returns the whole line with empty morph when no separator is found
|
|
131
|
+
Word struct shape
|
|
132
|
+
exposes stem, flags, morph_data readers (keyword_init)
|
|
133
|
+
#read
|
|
134
|
+
skips the first line (word count header)
|
|
135
|
+
returns an empty array for an empty dic body
|
|
136
|
+
parses flags using the configured flag_format
|
|
137
|
+
resolves AF aliases when flag_synonyms is configured
|
|
138
|
+
parses morph data following the tab
|
|
139
|
+
|
|
140
|
+
Integrational Suggestion Tests
|
|
141
|
+
Prohibit Bad Suggestions
|
|
142
|
+
passes forceucase suggestion tests
|
|
143
|
+
passes opentaal_forbiddenword2 suggestion tests
|
|
144
|
+
passes onlyincompound suggestion tests
|
|
145
|
+
passes nosplitsugs suggestion tests
|
|
146
|
+
passes opentaal_forbiddenword1 suggestion tests
|
|
147
|
+
passes nosuggest suggestion tests
|
|
148
|
+
passes keepcase suggestion tests
|
|
149
|
+
Permutations
|
|
150
|
+
passes reputf suggestion tests
|
|
151
|
+
passes maputf suggestion tests
|
|
152
|
+
passes map suggestion tests
|
|
153
|
+
passes rep suggestion tests
|
|
154
|
+
Base
|
|
155
|
+
passes base_utf suggestion tests
|
|
156
|
+
passes base suggestion tests
|
|
157
|
+
Break
|
|
158
|
+
passes breakdefault suggestion tests
|
|
159
|
+
All Caps
|
|
160
|
+
passes allcaps_utf suggestion tests
|
|
161
|
+
passes allcaps suggestion tests
|
|
162
|
+
passes allcaps2 suggestion tests
|
|
163
|
+
Edge Cases and Bugs
|
|
164
|
+
passes i35725 suggestion tests
|
|
165
|
+
passes ngram_utf_fix suggestion tests
|
|
166
|
+
passes i54633 suggestion tests
|
|
167
|
+
passes 1695964 suggestion tests
|
|
168
|
+
passes i58202 suggestion tests
|
|
169
|
+
passes 1463589 suggestion tests
|
|
170
|
+
passes 1463589_utf suggestion tests
|
|
171
|
+
passes IJ suggestion tests
|
|
172
|
+
passes utf8_nonbmp suggestion tests
|
|
173
|
+
passes checksharpsutf suggestion tests
|
|
174
|
+
passes checksharps suggestion tests
|
|
175
|
+
passes opentaal_keepcase suggestion tests
|
|
176
|
+
IO Quirks
|
|
177
|
+
passes oconv suggestion tests
|
|
178
|
+
Phonetical Suggestions
|
|
179
|
+
passes ph2 suggestion tests
|
|
180
|
+
passes phone suggestion tests
|
|
181
|
+
passes ph suggestion tests
|
|
182
|
+
Suggest Base
|
|
183
|
+
passes sug2 suggestion tests
|
|
184
|
+
passes sugutf suggestion tests
|
|
185
|
+
passes sug suggestion tests
|
|
186
|
+
|
|
187
|
+
Kotoshu::Readers::StringReader
|
|
188
|
+
#each
|
|
189
|
+
skips empty lines
|
|
190
|
+
returns an Enumerator when no block is given
|
|
191
|
+
yields [line_no, line] pairs from a string
|
|
192
|
+
strips UTF-8 BOM from the first line
|
|
193
|
+
#reset
|
|
194
|
+
resets to the beginning
|
|
195
|
+
|
|
196
|
+
Kotoshu::Algorithms::Permutations
|
|
197
|
+
.mapchars
|
|
198
|
+
recurses to map multiple positions
|
|
199
|
+
returns nothing for nil maptable
|
|
200
|
+
returns nothing for words shorter than 2 chars
|
|
201
|
+
returns nothing for empty maptable
|
|
202
|
+
yields variants with mapped characters
|
|
203
|
+
.longswapchar
|
|
204
|
+
yields non-adjacent swaps within MAX_CHAR_DISTANCE
|
|
205
|
+
does not swap adjacent positions (those are swapchar's job)
|
|
206
|
+
returns nothing for words too short for non-adjacent swaps
|
|
207
|
+
.forgotchar
|
|
208
|
+
returns nothing for nil trystring
|
|
209
|
+
yields every single-char insertion from trystring
|
|
210
|
+
returns nothing for empty trystring
|
|
211
|
+
.badcharkey
|
|
212
|
+
does not yield uppercase for already-uppercase chars
|
|
213
|
+
yields nothing for keys not in the layout
|
|
214
|
+
yields the uppercase variant when char is lowercase
|
|
215
|
+
yields adjacent-key variants
|
|
216
|
+
.replchars
|
|
217
|
+
yields each replaced variant
|
|
218
|
+
returns nothing (yields nothing) for words shorter than 2 chars
|
|
219
|
+
yields multiple matches when the pattern occurs more than once
|
|
220
|
+
yields a list variant when the replacement introduces a space
|
|
221
|
+
returns nothing for an empty reptable
|
|
222
|
+
returns nothing for a nil reptable
|
|
223
|
+
.doubletwochars
|
|
224
|
+
returns nothing for words shorter than 5 chars
|
|
225
|
+
returns nothing when no doubling pattern is present
|
|
226
|
+
collapses accidental doubling like 'vacacation' -> 'vacation'
|
|
227
|
+
.extrachar
|
|
228
|
+
returns nothing for words shorter than 2 chars
|
|
229
|
+
yields every single-char deletion
|
|
230
|
+
.movechar
|
|
231
|
+
yields chars moved forward by 2-4 positions
|
|
232
|
+
yields chars moved backward by 2-4 positions
|
|
233
|
+
returns nothing for words shorter than 2 chars
|
|
234
|
+
.swapchar
|
|
235
|
+
yields double swaps for 5-letter words
|
|
236
|
+
yields double swaps for 4-letter words
|
|
237
|
+
returns nothing for words shorter than 2 chars
|
|
238
|
+
yields single-adjacent swaps
|
|
239
|
+
.twowords
|
|
240
|
+
yields every two-word split
|
|
241
|
+
yields (n-1) splits for an n-char word
|
|
242
|
+
.badchar
|
|
243
|
+
returns nothing for empty trystring
|
|
244
|
+
returns nothing for nil trystring
|
|
245
|
+
yields chars replaced with chars from trystring
|
|
246
|
+
does not yield when the replacement char equals the existing one
|
|
247
|
+
MAX_CHAR_DISTANCE constant
|
|
248
|
+
is 4
|
|
249
|
+
|
|
250
|
+
Kotoshu::Dictionaries::Catalog# Integration - Dictionary Catalog
|
|
251
|
+
.hunspell
|
|
252
|
+
returns all Hunspell dictionaries
|
|
253
|
+
.all
|
|
254
|
+
returns an array of DictionaryEntry objects
|
|
255
|
+
includes dictionaries from multiple sources
|
|
256
|
+
.statistics
|
|
257
|
+
returns catalog statistics
|
|
258
|
+
has correct counts
|
|
259
|
+
.by_license
|
|
260
|
+
returns Public Domain dictionaries
|
|
261
|
+
returns GPL dictionaries
|
|
262
|
+
Kotoshu::Dictionaries::Catalog::DictionaryEntry
|
|
263
|
+
#plain_text?
|
|
264
|
+
returns false for Hunspell format
|
|
265
|
+
#initialize
|
|
266
|
+
creates a valid entry
|
|
267
|
+
freezes the entry
|
|
268
|
+
#hunspell?
|
|
269
|
+
returns false for plain text format
|
|
270
|
+
returns true for Hunspell format
|
|
271
|
+
#description
|
|
272
|
+
returns human-readable description
|
|
273
|
+
without region
|
|
274
|
+
returns description without region
|
|
275
|
+
.by_language
|
|
276
|
+
returns all dictionaries for a language
|
|
277
|
+
is case-insensitive
|
|
278
|
+
returns empty array for unknown language
|
|
279
|
+
.licenses
|
|
280
|
+
returns array of unique license types
|
|
281
|
+
.find
|
|
282
|
+
when dictionary exists
|
|
283
|
+
is case-insensitive
|
|
284
|
+
finds dictionary with underscore notation
|
|
285
|
+
finds dictionary by exact code
|
|
286
|
+
when dictionary does not exist
|
|
287
|
+
returns nil for empty string
|
|
288
|
+
returns nil for unknown code
|
|
289
|
+
.plain_text
|
|
290
|
+
returns all plain text dictionaries
|
|
291
|
+
.languages
|
|
292
|
+
returns array of unique language codes
|
|
293
|
+
.by_format
|
|
294
|
+
returns all plain text dictionaries
|
|
295
|
+
returns all Hunspell dictionaries
|
|
296
|
+
|
|
297
|
+
Kotoshu::Embeddings
|
|
298
|
+
Kotoshu::Embeddings::OnnxRuntimeModel
|
|
299
|
+
#model_info
|
|
300
|
+
returns the documented shape
|
|
301
|
+
#unload!
|
|
302
|
+
is a no-op when the model was never loaded, returning self
|
|
303
|
+
#initialize
|
|
304
|
+
starts not-loaded
|
|
305
|
+
exposes language_code, onnx_path, dimension
|
|
306
|
+
defaults dimension to 300
|
|
307
|
+
metadata methods
|
|
308
|
+
#supports_batching? is true
|
|
309
|
+
#model_type returns 'onnx'
|
|
310
|
+
#to_s includes language, dimension, and loaded state
|
|
311
|
+
#batch_size returns the BATCH_SIZE constant
|
|
312
|
+
.from_file
|
|
313
|
+
auto-detects language code from the basename (xx pattern)
|
|
314
|
+
defaults to 'en' when no language pattern is found in the basename
|
|
315
|
+
passes through explicit language_code and dimension overrides
|
|
316
|
+
raises ArgumentError when the file does not exist
|
|
317
|
+
Kotoshu::Embeddings::EmbeddingModelProtocol
|
|
318
|
+
requires the documented embedding-model methods
|
|
319
|
+
Kotoshu::Embeddings::Protocol
|
|
320
|
+
lets `required` add method names to required_methods
|
|
321
|
+
exposes optional_methods as a Set (empty by default)
|
|
322
|
+
lets `optional` add method names to optional_methods
|
|
323
|
+
exposes required_methods as a Set (empty by default)
|
|
324
|
+
#assert_implemented_by!
|
|
325
|
+
raises ProtocolError listing the missing methods
|
|
326
|
+
exposes the offending class, protocol, and missing methods on the error
|
|
327
|
+
is a no-op when the class conforms
|
|
328
|
+
#compliance_errors
|
|
329
|
+
returns an empty collection when the class implements every required method
|
|
330
|
+
lists the missing methods when the class is non-conformant
|
|
331
|
+
Kotoshu::Embeddings::Search
|
|
332
|
+
Kotoshu::Embeddings::Search::MinHeap
|
|
333
|
+
exposes size, empty?, and each
|
|
334
|
+
to_a returns a dup so mutations on the result don't affect the heap
|
|
335
|
+
keeps at most max_size items, sorted by similarity ascending
|
|
336
|
+
#to_s / #inspect
|
|
337
|
+
includes vocab size and load state
|
|
338
|
+
#clear_cache
|
|
339
|
+
empties the cache and resets embeddings_loaded
|
|
340
|
+
#find_nearest_batch
|
|
341
|
+
returns a per-word hash of neighbor arrays
|
|
342
|
+
#preload_embeddings!
|
|
343
|
+
loads every embedding into the cache and flips embeddings_loaded
|
|
344
|
+
#similarity
|
|
345
|
+
returns 1.0 for an identical vector
|
|
346
|
+
returns the cosine similarity between two known words
|
|
347
|
+
returns 0.0 for orthogonal vectors
|
|
348
|
+
returns nil when either word is unknown
|
|
349
|
+
#initialize
|
|
350
|
+
exposes vocabulary, model, similarity_engine, and embeddings_loaded flag
|
|
351
|
+
#find_nearest
|
|
352
|
+
includes the vocabulary index in each result
|
|
353
|
+
returns at most k neighbors
|
|
354
|
+
returns neighbors sorted by similarity descending
|
|
355
|
+
returns [] when the query word is not in the vocabulary
|
|
356
|
+
excludes the query word by default
|
|
357
|
+
returns the most-similar word first
|
|
358
|
+
includes the query word when exclude_self is false
|
|
359
|
+
filters out neighbors below min_similarity
|
|
360
|
+
Kotoshu::Embeddings::VocabularyProtocol
|
|
361
|
+
requires the lookup and traversal methods
|
|
362
|
+
Kotoshu::Embeddings::SimilarityEngineProtocol
|
|
363
|
+
requires the four similarity metrics plus the normalization pair
|
|
364
|
+
Kotoshu::Embeddings::ProtocolError
|
|
365
|
+
carries klass, protocol, and missing_methods as read-only attributes
|
|
366
|
+
is a StandardError subclass
|
|
367
|
+
Kotoshu::Embeddings::EmbeddingPipeline
|
|
368
|
+
#preload_embeddings! / #unload!
|
|
369
|
+
loads the model and preloads search embeddings
|
|
370
|
+
unload! reverses both
|
|
371
|
+
#similarity
|
|
372
|
+
delegates to the underlying search
|
|
373
|
+
#model_info
|
|
374
|
+
delegates to the model
|
|
375
|
+
#get_embedding_by_index
|
|
376
|
+
returns the model's vector for a known index
|
|
377
|
+
#include?
|
|
378
|
+
checks the vocabulary
|
|
379
|
+
#get_embedding
|
|
380
|
+
returns nil for an unknown word
|
|
381
|
+
returns the model's vector for a known word
|
|
382
|
+
#find_nearest
|
|
383
|
+
delegates to the underlying search
|
|
384
|
+
#stats
|
|
385
|
+
reports the documented keys
|
|
386
|
+
#initialize
|
|
387
|
+
constructs a SimilarityEngine and Search from vocabulary + model
|
|
388
|
+
does not preload unless asked
|
|
389
|
+
preloads when preload: true is passed
|
|
390
|
+
#to_s / #inspect
|
|
391
|
+
includes the language, vocab size, dimension, and load state
|
|
392
|
+
Kotoshu::Embeddings::Registry
|
|
393
|
+
.register_model / .register_engine / .register_vocabulary
|
|
394
|
+
overwrites a previous registration with the new class
|
|
395
|
+
stores the class under the given name and returns it
|
|
396
|
+
supports engines and vocabularies
|
|
397
|
+
boot-time registration
|
|
398
|
+
registers :json => Vocabulary
|
|
399
|
+
lists the built-in names
|
|
400
|
+
registers :onnx => OnnxRuntimeModel
|
|
401
|
+
registers :cosine => SimilarityEngine
|
|
402
|
+
.reset!
|
|
403
|
+
makes *_names return empty arrays
|
|
404
|
+
clears every registry
|
|
405
|
+
.create_model / .create_engine / .create_vocabulary
|
|
406
|
+
raises ArgumentError for an unknown engine name
|
|
407
|
+
raises ArgumentError for an unknown model name
|
|
408
|
+
instantiates the registered class with the given kwargs
|
|
409
|
+
raises ArgumentError for an unknown vocabulary name
|
|
410
|
+
|
|
411
|
+
Kotoshu::Components::PassthroughSpellChecker
|
|
412
|
+
#passthrough?
|
|
413
|
+
returns true
|
|
414
|
+
#reason
|
|
415
|
+
returns the reason
|
|
416
|
+
has a default reason
|
|
417
|
+
#correct?
|
|
418
|
+
always returns true
|
|
419
|
+
#suggest
|
|
420
|
+
always returns empty array
|
|
421
|
+
behaves like a spell checker
|
|
422
|
+
checks words
|
|
423
|
+
suggests corrections
|
|
424
|
+
returns boolean from correct?
|
|
425
|
+
returns found flag as boolean
|
|
426
|
+
has a correct? convenience method
|
|
427
|
+
#check
|
|
428
|
+
handles nil
|
|
429
|
+
handles empty string
|
|
430
|
+
always returns found: true
|
|
431
|
+
|
|
432
|
+
Kotoshu::Cli::LanguageResolver
|
|
433
|
+
explicit language code
|
|
434
|
+
does not call the detector
|
|
435
|
+
uses the flag value without detection
|
|
436
|
+
'auto' with successful detection
|
|
437
|
+
falls back when detection returns nil
|
|
438
|
+
falls back when detected language is not set up
|
|
439
|
+
uses the detected language when it is set up
|
|
440
|
+
'default' keyword
|
|
441
|
+
uses the configured default language
|
|
442
|
+
detector failures
|
|
443
|
+
swallows exceptions from the detector and falls back
|
|
444
|
+
normalization
|
|
445
|
+
strips region suffixes before checking setup
|
|
446
|
+
|
|
447
|
+
Kotoshu::Cache::LanguageCache
|
|
448
|
+
#clean
|
|
449
|
+
removes expired entries
|
|
450
|
+
#get_grammar
|
|
451
|
+
when resources are cached and valid
|
|
452
|
+
returns cached grammar rules
|
|
453
|
+
#initialize
|
|
454
|
+
creates cache directory if it doesn't exist
|
|
455
|
+
creates a cache with default values
|
|
456
|
+
creates a cache with custom values
|
|
457
|
+
#language_path
|
|
458
|
+
returns the correct path for grammar resources
|
|
459
|
+
is consistent with resource_dir_for
|
|
460
|
+
returns the correct path for spelling resources
|
|
461
|
+
resource presence interface
|
|
462
|
+
#cached_resources
|
|
463
|
+
returns resource IDs for each cached language directory
|
|
464
|
+
returns empty list for an empty cache
|
|
465
|
+
#clear
|
|
466
|
+
returns false when the resource is absent
|
|
467
|
+
removes a specific cached resource
|
|
468
|
+
#clear_all
|
|
469
|
+
removes every cached resource
|
|
470
|
+
resets statistics
|
|
471
|
+
#available?
|
|
472
|
+
returns true when metadata + dictionary files exist
|
|
473
|
+
returns false for unsupported language
|
|
474
|
+
returns false for non-cached resources
|
|
475
|
+
#reset_stats
|
|
476
|
+
resets hit and miss counters
|
|
477
|
+
#get_spelling
|
|
478
|
+
when resources are cached and valid
|
|
479
|
+
returns cached spelling dictionary
|
|
480
|
+
#stats
|
|
481
|
+
returns the documented statistics shape
|
|
482
|
+
includes cached resources in stats
|
|
483
|
+
|
|
484
|
+
Configuration wiring for max_cache_size #evict
|
|
485
|
+
the SCHEMA entry exists with the env var and Integer type
|
|
486
|
+
the Configuration instance exposes max_cache_size as a public reader
|
|
487
|
+
|
|
488
|
+
Kotoshu::Defaults
|
|
489
|
+
.configure
|
|
490
|
+
configures Kotoshu with sensible defaults
|
|
491
|
+
.bundled_dictionary_path
|
|
492
|
+
returns path to bundled dictionary
|
|
493
|
+
.default_dictionary
|
|
494
|
+
provides a working dictionary
|
|
495
|
+
.detect_system_dictionary
|
|
496
|
+
returns nil if no system dictionary found
|
|
497
|
+
returns path if system dictionary exists
|
|
498
|
+
|
|
499
|
+
Unit: Hunspell Stemmer
|
|
500
|
+
Stemmer tests
|
|
501
|
+
tests full stemmer call (PENDING: Stemmer class not yet ported to Kotoshu)
|
|
502
|
+
tests desuffix (PENDING: Stemmer class not yet ported to Kotoshu)
|
|
503
|
+
tests deprefix (PENDING: Stemmer class not yet ported to Kotoshu)
|
|
504
|
+
|
|
505
|
+
Kotoshu::Configuration::Builder
|
|
506
|
+
backward compatibility
|
|
507
|
+
supports boolean flags
|
|
508
|
+
works with existing Configuration.new API
|
|
509
|
+
supports dictionary_path assignment
|
|
510
|
+
supports custom_words
|
|
511
|
+
builder methods
|
|
512
|
+
provides fluent setter methods
|
|
513
|
+
.build
|
|
514
|
+
creates configuration using block syntax
|
|
515
|
+
creates a configuration with defaults
|
|
516
|
+
creates immutable configuration
|
|
517
|
+
is thread-safe for concurrent use
|
|
518
|
+
|
|
519
|
+
Kotoshu::Spellchecker#check with ignore directives
|
|
520
|
+
marks suppressed entries with suppressed and suppressed_by
|
|
521
|
+
does not count suppressed words as failures but keeps the word count
|
|
522
|
+
recognizes markdown HTML-comment directives via the auto profile
|
|
523
|
+
moves errors on a disable-line into suppressed_errors
|
|
524
|
+
recognizes asciidoc // directives via the auto profile
|
|
525
|
+
suppresses a disable-file block across lines
|
|
526
|
+
keeps reporting misspellings without directives
|
|
527
|
+
suppresses only the listed words of disable-next-line
|
|
528
|
+
suppresses the whole next line without a word list
|
|
529
|
+
|
|
530
|
+
RTL language modules
|
|
531
|
+
Kotoshu::Languages::Arabic
|
|
532
|
+
registration
|
|
533
|
+
registers ar and ar-SA
|
|
534
|
+
instance
|
|
535
|
+
is RTL
|
|
536
|
+
uses Custom dictionary class (no bundled Hunspell dicts yet)
|
|
537
|
+
uses a Tokenizer that handles Arabic text
|
|
538
|
+
reports script_type :arabic
|
|
539
|
+
uses the Arabic normalizer
|
|
540
|
+
Kotoshu::Languages::Arabic::Tokenizer
|
|
541
|
+
returns [] for empty string
|
|
542
|
+
returns [] for nil
|
|
543
|
+
splits on Arabic punctuation (، ؛ ؟)
|
|
544
|
+
filters pure numbers
|
|
545
|
+
tokenizes Arabic text by splitting on whitespace
|
|
546
|
+
normalization integration
|
|
547
|
+
normalizer strips tashkeel from input
|
|
548
|
+
Kotoshu::Languages::Hebrew
|
|
549
|
+
normalization integration
|
|
550
|
+
normalizer strips niqqud from input
|
|
551
|
+
Kotoshu::Languages::Hebrew::Tokenizer
|
|
552
|
+
tokenizes Hebrew text by splitting on whitespace
|
|
553
|
+
returns [] for nil
|
|
554
|
+
returns [] for empty string
|
|
555
|
+
filters pure numbers
|
|
556
|
+
instance
|
|
557
|
+
is RTL
|
|
558
|
+
uses a Tokenizer that handles Hebrew text
|
|
559
|
+
uses Custom dictionary class
|
|
560
|
+
uses the Hebrew normalizer
|
|
561
|
+
reports script_type :hebrew
|
|
562
|
+
registration
|
|
563
|
+
registers he and he-IL
|
|
564
|
+
|
|
565
|
+
Kotoshu::Algorithms::Capitalization
|
|
566
|
+
Kotoshu::Algorithms::Capitalization::Casing
|
|
567
|
+
#upper
|
|
568
|
+
upcases the word
|
|
569
|
+
#coerce
|
|
570
|
+
uppercases an ALL-cased suggestion
|
|
571
|
+
leaves a NO-cased suggestion unchanged
|
|
572
|
+
title-cases an INIT/HUHINIT-cased suggestion (capitalizes first letter)
|
|
573
|
+
#guess
|
|
574
|
+
returns ALL for all-uppercase
|
|
575
|
+
returns NO for all-lowercase
|
|
576
|
+
returns INIT for first-letter-capitalized only
|
|
577
|
+
returns HUH for mixed case with lowercase first letter
|
|
578
|
+
returns HUHINIT for mixed case with capitalized first letter
|
|
579
|
+
#variants (correctly-spelled hypotheses)
|
|
580
|
+
returns [NO, [word]] for an all-lowercase word
|
|
581
|
+
returns [INIT, [word, *lower]] for a titlecase word
|
|
582
|
+
returns [HUHINIT, [word, *lowerfirst]] for a mixed-case word with capitalized first
|
|
583
|
+
returns [ALL, [word, *lower, *capitalize]] for an all-caps word
|
|
584
|
+
returns [HUH, [word]] for a mixed-case word with lowercase first
|
|
585
|
+
#lowerfirst
|
|
586
|
+
yields the word with first letter lowercased and rest preserved
|
|
587
|
+
returns an Enumerator when no block is given
|
|
588
|
+
#corrections (misspelling hypotheses)
|
|
589
|
+
returns [HUH, [word, *lower]] for a mixed-case word with lowercase first
|
|
590
|
+
returns [ALL, [word, *lower, *capitalize]] for an all-caps word
|
|
591
|
+
returns [NO, [word]] for an all-lowercase word
|
|
592
|
+
returns [INIT, [word, *lower]] for a titlecase word
|
|
593
|
+
returns [HUHINIT, [word, *lowerfirst, *lower, *capitalize]] for a mixed-case word with capitalized first
|
|
594
|
+
#lower
|
|
595
|
+
returns the downcased word as a single-element array
|
|
596
|
+
returns empty array for empty string
|
|
597
|
+
returns empty array for nil
|
|
598
|
+
returns empty array when first char is İ (cannot be lowered in non-Turkic)
|
|
599
|
+
normalizes the Turkic 'i̇' (i with combining dot) to plain 'i'
|
|
600
|
+
#capitalize
|
|
601
|
+
yields the word with first letter upper and the rest lower (titlecase)
|
|
602
|
+
returns an Enumerator when no block is given
|
|
603
|
+
handles a single-character word
|
|
604
|
+
Kotoshu::Algorithms::Capitalization::TurkicCasing
|
|
605
|
+
is a subclass of Casing
|
|
606
|
+
#upper
|
|
607
|
+
translates lowercase ı → I (dotless capital)
|
|
608
|
+
translates lowercase i → İ (dotted capital)
|
|
609
|
+
#lower
|
|
610
|
+
translates uppercase İ → i (dotted i)
|
|
611
|
+
translates uppercase I → ı (dotless i)
|
|
612
|
+
translates both I and İ in the same word
|
|
613
|
+
Type constants
|
|
614
|
+
exposes the five captype symbols
|
|
615
|
+
Kotoshu::Algorithms::Capitalization::GermanCasing
|
|
616
|
+
is a subclass of Casing
|
|
617
|
+
#lower
|
|
618
|
+
returns both ß and ss variants for an SS-containing uppercase word
|
|
619
|
+
returns [lowered] when there is no SS in the source
|
|
620
|
+
#guess
|
|
621
|
+
classifies a word containing ß + uppercase letters as ALL caps
|
|
622
|
+
falls back to the parent guess when ß is not present
|
|
623
|
+
#sharp_s_variants
|
|
624
|
+
replaces a single 'ss' with ß
|
|
625
|
+
returns empty when there is no 'ss' in the text
|
|
626
|
+
produces multiple variants when 'ss' appears more than once
|
|
627
|
+
|
|
628
|
+
Kotoshu::Suggestions::FrequencyProvider
|
|
629
|
+
EMPTY_TIERS
|
|
630
|
+
is frozen
|
|
631
|
+
has empty sets for all three tiers
|
|
632
|
+
#tiers_for
|
|
633
|
+
returns EMPTY_TIERS for an unknown language
|
|
634
|
+
returns a hash with :top_50, :top_200, :top_1000 keys
|
|
635
|
+
returns Set instances for each tier
|
|
636
|
+
caches per-language independently (different languages → different tiers)
|
|
637
|
+
memoizes per-language — second call returns the same object
|
|
638
|
+
|
|
639
|
+
Kotoshu::Language::Detector
|
|
640
|
+
.detect_with_confidence
|
|
641
|
+
returns language and confidence
|
|
642
|
+
returns higher confidence for clear language signals
|
|
643
|
+
returns zero confidence for nil
|
|
644
|
+
.detect
|
|
645
|
+
with German text
|
|
646
|
+
detects German
|
|
647
|
+
with mixed text
|
|
648
|
+
detects dominant language
|
|
649
|
+
with English text
|
|
650
|
+
detects English with mixed case
|
|
651
|
+
detects English
|
|
652
|
+
with French text
|
|
653
|
+
detects French
|
|
654
|
+
with Russian text
|
|
655
|
+
detects Russian
|
|
656
|
+
with Portuguese text
|
|
657
|
+
detects Portuguese
|
|
658
|
+
with invalid input
|
|
659
|
+
returns nil for empty string
|
|
660
|
+
returns nil for whitespace only
|
|
661
|
+
returns nil for nil
|
|
662
|
+
returns nil for special characters only
|
|
663
|
+
with Spanish text
|
|
664
|
+
detects Spanish
|
|
665
|
+
with Arabic text
|
|
666
|
+
detects Arabic (PENDING: FastText LID missing Arabic vector — see TODO.impl/30-language-auto-detection.md)
|
|
667
|
+
.detect_candidates
|
|
668
|
+
returns empty array for nil
|
|
669
|
+
returns multiple candidates
|
|
670
|
+
respects limit parameter
|
|
671
|
+
orders by confidence
|
|
672
|
+
|
|
673
|
+
Kotoshu::IntegrityError
|
|
674
|
+
appends the remediation hint when provided
|
|
675
|
+
omits the remediation line when not provided (backward compat)
|
|
676
|
+
exposes url and remediation readers
|
|
677
|
+
|
|
678
|
+
Kotoshu::Suggestions::Strategies::NgramStrategy
|
|
679
|
+
#handles?
|
|
680
|
+
is false when the strategy is disabled
|
|
681
|
+
is false for a word in the dictionary
|
|
682
|
+
is true for a word not in the dictionary
|
|
683
|
+
#initialize
|
|
684
|
+
is enabled by default
|
|
685
|
+
defaults name to :ngram
|
|
686
|
+
honours an explicit name override
|
|
687
|
+
ranking
|
|
688
|
+
ranks higher-similarity (lower-distance) suggestions first
|
|
689
|
+
#generate
|
|
690
|
+
honours a custom n via config
|
|
691
|
+
returns an empty set when no dictionary word passes the thresholds
|
|
692
|
+
every distance is non-zero (zero-distance matches are filtered)
|
|
693
|
+
stamps original_length metadata on each suggestion
|
|
694
|
+
returns a SuggestionSet of Suggestion objects
|
|
695
|
+
tags every suggestion with source = 'ngram'
|
|
696
|
+
excludes the input word from the result set
|
|
697
|
+
returns an empty set when the input word is shorter than n
|
|
698
|
+
honours a stricter min_similarity threshold by returning fewer suggestions
|
|
699
|
+
derives distance from similarity: higher similarity = lower distance
|
|
700
|
+
with a real misspelled word (smoke)
|
|
701
|
+
finds plausible corrections for 'helo'
|
|
702
|
+
|
|
703
|
+
Kotoshu::Models::Word# Walking Skeleton - Word VALUE Object
|
|
704
|
+
.from_dic_line
|
|
705
|
+
parses word with flags
|
|
706
|
+
parses word with single flag
|
|
707
|
+
returns nil for empty line
|
|
708
|
+
returns nil for nil input
|
|
709
|
+
parses word without flags
|
|
710
|
+
hashing
|
|
711
|
+
can be used as hash key
|
|
712
|
+
different words have different hash codes
|
|
713
|
+
#text, #flags, #morphological_data
|
|
714
|
+
exposes attributes via readers
|
|
715
|
+
immutability
|
|
716
|
+
freezes flags array
|
|
717
|
+
cannot modify text after creation (frozen object)
|
|
718
|
+
freezes the word on creation
|
|
719
|
+
freezes morphological data hash
|
|
720
|
+
query methods
|
|
721
|
+
#has_flag?
|
|
722
|
+
returns false when word has no flags
|
|
723
|
+
returns true when word has the flag
|
|
724
|
+
returns false when word does not have the flag
|
|
725
|
+
#has_flags?
|
|
726
|
+
returns true when word has flags
|
|
727
|
+
returns false when word has no flags
|
|
728
|
+
#valid?
|
|
729
|
+
returns true for valid word
|
|
730
|
+
#empty?
|
|
731
|
+
returns false for non-empty word
|
|
732
|
+
#length
|
|
733
|
+
returns word length
|
|
734
|
+
creation
|
|
735
|
+
creates word with morphological data
|
|
736
|
+
creates word with text
|
|
737
|
+
creates word with flags
|
|
738
|
+
raises error when text is empty
|
|
739
|
+
raises error when text is nil
|
|
740
|
+
value equality
|
|
741
|
+
words with different text are not equal
|
|
742
|
+
words are not equal to non-words
|
|
743
|
+
two words with same text are equal
|
|
744
|
+
two words with same text but different flags are equal
|
|
745
|
+
#to_s
|
|
746
|
+
returns word text
|
|
747
|
+
#<=>
|
|
748
|
+
returns 0 for equal words
|
|
749
|
+
compares words alphabetically
|
|
750
|
+
|
|
751
|
+
Kotoshu::Cli::IgnoreMatcher
|
|
752
|
+
* and ? globs
|
|
753
|
+
matches exactly one character with ?
|
|
754
|
+
does not let a lone star cross directories
|
|
755
|
+
matches any characters except the path separator
|
|
756
|
+
comments, blanks and escapes
|
|
757
|
+
treats escaped ! and # as literals
|
|
758
|
+
skips blank lines and comments
|
|
759
|
+
anchoring
|
|
760
|
+
anchors patterns containing a slash to the ignore directory
|
|
761
|
+
anchors patterns with a leading slash only at the top
|
|
762
|
+
directory-only patterns
|
|
763
|
+
matches directories, not files, with a trailing slash
|
|
764
|
+
negation
|
|
765
|
+
negates directory patterns too
|
|
766
|
+
re-includes a file negated after a matching pattern
|
|
767
|
+
lets the last matching pattern win
|
|
768
|
+
** globstar
|
|
769
|
+
matches any depth between two anchors with a/**/b
|
|
770
|
+
matches a name at any depth with **/name
|
|
771
|
+
matches everything below a directory with dir/**
|
|
772
|
+
matches everything with a lone **
|
|
773
|
+
plain name patterns
|
|
774
|
+
matches the basename at any depth
|
|
775
|
+
does not match different names or substrings
|
|
776
|
+
.load_directory
|
|
777
|
+
detects presence without loading
|
|
778
|
+
returns an empty matcher when neither file exists
|
|
779
|
+
loads .gitignore and .ignore together, .ignore last
|
|
780
|
+
|
|
781
|
+
Kotoshu::Dictionary::PlainText# Walking Skeleton - PlainText Dictionary
|
|
782
|
+
#size
|
|
783
|
+
returns word count
|
|
784
|
+
creation and loading
|
|
785
|
+
loads dictionary from file path
|
|
786
|
+
#words
|
|
787
|
+
returns empty array for empty dictionary
|
|
788
|
+
returns all words as strings
|
|
789
|
+
#lookup
|
|
790
|
+
when word does not exist in dictionary
|
|
791
|
+
returns false
|
|
792
|
+
when word exists in dictionary
|
|
793
|
+
returns true for case-insensitive match when configured
|
|
794
|
+
returns false for case-sensitive mismatch
|
|
795
|
+
returns true for exact match
|
|
796
|
+
when dictionary is empty
|
|
797
|
+
returns false for all words
|
|
798
|
+
#empty?
|
|
799
|
+
returns true for empty dictionary
|
|
800
|
+
returns false for non-empty dictionary
|
|
801
|
+
|
|
802
|
+
Kotoshu::Models::AffixRule
|
|
803
|
+
.from_hunspell
|
|
804
|
+
parses a prefix rule line
|
|
805
|
+
parses a suffix rule line
|
|
806
|
+
returns nil when the line is too short
|
|
807
|
+
treats '0' strip as empty
|
|
808
|
+
defaults the condition to '.' when missing
|
|
809
|
+
#apply
|
|
810
|
+
with a suffix rule
|
|
811
|
+
returns nil when the strip mismatch fails
|
|
812
|
+
returns nil when the rule's condition does not match
|
|
813
|
+
strips the suffix and adds the new one
|
|
814
|
+
with a prefix rule
|
|
815
|
+
strips then adds when strip is non-empty
|
|
816
|
+
prepends the prefix
|
|
817
|
+
returns nil when the rule does not apply (strip mismatch)
|
|
818
|
+
#to_hunspell
|
|
819
|
+
formats a suffix rule as an SFX line
|
|
820
|
+
formats a prefix rule as a PFX line
|
|
821
|
+
uses 0 for empty strip
|
|
822
|
+
#<=>
|
|
823
|
+
orders rules by flag
|
|
824
|
+
returns nil when compared to a non-AffixRule
|
|
825
|
+
TYPES constant
|
|
826
|
+
is frozen
|
|
827
|
+
maps :prefix to PFX and :suffix to SFX
|
|
828
|
+
#== / #eql?
|
|
829
|
+
differs when any attribute differs
|
|
830
|
+
returns false for a non-AffixRule
|
|
831
|
+
equals a rule with identical attributes
|
|
832
|
+
#applies_to?
|
|
833
|
+
returns true when the word matches the condition
|
|
834
|
+
returns false for an empty string
|
|
835
|
+
returns false for nil
|
|
836
|
+
returns false when the word does not match
|
|
837
|
+
#initialize
|
|
838
|
+
accepts a valid prefix rule
|
|
839
|
+
accepts a valid suffix rule
|
|
840
|
+
raises ArgumentError for an invalid type
|
|
841
|
+
defaults cross_product to false
|
|
842
|
+
raises ArgumentError when flag is nil
|
|
843
|
+
raises ArgumentError when flag is empty
|
|
844
|
+
freezes the rule on initialization
|
|
845
|
+
defaults condition to '.' (match-any)
|
|
846
|
+
freezes the string attributes
|
|
847
|
+
preserves an explicit Regexp condition as-is
|
|
848
|
+
#hash
|
|
849
|
+
is consistent for equal rules
|
|
850
|
+
#prefix? / #suffix?
|
|
851
|
+
prefix? is true for a prefix rule
|
|
852
|
+
suffix? is true for a suffix rule
|
|
853
|
+
#remove
|
|
854
|
+
with a suffix rule
|
|
855
|
+
removes the suffix and restores the strip
|
|
856
|
+
with a prefix rule
|
|
857
|
+
returns nil when the word does not start with the added prefix
|
|
858
|
+
removes the prefix and restores the strip
|
|
859
|
+
|
|
860
|
+
Kotoshu::Language::Suika
|
|
861
|
+
KOTOSHU_NO_SUIKA=1 opt-out
|
|
862
|
+
forces LOADED to false and raises SuikaUnavailable
|
|
863
|
+
.tagger
|
|
864
|
+
returns a memoized Suika::Tagger instance
|
|
865
|
+
::LOADED
|
|
866
|
+
is a boolean
|
|
867
|
+
is true when suika is installed in the test environment
|
|
868
|
+
|
|
869
|
+
Kotoshu::Cli::CacheCommand
|
|
870
|
+
#evict
|
|
871
|
+
with --dry-run flag
|
|
872
|
+
[WARNING] Attempted to create command "create_cache" without usage or description. Call desc if you want this method to be available as command or declare it inside a no_commands{} block. Invoked from "/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/cli/cache_command_spec.rb:319:in 'Module#define_method'".
|
|
873
|
+
reports nothing-to-evict when under the cap
|
|
874
|
+
[WARNING] Attempted to create command "create_cache" without usage or description. Call desc if you want this method to be available as command or declare it inside a no_commands{} block. Invoked from "/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/cli/cache_command_spec.rb:319:in 'Module#define_method'".
|
|
875
|
+
lists the entries that would be evicted without removing them
|
|
876
|
+
without --dry-run flag
|
|
877
|
+
[WARNING] Attempted to create command "create_cache" without usage or description. Call desc if you want this method to be available as command or declare it inside a no_commands{} block. Invoked from "/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/cli/cache_command_spec.rb:319:in 'Module#define_method'".
|
|
878
|
+
reports nothing-to-evict when under the cap
|
|
879
|
+
[WARNING] Attempted to create command "create_cache" without usage or description. Call desc if you want this method to be available as command or declare it inside a no_commands{} block. Invoked from "/Users/mulgogi/src/kotoshu/kotoshu/.claude/worktrees/correct3/spec/kotoshu/cli/cache_command_spec.rb:319:in 'Module#define_method'".
|
|
880
|
+
removes the oldest entry and reports the reclaimed bytes
|
|
881
|
+
#info
|
|
882
|
+
without --json flag
|
|
883
|
+
displays cache statistics in text format
|
|
884
|
+
with --json flag
|
|
885
|
+
displays cache statistics in JSON format
|
|
886
|
+
#list
|
|
887
|
+
without --json flag
|
|
888
|
+
shows message when no languages are cached
|
|
889
|
+
lists cached languages in text format
|
|
890
|
+
with --json flag
|
|
891
|
+
lists cached languages in JSON format
|
|
892
|
+
#clean
|
|
893
|
+
without --dry-run flag
|
|
894
|
+
removes expired entries and displays results
|
|
895
|
+
with --dry-run flag
|
|
896
|
+
shows what would be removed without removing
|
|
897
|
+
#format_bytes
|
|
898
|
+
formats bytes in human-readable format
|
|
899
|
+
#time_ago
|
|
900
|
+
returns human-readable time ago string
|
|
901
|
+
#purge
|
|
902
|
+
with --confirm flag
|
|
903
|
+
purges without prompting
|
|
904
|
+
without --confirm flag
|
|
905
|
+
aborts purge when user declines
|
|
906
|
+
#create_cache
|
|
907
|
+
builds cache from options
|
|
908
|
+
#validate
|
|
909
|
+
shows checkmarks for valid resources
|
|
910
|
+
shows X for missing resources
|
|
911
|
+
validates cached resources and shows status
|
|
912
|
+
|
|
913
|
+
Kotoshu::Suggestions::SuggestionSet
|
|
914
|
+
#within_distance
|
|
915
|
+
returns an empty set when nothing matches
|
|
916
|
+
filters by inclusive distance range
|
|
917
|
+
returns a new SuggestionSet
|
|
918
|
+
#to_a consistency with #suggestions
|
|
919
|
+
yields Suggestion objects to Enumerable methods
|
|
920
|
+
returns the same count as #suggestions
|
|
921
|
+
returns Array<Suggestion>, the same shape as #suggestions
|
|
922
|
+
#add
|
|
923
|
+
re-sorts after adding (best first)
|
|
924
|
+
respects max_size after add
|
|
925
|
+
appends a suggestion and returns self for chaining
|
|
926
|
+
is aliased as <<
|
|
927
|
+
#first / #last
|
|
928
|
+
#last returns the worst suggestion
|
|
929
|
+
returns nil for #last on an empty set
|
|
930
|
+
returns nil for #first on an empty set
|
|
931
|
+
#first returns the best suggestion (highest combined score)
|
|
932
|
+
#top
|
|
933
|
+
returns fewer than N when the set is smaller
|
|
934
|
+
returns the first N suggestions as Array<Suggestion>
|
|
935
|
+
#low_confidence
|
|
936
|
+
returns suggestions with confidence < 0.5
|
|
937
|
+
returns a new SuggestionSet
|
|
938
|
+
#high_confidence
|
|
939
|
+
returns a new SuggestionSet
|
|
940
|
+
returns suggestions with confidence >= 0.8
|
|
941
|
+
#find_word
|
|
942
|
+
returns the matching Suggestion (case-insensitive)
|
|
943
|
+
returns nil when not found
|
|
944
|
+
#initialize
|
|
945
|
+
dedupes case-insensitively on construction
|
|
946
|
+
enforces max_size on construction
|
|
947
|
+
sorts by combined score on construction (best first)
|
|
948
|
+
defaults max_size to 10
|
|
949
|
+
#unique
|
|
950
|
+
returns a new SuggestionSet with case-insensitive unique words
|
|
951
|
+
does not mutate the receiver
|
|
952
|
+
.from_words
|
|
953
|
+
honors max_size
|
|
954
|
+
defaults source to :unknown
|
|
955
|
+
builds a SuggestionSet from a word list with the given source
|
|
956
|
+
#to_words
|
|
957
|
+
returns Array<String>
|
|
958
|
+
is aliased as #words
|
|
959
|
+
#from_source
|
|
960
|
+
returns an empty set when no suggestions match
|
|
961
|
+
returns a new SuggestionSet filtered by source
|
|
962
|
+
does not mutate the receiver
|
|
963
|
+
accepts string sources (normalizes Symbol/String)
|
|
964
|
+
#merge!
|
|
965
|
+
absorbs another set's suggestions
|
|
966
|
+
returns self
|
|
967
|
+
#empty? / #size
|
|
968
|
+
reports empty? true on a fresh .empty set
|
|
969
|
+
#size, #count, #length all agree
|
|
970
|
+
reports empty? false after add
|
|
971
|
+
.empty
|
|
972
|
+
honors a custom max_size
|
|
973
|
+
returns an empty SuggestionSet
|
|
974
|
+
#include? / #has_word?
|
|
975
|
+
returns true when the word is present (case-insensitive)
|
|
976
|
+
is aliased as has_word?
|
|
977
|
+
returns false when the word is absent
|
|
978
|
+
#concat
|
|
979
|
+
respects max_size after concat
|
|
980
|
+
appends multiple suggestions and returns self
|
|
981
|
+
explicit deduplication (TODO 56 T5.1)
|
|
982
|
+
reports zero duplicates when all words are unique
|
|
983
|
+
tracks the number of duplicates removed
|
|
984
|
+
deduplicates after merge!
|
|
985
|
+
deduplicates case-insensitively
|
|
986
|
+
#each
|
|
987
|
+
yields Suggestion objects when a block is given
|
|
988
|
+
returns an Enumerator when no block is given
|
|
989
|
+
#as_json
|
|
990
|
+
delegates to #to_hashes (serialization shape)
|
|
991
|
+
#to_hashes
|
|
992
|
+
returns Array<Hash>
|
|
993
|
+
includes word, distance, confidence, source keys
|
|
994
|
+
|
|
995
|
+
Kotoshu::Core::Trie::Node
|
|
996
|
+
#add_child
|
|
997
|
+
creates a new child node
|
|
998
|
+
is idempotent — returns the existing child if added twice
|
|
999
|
+
#child / #has_child?
|
|
1000
|
+
returns the child node for an existing character
|
|
1001
|
+
reports has_child? accurately
|
|
1002
|
+
returns nil for a missing character
|
|
1003
|
+
#all_children / #has_children? / #child_count
|
|
1004
|
+
returns the children hash
|
|
1005
|
+
updates child_count as children are added
|
|
1006
|
+
flips has_children? once a child exists
|
|
1007
|
+
#mark_terminal / #terminal?
|
|
1008
|
+
overwrites a previously nil payload when no payload is given
|
|
1009
|
+
stores a payload when one is given
|
|
1010
|
+
marks the node as terminal
|
|
1011
|
+
#to_s / #inspect
|
|
1012
|
+
includes the character and terminal flag
|
|
1013
|
+
aliases inspect to to_s
|
|
1014
|
+
#initialize
|
|
1015
|
+
defaults the character to empty string
|
|
1016
|
+
starts with a nil payload
|
|
1017
|
+
starts with an empty children hash
|
|
1018
|
+
starts not terminal
|
|
1019
|
+
accepts an explicit character
|
|
1020
|
+
|
|
1021
|
+
Kotoshu::Components::PosTagger
|
|
1022
|
+
#tag_word
|
|
1023
|
+
raises NotImplementedError when called directly
|
|
1024
|
+
#tag
|
|
1025
|
+
raises NotImplementedError when called directly
|
|
1026
|
+
|
|
1027
|
+
Kotoshu::Language
|
|
1028
|
+
.detect
|
|
1029
|
+
detects Arabic (PENDING: FastText LID missing Arabic vector — see TODO.impl/30-language-auto-detection.md)
|
|
1030
|
+
detects German
|
|
1031
|
+
detects French
|
|
1032
|
+
returns nil for unknown
|
|
1033
|
+
detects English
|
|
1034
|
+
.info
|
|
1035
|
+
returns nil for unregistered language
|
|
1036
|
+
with registered language
|
|
1037
|
+
returns language info
|
|
1038
|
+
.supported_codes
|
|
1039
|
+
returns empty array when no languages registered
|
|
1040
|
+
with registered languages
|
|
1041
|
+
returns sorted list of codes
|
|
1042
|
+
.registered?
|
|
1043
|
+
returns false for unregistered language
|
|
1044
|
+
with registered language
|
|
1045
|
+
returns true for registered language
|
|
1046
|
+
.detect_with_confidence
|
|
1047
|
+
returns language and confidence
|
|
1048
|
+
.get
|
|
1049
|
+
returns nil for unregistered language
|
|
1050
|
+
with registered language
|
|
1051
|
+
returns registered class
|
|
1052
|
+
.register
|
|
1053
|
+
registers a language class
|
|
1054
|
+
|
|
1055
|
+
Result model serialization consistency
|
|
1056
|
+
Kotoshu::Suggestions::Suggestion
|
|
1057
|
+
round-trips through to_hash / from_hash
|
|
1058
|
+
Kotoshu::Models::Result::WordResult
|
|
1059
|
+
round-trips through to_hash / from_hash
|
|
1060
|
+
round-trips an empty-suggestions result
|
|
1061
|
+
Kotoshu::Suggestions::SuggestionSet
|
|
1062
|
+
to_hashes / from_hashes round-trip via the underlying Suggestion
|
|
1063
|
+
as_json delegates to to_hashes (no JSON-specific hand-rolled path)
|
|
1064
|
+
is symmetric — empty set to_hashes is []
|
|
1065
|
+
Kotoshu::Models::Result::DocumentResult
|
|
1066
|
+
round-trips a result with no errors
|
|
1067
|
+
round-trips through to_hash / from_hash
|
|
1068
|
+
Cross-model invariants
|
|
1069
|
+
DocumentResult.errors contains WordResult instances after round-trip
|
|
1070
|
+
WordResult's suggestion collection uses the same Suggestion serialization
|
|
1071
|
+
|
|
1072
|
+
Kotoshu::Cli::AutoSetup
|
|
1073
|
+
#call with TTY and user declines
|
|
1074
|
+
returns nil without calling Kotoshu.setup
|
|
1075
|
+
#call in non-TTY context
|
|
1076
|
+
returns nil without prompting
|
|
1077
|
+
#call in offline mode
|
|
1078
|
+
returns nil without prompting
|
|
1079
|
+
#call with TTY and user accepts
|
|
1080
|
+
treats empty input (just enter) as yes
|
|
1081
|
+
calls Kotoshu.setup and returns the language
|
|
1082
|
+
|
|
1083
|
+
Kotoshu::DataStructures::BloomFilter
|
|
1084
|
+
#initialize
|
|
1085
|
+
creates filter with default parameters
|
|
1086
|
+
creates filter with custom expected size
|
|
1087
|
+
creates filter with custom false positive rate
|
|
1088
|
+
#include?
|
|
1089
|
+
returns true for added words
|
|
1090
|
+
returns false for words never added (mostly)
|
|
1091
|
+
never has false negatives
|
|
1092
|
+
#add
|
|
1093
|
+
handles case sensitivity
|
|
1094
|
+
is case-insensitive by default
|
|
1095
|
+
adds multiple words
|
|
1096
|
+
adds a word to the filter
|
|
1097
|
+
#stats
|
|
1098
|
+
tracks item count
|
|
1099
|
+
returns filter statistics
|
|
1100
|
+
#merge
|
|
1101
|
+
merges two filters
|
|
1102
|
+
#clear
|
|
1103
|
+
removes all entries
|
|
1104
|
+
|
|
1105
|
+
Kotoshu::Languages::Turkish
|
|
1106
|
+
tokenization
|
|
1107
|
+
splits a real Turkish sentence
|
|
1108
|
+
keeps dotless-i words as single tokens
|
|
1109
|
+
dotless-i case folding
|
|
1110
|
+
does not fold like the Unicode default (regression guard)
|
|
1111
|
+
honors the downcase option
|
|
1112
|
+
folds I to ı and İ to i
|
|
1113
|
+
keeps already-lowercase Turkish words unchanged
|
|
1114
|
+
registry
|
|
1115
|
+
registers tr and tr-TR
|
|
1116
|
+
|
|
1117
|
+
Kotoshu::Suggestions::Pipeline
|
|
1118
|
+
#initialize
|
|
1119
|
+
creates empty pipeline
|
|
1120
|
+
creates pipeline with block
|
|
1121
|
+
#execute
|
|
1122
|
+
can early terminate on empty result
|
|
1123
|
+
executes stages in sequence
|
|
1124
|
+
#remove
|
|
1125
|
+
returns self for chaining
|
|
1126
|
+
removes a stage
|
|
1127
|
+
context sharing
|
|
1128
|
+
shares context between stages
|
|
1129
|
+
#add
|
|
1130
|
+
returns self for chaining
|
|
1131
|
+
adds a stage
|
|
1132
|
+
adds multiple stages
|
|
1133
|
+
|
|
1134
|
+
Kotoshu::Keyboard::Layouts::JCUKEN
|
|
1135
|
+
#distance
|
|
1136
|
+
JCUKEN-specific characteristics
|
|
1137
|
+
measures distance correctly for Cyrillic
|
|
1138
|
+
#position
|
|
1139
|
+
has hard and soft signs
|
|
1140
|
+
has correct position for ё (yo) in number row
|
|
1141
|
+
has correct position for Cyrillic letters
|
|
1142
|
+
Cyrillic character support
|
|
1143
|
+
has ё separate from е
|
|
1144
|
+
includes all Russian letters
|
|
1145
|
+
Russian language support
|
|
1146
|
+
is the default layout for Russian
|
|
1147
|
+
does not support Latin languages
|
|
1148
|
+
#initialize
|
|
1149
|
+
supports Russian and variants
|
|
1150
|
+
supports Bulgarian (bg)
|
|
1151
|
+
creates JCUKEN layout
|
|
1152
|
+
supports Belarusian (be)
|
|
1153
|
+
supports Ukrainian (uk)
|
|
1154
|
+
|
|
1155
|
+
Kotoshu::Readers::LookupBuilder
|
|
1156
|
+
#build — ph: morph data folds into REP and alt_spellings
|
|
1157
|
+
extracts star ph: payloads as REP with trimmed pattern and stem
|
|
1158
|
+
ignores morph-data tokens that are not ph: payloads
|
|
1159
|
+
star ph: payloads are NOT exposed as alt_spellings
|
|
1160
|
+
extracts arrow ph: payloads as an explicit (from, to) REP pair
|
|
1161
|
+
appends a simple ph: payload to aff[:REP] as (wich, which)
|
|
1162
|
+
extracts simple ph: payloads as alt_spellings on the word entry
|
|
1163
|
+
arrow ph: payloads are NOT exposed as alt_spellings
|
|
1164
|
+
#build — suggester defaults
|
|
1165
|
+
applies DEFAULT_MAX_DIFF when MAXDIFF is absent
|
|
1166
|
+
honors an explicit MAXNGRAMSUGS
|
|
1167
|
+
applies DEFAULT_MAX_CPD_SUGS when MAXCPDSUGS is absent
|
|
1168
|
+
applies DEFAULT_MAX_NGRAM_SUGS when MAXNGRAMSUGS is absent
|
|
1169
|
+
#build — suffix index
|
|
1170
|
+
indexes suffixes by the first char of the REVERSED add string
|
|
1171
|
+
groups suffix entries under their flag
|
|
1172
|
+
.new
|
|
1173
|
+
exposes aff_path, dic_path, encoding, script, aff_data, words readers
|
|
1174
|
+
honors the encoding and script keyword args
|
|
1175
|
+
#build — single-value flag pass-through
|
|
1176
|
+
forwards COMPOUNDMIN/COMPOUNDWORDMAX verbatim (nil when absent)
|
|
1177
|
+
forwards KEEPCASE/FORBIDDENWORD/NEEDAFFIX/etc. verbatim
|
|
1178
|
+
forwards compound-directive flags verbatim
|
|
1179
|
+
#build — prefix index
|
|
1180
|
+
indexes prefixes by the first char of the add string
|
|
1181
|
+
groups prefix entries under their flag
|
|
1182
|
+
#build — IGNORE chars are stripped at read time
|
|
1183
|
+
removes IGNORE chars from dictionary stems
|
|
1184
|
+
removes IGNORE chars from affix add strings
|
|
1185
|
+
#build — BREAK defaults
|
|
1186
|
+
synthesizes the Spylls default BREAK table when BREAK is nil
|
|
1187
|
+
treats explicit empty BREAK ([]) as DISABLED — no defaults synthesized
|
|
1188
|
+
honors an explicit non-empty BREAK directive
|
|
1189
|
+
#build — REP table adaptation
|
|
1190
|
+
returns an empty REP table when REP is absent
|
|
1191
|
+
adapts RepPattern instances to the {:regexp, :pattern, :replacement} shape
|
|
1192
|
+
PhRepExtractor module
|
|
1193
|
+
.build_rep
|
|
1194
|
+
dispatches to star_rep when token ends with *
|
|
1195
|
+
dispatches to arrow_rep when token contains ->
|
|
1196
|
+
dispatches to simple_rep otherwise
|
|
1197
|
+
.simple_alt_spellings
|
|
1198
|
+
returns empty for an empty ph_tokens array
|
|
1199
|
+
returns only the simple payloads (no star, no arrow)
|
|
1200
|
+
.append_to_aff
|
|
1201
|
+
appends to an existing REP array without overwriting
|
|
1202
|
+
appends each payload as a REP-shaped hash
|
|
1203
|
+
is a no-op when ph_tokens is empty
|
|
1204
|
+
is a no-op when ph_tokens is nil
|
|
1205
|
+
.simple_rep
|
|
1206
|
+
returns nil when the token is empty
|
|
1207
|
+
uses the token as the pattern and the stem as the replacement
|
|
1208
|
+
.star_rep
|
|
1209
|
+
returns nil when the stem is too short
|
|
1210
|
+
strips the last two chars of the pattern and the last char of the stem
|
|
1211
|
+
returns nil when the pattern is too short
|
|
1212
|
+
.arrow_rep
|
|
1213
|
+
returns nil when there is no -> at all
|
|
1214
|
+
returns nil when the from side is empty
|
|
1215
|
+
splits on -> into a (from, to) pair
|
|
1216
|
+
returns nil when the to side is empty
|
|
1217
|
+
.from_data
|
|
1218
|
+
returns a builder with aff_data and words populated
|
|
1219
|
+
yields a buildable Lookuper without touching the filesystem
|
|
1220
|
+
#build — casing selection
|
|
1221
|
+
CHECKSHARPS takes precedence over LANG
|
|
1222
|
+
uses TurkicCasing when LANG starts with 'tr'
|
|
1223
|
+
uses GermanCasing when CHECKSHARPS is true
|
|
1224
|
+
uses the standard Casing when no LANG or CHECKSHARPS is set
|
|
1225
|
+
uses GermanCasing when LANG starts with 'de'
|
|
1226
|
+
uses TurkicCasing when LANG starts with 'az'
|
|
1227
|
+
#build — dic structure
|
|
1228
|
+
has_flag returns false when no entry has the flag
|
|
1229
|
+
indexes dictionary stems for case-insensitive lookup when capitalized
|
|
1230
|
+
has_flag with for_all: true requires every entry to have the flag
|
|
1231
|
+
does NOT lowercase-index already-lowercase stems (NO captype)
|
|
1232
|
+
has_flag returns true when at least one entry has the flag (any)
|
|
1233
|
+
indexes dictionary stems for exact lookup
|
|
1234
|
+
has_flag returns false when there are no entries for the stem at all
|
|
1235
|
+
|
|
1236
|
+
Kotoshu
|
|
1237
|
+
ResourceNotSetupError
|
|
1238
|
+
accepts an explicit resource_type
|
|
1239
|
+
mentions setup in the message
|
|
1240
|
+
exposes language and the default resource_type
|
|
1241
|
+
InvalidDictionaryFormatError
|
|
1242
|
+
exposes path and details readers
|
|
1243
|
+
includes the path in the message
|
|
1244
|
+
includes the details in the message when given
|
|
1245
|
+
formats cleanly with nil details
|
|
1246
|
+
ResourceResolutionError
|
|
1247
|
+
formats the message with the reason
|
|
1248
|
+
exposes the language reader
|
|
1249
|
+
SuikaUnavailable
|
|
1250
|
+
appends the optional detail when given
|
|
1251
|
+
includes the install hint
|
|
1252
|
+
mentions the gem name in the message
|
|
1253
|
+
AffixRuleError
|
|
1254
|
+
exposes the rule reader
|
|
1255
|
+
defaults rule to nil
|
|
1256
|
+
ResourceNotCachedError
|
|
1257
|
+
exposes language and resource_type
|
|
1258
|
+
mentions the remediation command in the message
|
|
1259
|
+
ConfigurationError
|
|
1260
|
+
defaults key to nil
|
|
1261
|
+
exposes the key reader
|
|
1262
|
+
passes the message through unchanged
|
|
1263
|
+
Error
|
|
1264
|
+
is a StandardError
|
|
1265
|
+
accepts a message
|
|
1266
|
+
IntegrityError
|
|
1267
|
+
includes resource_id, expected and actual hashes in the message
|
|
1268
|
+
omits url and remediation segments when nil
|
|
1269
|
+
exposes all five readers
|
|
1270
|
+
includes the remediation hint when given
|
|
1271
|
+
includes the url when given
|
|
1272
|
+
DictionaryNotFoundError
|
|
1273
|
+
is a Kotoshu::Error
|
|
1274
|
+
honours an explicit message override
|
|
1275
|
+
synthesizes a default message that includes the path
|
|
1276
|
+
exposes the path reader
|
|
1277
|
+
SpellcheckError
|
|
1278
|
+
defaults word to nil
|
|
1279
|
+
exposes the word reader
|
|
1280
|
+
|
|
1281
|
+
Kotoshu::Cache::ModelCache
|
|
1282
|
+
#get integrity verification on cache hit
|
|
1283
|
+
points the LFS-pointer error at the cache download subcommand and purges the stub
|
|
1284
|
+
returns the model path when the checksum matches
|
|
1285
|
+
returns nil when the resource is not in AVAILABLE_MODELS
|
|
1286
|
+
exposes expected and actual checksums on the error
|
|
1287
|
+
raises IntegrityError when the cached file is truncated
|
|
1288
|
+
points the user at the cache download subcommand in the remediation hint
|
|
1289
|
+
accepts a legacy cache whose metadata has no checksum field (graceful degradation)
|
|
1290
|
+
raises IntegrityError when the cached file is a Git LFS pointer stub
|
|
1291
|
+
|
|
1292
|
+
Kotoshu::Readers
|
|
1293
|
+
Kotoshu::Readers::PhonetTable
|
|
1294
|
+
#parse_rule
|
|
1295
|
+
treats '_' replacement as silent (empty string)
|
|
1296
|
+
returns a Rule with the search regex and replacement
|
|
1297
|
+
parses a lookahead (-) into a followup rule
|
|
1298
|
+
defaults priority to 5 when absent
|
|
1299
|
+
parses the start flag (^)
|
|
1300
|
+
parses an explicit priority digit
|
|
1301
|
+
parses the end flag ($)
|
|
1302
|
+
raises ArgumentError for a malformed rule
|
|
1303
|
+
parses optional groups in parens
|
|
1304
|
+
#empty?
|
|
1305
|
+
is false for a non-empty table
|
|
1306
|
+
is true for an empty table
|
|
1307
|
+
#initialize
|
|
1308
|
+
indexes rules by their first letter
|
|
1309
|
+
returns an empty hash for an empty table
|
|
1310
|
+
stores the raw table
|
|
1311
|
+
Kotoshu::Readers::PhonetTable::Rule
|
|
1312
|
+
is constructed with keyword args
|
|
1313
|
+
is a Struct with the documented fields
|
|
1314
|
+
Kotoshu::Readers::CompoundRule
|
|
1315
|
+
metacharacter flags (sv, plan 91)
|
|
1316
|
+
compiles rules whose flag character is itself a regex metacharacter
|
|
1317
|
+
matches flag combinations containing the metacharacter flag
|
|
1318
|
+
#fullmatch
|
|
1319
|
+
returns true when the flag sets combine to a full match
|
|
1320
|
+
returns false for an empty array of flag sets
|
|
1321
|
+
returns false when any flag set has no overlap with the rule
|
|
1322
|
+
returns false when the combination does not match
|
|
1323
|
+
#partial_match
|
|
1324
|
+
returns false when the prefix does not match
|
|
1325
|
+
returns true for any prefix of the rule
|
|
1326
|
+
#initialize
|
|
1327
|
+
stores the rule text
|
|
1328
|
+
extracts multi-char flags when parens are used
|
|
1329
|
+
compiles a full-match regex
|
|
1330
|
+
extracts single-char flags when no parens are used
|
|
1331
|
+
compiles a partial-match regex
|
|
1332
|
+
Kotoshu::Readers::BreakPattern
|
|
1333
|
+
#initialize
|
|
1334
|
+
escapes regex special characters that are not ^ or $
|
|
1335
|
+
compiles a middle-of-word matcher for an unanchored pattern
|
|
1336
|
+
stores the pattern string
|
|
1337
|
+
compiles an anchored matcher for a $-trailing pattern
|
|
1338
|
+
compiles an anchored matcher for a ^-leading pattern
|
|
1339
|
+
Kotoshu::Readers::RepPattern
|
|
1340
|
+
#initialize
|
|
1341
|
+
stores pattern, replacement, and compiled matcher
|
|
1342
|
+
Kotoshu::Readers::Affix
|
|
1343
|
+
aliases #inspect to #to_s
|
|
1344
|
+
#to_s
|
|
1345
|
+
renders a suffix affix as Suffix(...)
|
|
1346
|
+
renders a prefix affix as Prefix(add: flag×/flags, on condition)
|
|
1347
|
+
#initialize
|
|
1348
|
+
stores all affix attributes from kwargs
|
|
1349
|
+
defaults flags to Set.new when not provided
|
|
1350
|
+
#prefix?/#suffix?
|
|
1351
|
+
suffix? is true for type: :suffix
|
|
1352
|
+
prefix? is true for type: :prefix
|
|
1353
|
+
Kotoshu::Readers::ConvTable
|
|
1354
|
+
#call
|
|
1355
|
+
replaces underscore in replacement with space
|
|
1356
|
+
passes characters without a matching conversion through unchanged
|
|
1357
|
+
applies multiple conversions positionally
|
|
1358
|
+
applies a single conversion to the matching prefix
|
|
1359
|
+
prefers the longer conversion when both match at the same position
|
|
1360
|
+
preserves declaration order for equal-length conversions
|
|
1361
|
+
treats trailing underscore as end-of-word anchor
|
|
1362
|
+
treats leading underscore as start-of-word anchor
|
|
1363
|
+
#initialize
|
|
1364
|
+
stores the raw pairs
|
|
1365
|
+
Kotoshu::Readers::Ignore
|
|
1366
|
+
#initialize
|
|
1367
|
+
stores an empty string when no chars given
|
|
1368
|
+
stores the chars string
|
|
1369
|
+
builds a translation_table mapping each char to its index
|
|
1370
|
+
#remove
|
|
1371
|
+
removes multiple distinct ignored characters
|
|
1372
|
+
returns the original string when no chars match
|
|
1373
|
+
removes ignored characters from the string
|
|
1374
|
+
Kotoshu::Readers::CompoundPattern
|
|
1375
|
+
#match?
|
|
1376
|
+
matches when left stem ends in left_stem and right stem starts with right_stem
|
|
1377
|
+
requires the right member to be at least as long as the pattern
|
|
1378
|
+
enforces the right_flag requirement when present
|
|
1379
|
+
enforces the left_flag requirement when present
|
|
1380
|
+
rejects when left stem does not end in left_stem
|
|
1381
|
+
treats . in the right side as a single-character wildcard
|
|
1382
|
+
rejects when right stem does not start with right_stem
|
|
1383
|
+
matches the right side against its text, not its stem
|
|
1384
|
+
keeps a right-side 0 literal
|
|
1385
|
+
when the left side is 0
|
|
1386
|
+
matches a left part whose prefix leaves the root running into the seam
|
|
1387
|
+
matches a left part carrying only a zero-width affix
|
|
1388
|
+
rejects a left part an affix has rewritten
|
|
1389
|
+
matches a left part whose surface text is the bare root
|
|
1390
|
+
#initialize
|
|
1391
|
+
reports whether a replacement was given
|
|
1392
|
+
keeps both sides literal, as Hunspell's parser does
|
|
1393
|
+
stores left, right, replacement
|
|
1394
|
+
parses left into left_stem and left_flag when slash present
|
|
1395
|
+
marks left_no_affix from the left side's leading zero
|
|
1396
|
+
sets left_flag to nil when no slash present
|
|
1397
|
+
#surface
|
|
1398
|
+
handles an empty stem on either side
|
|
1399
|
+
trims each stem by length, not by matching its text
|
|
1400
|
+
writes the two members the way the replacement spells them
|
|
1401
|
+
honors flags on either side when trimming the stems
|
|
1402
|
+
|
|
1403
|
+
Kotoshu::Embeddings::SimilarityEngine
|
|
1404
|
+
#is_normalized?
|
|
1405
|
+
returns false for a non-unit vector
|
|
1406
|
+
returns true for empty or nil input
|
|
1407
|
+
returns true for a unit-length vector
|
|
1408
|
+
#initialize
|
|
1409
|
+
defaults to non-pre-normalized, norm-caching mode
|
|
1410
|
+
honors cache_norms: false
|
|
1411
|
+
honors pre_normalize: true
|
|
1412
|
+
#pre_normalize
|
|
1413
|
+
returns a copy of an empty/nil input unchanged
|
|
1414
|
+
returns a new array (does not mutate input)
|
|
1415
|
+
returns a copy of a zero-magnitude vector unchanged
|
|
1416
|
+
scales a vector to unit length
|
|
1417
|
+
#cosine
|
|
1418
|
+
returns 0.0 for orthogonal vectors
|
|
1419
|
+
returns 0.0 for nil or empty inputs
|
|
1420
|
+
returns -1.0 for opposite vectors
|
|
1421
|
+
returns 1.0 for parallel vectors regardless of magnitude
|
|
1422
|
+
returns 1.0 for identical non-zero vectors
|
|
1423
|
+
is symmetric in its arguments
|
|
1424
|
+
computes cosine for a 3D example
|
|
1425
|
+
returns 0.0 for a zero-magnitude vector
|
|
1426
|
+
dimension mismatch
|
|
1427
|
+
raises ArgumentError from dot_product
|
|
1428
|
+
raises ArgumentError from euclidean
|
|
1429
|
+
raises ArgumentError from manhattan
|
|
1430
|
+
raises ArgumentError from cosine
|
|
1431
|
+
does not raise when one operand is empty (early-return path)
|
|
1432
|
+
norm cache
|
|
1433
|
+
records a miss on first computation and a hit on repeat
|
|
1434
|
+
tracks hit_rate as hits / (hits + misses)
|
|
1435
|
+
is disabled when cache_norms: false
|
|
1436
|
+
#cache_stats
|
|
1437
|
+
includes hits, misses, hit_rate, and cache_size keys
|
|
1438
|
+
reports 0.0 hit_rate when nothing has been computed
|
|
1439
|
+
#euclidean
|
|
1440
|
+
computes the Euclidean distance
|
|
1441
|
+
returns 0.0 for empty input
|
|
1442
|
+
returns 0.0 for identical vectors
|
|
1443
|
+
#dot_product
|
|
1444
|
+
computes the dot product
|
|
1445
|
+
returns 0.0 for empty or nil input
|
|
1446
|
+
#clear_cache
|
|
1447
|
+
resets hit/miss counters and empties the cache
|
|
1448
|
+
returns self for chaining
|
|
1449
|
+
#manhattan
|
|
1450
|
+
computes the Manhattan (L1) distance
|
|
1451
|
+
returns 0.0 for empty input
|
|
1452
|
+
#compute_all_pairs
|
|
1453
|
+
produces a symmetric similarity matrix with 1.0 on the diagonal
|
|
1454
|
+
#normalize_and_compute
|
|
1455
|
+
returns 0.0 for empty input
|
|
1456
|
+
uses dot product when pre_normalize is on (fast path)
|
|
1457
|
+
delegates to cosine when pre_normalize is off
|
|
1458
|
+
#cosine_batch
|
|
1459
|
+
computes cosine for each pair
|
|
1460
|
+
|
|
1461
|
+
Foundation Component Integration
|
|
1462
|
+
WhitespaceTokenizer
|
|
1463
|
+
can be used standalone
|
|
1464
|
+
behaves like a tokenizer
|
|
1465
|
+
tokenizes text
|
|
1466
|
+
can tokenize to strings
|
|
1467
|
+
returns hashes with token, position, length
|
|
1468
|
+
handles empty text
|
|
1469
|
+
handles text with only whitespace
|
|
1470
|
+
handles nil text
|
|
1471
|
+
EnglishPosTagger
|
|
1472
|
+
when dictionary files exist
|
|
1473
|
+
tags a single token
|
|
1474
|
+
caches lookup results
|
|
1475
|
+
behaves like a POS tagger
|
|
1476
|
+
adds pos_tag to tokens
|
|
1477
|
+
adds lemma to tokens
|
|
1478
|
+
tags tokens
|
|
1479
|
+
can tag a single word
|
|
1480
|
+
handles empty token array
|
|
1481
|
+
handles nil token array
|
|
1482
|
+
EnglishSpellChecker
|
|
1483
|
+
when dictionary files do not exist
|
|
1484
|
+
raises an error when creating checker
|
|
1485
|
+
when dictionary files exist
|
|
1486
|
+
#check
|
|
1487
|
+
returns found: false for misspelled words
|
|
1488
|
+
returns found: true for correct words
|
|
1489
|
+
behaves like a spell checker
|
|
1490
|
+
checks words
|
|
1491
|
+
has a correct? convenience method
|
|
1492
|
+
suggests corrections
|
|
1493
|
+
returns boolean from correct?
|
|
1494
|
+
returns found flag as boolean
|
|
1495
|
+
#correct?
|
|
1496
|
+
returns false for misspelled words
|
|
1497
|
+
returns true for correct words
|
|
1498
|
+
#suggest
|
|
1499
|
+
returns suggestions for misspelled words
|
|
1500
|
+
Component Integration
|
|
1501
|
+
when dictionary files exist
|
|
1502
|
+
finds misspelled words and suggests corrections
|
|
1503
|
+
can tokenize, tag, and check text end-to-end
|
|
1504
|
+
|
|
1505
|
+
Kotoshu::Grammar::RuleEngine
|
|
1506
|
+
More common confusion-phrase rules
|
|
1507
|
+
to/too
|
|
1508
|
+
flags "to much" → "too much"
|
|
1509
|
+
flags "to many" → "too many"
|
|
1510
|
+
does NOT flag "too much" (correct usage)
|
|
1511
|
+
rule loading
|
|
1512
|
+
loads all seven new confusion-phrase rules
|
|
1513
|
+
common grammar confusions
|
|
1514
|
+
flags "alright" → "all right"
|
|
1515
|
+
flags "inspite" → "in spite"
|
|
1516
|
+
flags "between you and I" → "between you and me"
|
|
1517
|
+
flags "apart of" → "a part of"
|
|
1518
|
+
flags "as follow" → "as follows"
|
|
1519
|
+
EN_THERE_THEIR rule
|
|
1520
|
+
#check
|
|
1521
|
+
accepts "there are"
|
|
1522
|
+
accepts "there is" (location/existence)
|
|
1523
|
+
detects "there parents" (should be "their parents")
|
|
1524
|
+
Confusion-phrase rules (TODO 51 Phase 2 subset)
|
|
1525
|
+
common phrase confusions
|
|
1526
|
+
flags "alot" → "a lot"
|
|
1527
|
+
flags "for free" → "free"
|
|
1528
|
+
flags "could care less" → "couldn't care less"
|
|
1529
|
+
then/than phrases
|
|
1530
|
+
does NOT flag "more than" (correct usage)
|
|
1531
|
+
flags "more then" → "more than"
|
|
1532
|
+
flags "less then" → "less than"
|
|
1533
|
+
flags "other then" → "other than"
|
|
1534
|
+
flags "rather then" → "rather than"
|
|
1535
|
+
rule loading
|
|
1536
|
+
loads all seven confusion-phrase rules
|
|
1537
|
+
EN_DOUBLE_NEGATIVE rule
|
|
1538
|
+
#check
|
|
1539
|
+
handles "not only... but also" correctly
|
|
1540
|
+
does not flag "I don't know anything"
|
|
1541
|
+
finds double negatives within reasonable distance
|
|
1542
|
+
does not flag distant negatives
|
|
1543
|
+
detects "I don't know nothing"
|
|
1544
|
+
Capitalization rules (TODO 51 Phase 3)
|
|
1545
|
+
EN_PROPER_NOUN_CAP rule
|
|
1546
|
+
flags "english" and suggests "English"
|
|
1547
|
+
flags multiple proper nouns in a stream
|
|
1548
|
+
does NOT flag common nouns like "apple"
|
|
1549
|
+
flags "monday" and suggests "Monday"
|
|
1550
|
+
does NOT flag "Monday" (already capitalized)
|
|
1551
|
+
EN_SENTENCE_START_CAP rule
|
|
1552
|
+
flags lowercase sentence starts across multiple sentences
|
|
1553
|
+
suggests the capitalized form
|
|
1554
|
+
flags a lowercase first word of a stream
|
|
1555
|
+
flags a lowercase word after a period
|
|
1556
|
+
does not flag a capitalized first word
|
|
1557
|
+
Possessive / contraction rules (TODO 51 Phase 1)
|
|
1558
|
+
EN_ITS_IT_S rule
|
|
1559
|
+
flags "its cold" (should be "it's cold")
|
|
1560
|
+
does not flag "its color" (possessive is correct)
|
|
1561
|
+
flags "its been" (should be "it's been")
|
|
1562
|
+
EN_YOUR_YOURE rule
|
|
1563
|
+
does not flag "your jacket" (possessive is correct)
|
|
1564
|
+
flags "your going" (should be "you're going")
|
|
1565
|
+
rule loading
|
|
1566
|
+
loads all three possessive/contraction rules
|
|
1567
|
+
EN_WHOSE_WHOS rule
|
|
1568
|
+
does not flag "whose book" (possessive is correct)
|
|
1569
|
+
flags "whose coming" (should be "who's coming")
|
|
1570
|
+
EN_A_VS_AN rule
|
|
1571
|
+
#check
|
|
1572
|
+
handles "a university" correctly
|
|
1573
|
+
accepts "an elephant"
|
|
1574
|
+
detects "an dog" (should be "a dog")
|
|
1575
|
+
accepts "a dog"
|
|
1576
|
+
handles "a one-time" correctly
|
|
1577
|
+
detects "a elephant" (should be "an elephant")
|
|
1578
|
+
handles "an hour" correctly
|
|
1579
|
+
RuleEngine
|
|
1580
|
+
returns nil for unknown rule ID
|
|
1581
|
+
returns rule IDs
|
|
1582
|
+
checks if rule exists
|
|
1583
|
+
can get specific rule by ID
|
|
1584
|
+
loads rules from YAML configuration
|
|
1585
|
+
English language class integration
|
|
1586
|
+
provides create_grammar_rules method
|
|
1587
|
+
Phrase confusion rules (EN_*_OF)
|
|
1588
|
+
#check
|
|
1589
|
+
detects "could of" and suggests "could have"
|
|
1590
|
+
detects "would of"
|
|
1591
|
+
detects "must of" and "might of"
|
|
1592
|
+
does not flag "could have"
|
|
1593
|
+
detects "should of"
|
|
1594
|
+
rule loading
|
|
1595
|
+
loads all five phrase-confusion rules
|
|
1596
|
+
|
|
1597
|
+
Kotoshu::Keyboard::Layouts::Latin
|
|
1598
|
+
Kotoshu::Keyboard::Layouts::Latin::Czech
|
|
1599
|
+
keeps háček letters off the physical grid
|
|
1600
|
+
freezes its composed grid
|
|
1601
|
+
is registered for its language
|
|
1602
|
+
reuses the QWERTZ base grid (z/y swap)
|
|
1603
|
+
Kotoshu::Keyboard::Layouts::Latin::Vietnamese
|
|
1604
|
+
is registered for its language
|
|
1605
|
+
freezes its composed grid
|
|
1606
|
+
Kotoshu::Keyboard::Layouts::Latin::Catalan
|
|
1607
|
+
freezes its composed grid
|
|
1608
|
+
is registered for its language
|
|
1609
|
+
Kotoshu::Keyboard::Layouts::Latin::Hungarian
|
|
1610
|
+
is registered for its language
|
|
1611
|
+
freezes its composed grid
|
|
1612
|
+
reuses the QWERTZ base grid
|
|
1613
|
+
Kotoshu::Keyboard::Layouts::Latin::Italian
|
|
1614
|
+
freezes its composed grid
|
|
1615
|
+
reuses the QWERTY base grid coordinates
|
|
1616
|
+
is registered for its language
|
|
1617
|
+
reports an Italian name
|
|
1618
|
+
the Nordic members
|
|
1619
|
+
Kotoshu::Keyboard::Layouts::Latin::Norwegian
|
|
1620
|
+
is registered for its language
|
|
1621
|
+
shares the Danish physical grid
|
|
1622
|
+
freezes its composed grid
|
|
1623
|
+
Kotoshu::Keyboard::Layouts::Latin::Swedish
|
|
1624
|
+
has real å ä ö keys where Danish has æ ø
|
|
1625
|
+
makes the classic ä/ö slip distance 1
|
|
1626
|
+
freezes its composed grid
|
|
1627
|
+
is registered for its language
|
|
1628
|
+
Kotoshu::Keyboard::Layouts::Latin::Danish
|
|
1629
|
+
drops the US bracket and semicolon keys they replace
|
|
1630
|
+
freezes its composed grid
|
|
1631
|
+
makes æ adjacent to ø
|
|
1632
|
+
has real å æ ø keys
|
|
1633
|
+
is registered for its language
|
|
1634
|
+
Kotoshu::Keyboard::Layouts::Latin::Polish
|
|
1635
|
+
freezes its composed grid
|
|
1636
|
+
keeps Polish diacritics off the physical grid
|
|
1637
|
+
is registered for its language
|
|
1638
|
+
Kotoshu::Keyboard::Layouts::Latin::Dutch
|
|
1639
|
+
freezes its composed grid
|
|
1640
|
+
is registered for its language
|
|
1641
|
+
family hygiene
|
|
1642
|
+
gives uk the dedicated grid instead of the base JCUKEN claim
|
|
1643
|
+
does not change the existing language mappings
|
|
1644
|
+
Kotoshu::Keyboard::Layouts::Latin::Romanian
|
|
1645
|
+
freezes its composed grid
|
|
1646
|
+
is registered for its language
|
|
1647
|
+
|
|
1648
|
+
Kotoshu::Languages::English::Tokenizer
|
|
1649
|
+
behaves like a tokenizer
|
|
1650
|
+
handles nil text
|
|
1651
|
+
handles text with only whitespace
|
|
1652
|
+
handles empty text
|
|
1653
|
+
can tokenize to strings
|
|
1654
|
+
tokenizes text
|
|
1655
|
+
returns hashes with token, position, length
|
|
1656
|
+
#initialize
|
|
1657
|
+
can disable contraction expansion
|
|
1658
|
+
CONTRACTIONS constant
|
|
1659
|
+
has common contractions defined
|
|
1660
|
+
#tokenize
|
|
1661
|
+
handles possessive "John's" correctly
|
|
1662
|
+
expands "can't" to "can" + "not"
|
|
1663
|
+
handles "I've" correctly
|
|
1664
|
+
handles "I'm" correctly
|
|
1665
|
+
handles "I'd" correctly
|
|
1666
|
+
handles "you're" correctly
|
|
1667
|
+
expands common contractions
|
|
1668
|
+
expands "won't" to "will" + "not"
|
|
1669
|
+
handles multiple contractions in one sentence
|
|
1670
|
+
handles non-contraction text normally
|
|
1671
|
+
|
|
1672
|
+
Kotoshu::Suggestions::Strategies::CompositeStrategy
|
|
1673
|
+
#size / #count / #any?
|
|
1674
|
+
size reports the number of child strategies
|
|
1675
|
+
any? is true when at least one strategy is present
|
|
1676
|
+
count is aliased as size
|
|
1677
|
+
.with_defaults
|
|
1678
|
+
starts empty (defaults are added by the caller via #add)
|
|
1679
|
+
returns a CompositeStrategy with name :default
|
|
1680
|
+
forwards config kwargs to the constructor
|
|
1681
|
+
#sort_by_priority!
|
|
1682
|
+
sorts strategies by ascending priority and returns self
|
|
1683
|
+
#applicable_strategies
|
|
1684
|
+
does not mutate the strategies array
|
|
1685
|
+
returns an empty array when no strategy handles the context
|
|
1686
|
+
returns only strategies whose handles? is true
|
|
1687
|
+
#to_s / #inspect
|
|
1688
|
+
includes the class name, composite name, and child strategy names
|
|
1689
|
+
is aliased as inspect
|
|
1690
|
+
#each_strategy
|
|
1691
|
+
yields each strategy when a block is given
|
|
1692
|
+
returns an Enumerator when no block is given
|
|
1693
|
+
confidence cascade
|
|
1694
|
+
runs the rerank at the default threshold even for confidence 1.0
|
|
1695
|
+
follows the process Configuration when no threshold kwarg is given
|
|
1696
|
+
at a mid threshold
|
|
1697
|
+
merges rerank candidates into the pool when not skipped
|
|
1698
|
+
skips exactly when the top traditional confidence is at or above it
|
|
1699
|
+
debug metrics
|
|
1700
|
+
exports the counter in StatsD and Prometheus formats
|
|
1701
|
+
counts skips as semantic_cascade_skips
|
|
1702
|
+
does not count when the rerank runs
|
|
1703
|
+
at threshold 0.0 (never rerank)
|
|
1704
|
+
skips the rerank whenever the traditional pool has candidates
|
|
1705
|
+
still runs the rerank when the traditional pool is empty
|
|
1706
|
+
#remove
|
|
1707
|
+
removes the strategy by identity and returns self
|
|
1708
|
+
is a no-op when the strategy is not present
|
|
1709
|
+
#handles?
|
|
1710
|
+
is false when the composite is empty
|
|
1711
|
+
is false when no child handles the context
|
|
1712
|
+
is true when at least one child handles the context
|
|
1713
|
+
#generate
|
|
1714
|
+
with real EditDistanceStrategy returns ranked suggestions for a typo
|
|
1715
|
+
returns an empty SuggestionSet when no strategy handles the context
|
|
1716
|
+
skips strategies that don't handle the context but still runs the rest
|
|
1717
|
+
merges results from every applicable strategy into one SuggestionSet
|
|
1718
|
+
honours the context max_results cap
|
|
1719
|
+
deduplicates across strategies in a single batch (TODO 56 T5.1)
|
|
1720
|
+
#add / #<<
|
|
1721
|
+
appends a strategy and returns self for chaining
|
|
1722
|
+
is aliased as <<
|
|
1723
|
+
preserves insertion order across multiple adds
|
|
1724
|
+
#initialize
|
|
1725
|
+
accepts an initial strategies array
|
|
1726
|
+
accepts a name keyword and exposes it via #name
|
|
1727
|
+
defaults strategies to an empty array
|
|
1728
|
+
#clear
|
|
1729
|
+
removes all strategies and returns self
|
|
1730
|
+
|
|
1731
|
+
Kotoshu::Jekyll::Generator
|
|
1732
|
+
is a registered-safe Jekyll generator
|
|
1733
|
+
is quiet for a site without posts
|
|
1734
|
+
passes a clean site
|
|
1735
|
+
fails the build naming the post and word
|
|
1736
|
+
checks drafts when the site builds with drafts
|
|
1737
|
+
respects a baseline in the site source
|
|
1738
|
+
|
|
1739
|
+
Kotoshu::Keyboard::Layouts::GreekPhonetic
|
|
1740
|
+
registry integration
|
|
1741
|
+
is returned by layout_for for Greek
|
|
1742
|
+
adjacency
|
|
1743
|
+
gives the common typo pair ο/π distance 1
|
|
1744
|
+
makes σ adjacent to ε on the top row
|
|
1745
|
+
makes κ adjacent to λ and ξ
|
|
1746
|
+
language support
|
|
1747
|
+
supports el and el-GR
|
|
1748
|
+
phonetic mapping
|
|
1749
|
+
maps each Greek letter to the Latin letter it transliterates to
|
|
1750
|
+
has no accented vowels — accents are dead keys
|
|
1751
|
+
has the full 24-letter Greek alphabet
|
|
1752
|
+
|
|
1753
|
+
Semantic path runtime gating
|
|
1754
|
+
Suggestions::Generator default algorithms
|
|
1755
|
+
does not include SemanticStrategy
|
|
1756
|
+
includes the four traditional algorithms
|
|
1757
|
+
true
|
|
1758
|
+
is a boolean
|
|
1759
|
+
traditional Spellchecker entry points
|
|
1760
|
+
#check never raises OnnxUnavailable and returns a DocumentResult
|
|
1761
|
+
#correct? never raises OnnxUnavailable
|
|
1762
|
+
#suggest never raises OnnxUnavailable and returns a SuggestionSet
|
|
1763
|
+
#check_word never raises OnnxUnavailable
|
|
1764
|
+
SemanticStrategy fallback when ONNX is unavailable
|
|
1765
|
+
returns an empty SuggestionSet without raising
|
|
1766
|
+
Kotoshu::Models::OnnxModel::OnnxUnavailable
|
|
1767
|
+
appends the optional detail when given
|
|
1768
|
+
is a Kotoshu::Error subclass
|
|
1769
|
+
mentions KOTOSHU_NO_ONNX as the opt-out
|
|
1770
|
+
mentions the install command in the default message
|
|
1771
|
+
|
|
1772
|
+
Kotoshu::Cli::CompletionsCommand
|
|
1773
|
+
Kotoshu::Cli::Completions::Command
|
|
1774
|
+
is a keyword-initialised Struct with name and description
|
|
1775
|
+
the wired CLI exposes `completions` as a subcommand
|
|
1776
|
+
lists `completions` in `kotoshu help`
|
|
1777
|
+
lists bash/zsh/fish/languages under `kotoshu completions help`
|
|
1778
|
+
#fish
|
|
1779
|
+
documents the install path
|
|
1780
|
+
adds language completion for setup and fetch
|
|
1781
|
+
emits one complete line per top-level command
|
|
1782
|
+
#languages
|
|
1783
|
+
is non-empty
|
|
1784
|
+
emits supported language codes one per line
|
|
1785
|
+
#zsh
|
|
1786
|
+
shells out to kotoshu completions languages for setup/fetch
|
|
1787
|
+
emits a #compdef header and a _kotoshu function
|
|
1788
|
+
describes every top-level command
|
|
1789
|
+
#bash
|
|
1790
|
+
includes the language-argument branch for setup and fetch
|
|
1791
|
+
emits a syntactically valid bash completion script
|
|
1792
|
+
documents the install path
|
|
1793
|
+
Kotoshu::Cli::Completions::ScriptBuilders
|
|
1794
|
+
with custom language-argument commands
|
|
1795
|
+
renders one case branch per language-argument command
|
|
1796
|
+
with no language-argument commands
|
|
1797
|
+
renders a placeholder line instead of an empty case branch
|
|
1798
|
+
.indent
|
|
1799
|
+
indents every line by the given count
|
|
1800
|
+
is a no-op at zero indent
|
|
1801
|
+
|
|
1802
|
+
Kotoshu::SourceRegistry
|
|
1803
|
+
immutability
|
|
1804
|
+
is unaffected by mutating the hash passed to the constructor
|
|
1805
|
+
per-repo pin overrides
|
|
1806
|
+
keeps a custom mirror base for LFS model sources
|
|
1807
|
+
honors override pins keyed by repo name
|
|
1808
|
+
leaves other repos on their default pin when only one is overridden
|
|
1809
|
+
accepts symbol keys in the pins hash
|
|
1810
|
+
#pin_for_source and #repo_for
|
|
1811
|
+
returns the default pin when no override is configured
|
|
1812
|
+
returns the repo name for a source key
|
|
1813
|
+
custom base URL
|
|
1814
|
+
uses the provided base without trailing slash
|
|
1815
|
+
#url_for
|
|
1816
|
+
builds frequency URL with main pin (Kelly repo)
|
|
1817
|
+
builds spelling URL with v1 pin and language extension
|
|
1818
|
+
raises ArgumentError for unknown source
|
|
1819
|
+
builds vocab URL paired with each model
|
|
1820
|
+
builds model URL with main pin via the Git-LFS media host
|
|
1821
|
+
builds manifest URLs for each repo
|
|
1822
|
+
builds grammar URL with v1 pin
|
|
1823
|
+
|
|
1824
|
+
Unit: Hunspell DIC Reader
|
|
1825
|
+
#load
|
|
1826
|
+
handles encoding
|
|
1827
|
+
handles long flag format
|
|
1828
|
+
loads a simple DIC file
|
|
1829
|
+
|
|
1830
|
+
Kotoshu::Rspec::Matchers
|
|
1831
|
+
#expect_words
|
|
1832
|
+
returns a real expectation target composable with .to
|
|
1833
|
+
be_spelled_correctly
|
|
1834
|
+
accepts a language option
|
|
1835
|
+
fails for a misspelled word
|
|
1836
|
+
checks whole documents when the text has whitespace
|
|
1837
|
+
passes for a correct word
|
|
1838
|
+
passes for a clean document
|
|
1839
|
+
negates honestly for documents
|
|
1840
|
+
all_be_spelled_correctly
|
|
1841
|
+
negates honestly
|
|
1842
|
+
fails naming the misspelled words with suggestions
|
|
1843
|
+
passes when every word is correct
|
|
1844
|
+
#expect_document
|
|
1845
|
+
checks the file contents as a document
|
|
1846
|
+
|
|
1847
|
+
Kotoshu::Languages::Ukrainian
|
|
1848
|
+
registry
|
|
1849
|
+
registers uk and uk-UA
|
|
1850
|
+
normalization
|
|
1851
|
+
folds uppercase Ukrainian words
|
|
1852
|
+
Cyrillic tokenizer
|
|
1853
|
+
is a CyrillicTokenizer
|
|
1854
|
+
rejects tokens without Cyrillic letters
|
|
1855
|
+
keeps Ukrainian apostrophe names as one token
|
|
1856
|
+
has the four Ukrainian-only letters in real words
|
|
1857
|
+
splits a real Ukrainian sentence
|
|
1858
|
+
keeps Ukrainian-script words
|
|
1859
|
+
|
|
1860
|
+
Kotoshu::Spellchecker::FluentChecker
|
|
1861
|
+
#max_suggestions
|
|
1862
|
+
sets max suggestions option
|
|
1863
|
+
returns self for chaining
|
|
1864
|
+
#initialize
|
|
1865
|
+
stores options
|
|
1866
|
+
creates fluent checker with spellchecker
|
|
1867
|
+
#check
|
|
1868
|
+
checks text for errors
|
|
1869
|
+
finds misspelled words
|
|
1870
|
+
#on_progress
|
|
1871
|
+
sets progress callback
|
|
1872
|
+
#on_error
|
|
1873
|
+
sets error callback
|
|
1874
|
+
#ignore_words
|
|
1875
|
+
stores ignore pattern
|
|
1876
|
+
returns self for chaining
|
|
1877
|
+
|
|
1878
|
+
Kotoshu::Native
|
|
1879
|
+
requiring the gem without the extension
|
|
1880
|
+
defines the module and its Ruby-side error class
|
|
1881
|
+
.available?
|
|
1882
|
+
answers without raising, on every install shape
|
|
1883
|
+
extension surface
|
|
1884
|
+
loads a real fixture dictionary and checks words (PENDING: native extension not built (rake compile))
|
|
1885
|
+
answers available? true (PENDING: native extension not built (rake compile))
|
|
1886
|
+
returns suggestion rows in the conformance shape (PENDING: native extension not built (rake compile))
|
|
1887
|
+
raises Native::Error naming the path when loading a missing dictionary (PENDING: native extension not built (rake compile))
|
|
1888
|
+
defines Error as a RuntimeError subclass (PENDING: native extension not built (rake compile))
|
|
1889
|
+
exposes the kotoshu-rs version (PENDING: native extension not built (rake compile))
|
|
1890
|
+
.suggestion
|
|
1891
|
+
materializes a Suggestions::Suggestion from a native row
|
|
1892
|
+
keeps exactly the four public conformance keys
|
|
1893
|
+
|
|
1894
|
+
Kotoshu::Suggestions::Strategies::SemanticStrategy
|
|
1895
|
+
#skip_when_confident?
|
|
1896
|
+
opts in to the confidence cascade (skippable when traditional is confident)
|
|
1897
|
+
#generate
|
|
1898
|
+
when ONNX model is not available
|
|
1899
|
+
returns empty suggestion set
|
|
1900
|
+
#initialize
|
|
1901
|
+
is enabled by default
|
|
1902
|
+
accepts config options
|
|
1903
|
+
creates a strategy with language code
|
|
1904
|
+
can be disabled
|
|
1905
|
+
#to_s
|
|
1906
|
+
returns informative string representation
|
|
1907
|
+
|
|
1908
|
+
Kotoshu::Algorithms::EditDistance
|
|
1909
|
+
.distance
|
|
1910
|
+
returns the other string's length when one is empty
|
|
1911
|
+
returns 0 for identical strings
|
|
1912
|
+
counts single-character deletion as 1
|
|
1913
|
+
counts single-character insertion as 1
|
|
1914
|
+
counts single-character substitution as 1
|
|
1915
|
+
counts adjacent-character transposition as 1 (Damerau extension)
|
|
1916
|
+
sums multiple operations for distant strings
|
|
1917
|
+
.distance_with_threshold
|
|
1918
|
+
returns nil when the distance exceeds the threshold
|
|
1919
|
+
returns the distance when it is within the threshold
|
|
1920
|
+
returns the distance when it equals the threshold
|
|
1921
|
+
|
|
1922
|
+
Integrational Lookup Tests
|
|
1923
|
+
Misc
|
|
1924
|
+
passes warn lookup tests
|
|
1925
|
+
passes opentaal_keepcase lookup tests
|
|
1926
|
+
passes ph2 lookup tests
|
|
1927
|
+
passes morph lookup tests
|
|
1928
|
+
passes utf8_nonbmp lookup tests
|
|
1929
|
+
passes ngram_utf_fix lookup tests
|
|
1930
|
+
Affixes
|
|
1931
|
+
passes affixes lookup tests
|
|
1932
|
+
passes complexprefixes2 lookup tests
|
|
1933
|
+
passes condition lookup tests
|
|
1934
|
+
passes complexprefixes lookup tests
|
|
1935
|
+
passes conditionalprefix lookup tests
|
|
1936
|
+
passes complexprefixesutf lookup tests
|
|
1937
|
+
passes condition_utf lookup tests
|
|
1938
|
+
passes circumfix lookup tests
|
|
1939
|
+
Flags
|
|
1940
|
+
passes utf8 lookup tests
|
|
1941
|
+
passes alias3 lookup tests
|
|
1942
|
+
passes utf8_bom lookup tests
|
|
1943
|
+
passes encoding lookup tests
|
|
1944
|
+
passes flagnum lookup tests
|
|
1945
|
+
passes alias lookup tests
|
|
1946
|
+
passes right_to_left_mark lookup tests
|
|
1947
|
+
passes alias2 lookup tests
|
|
1948
|
+
passes flagutf8 lookup tests
|
|
1949
|
+
passes flag lookup tests
|
|
1950
|
+
passes flaglong lookup tests
|
|
1951
|
+
passes utf8_bom2 lookup tests
|
|
1952
|
+
Specific Languages
|
|
1953
|
+
passes dotless_i lookup tests
|
|
1954
|
+
passes checksharpsutf lookup tests
|
|
1955
|
+
passes ignoresug lookup tests
|
|
1956
|
+
passes korean lookup tests
|
|
1957
|
+
passes checksharps lookup tests
|
|
1958
|
+
passes hu lookup tests (PENDING: Hungarian is hard! (COMPOUNDSYLLABLE, LANG_hu moving rule, CHECKCOMPOUNDREP, COMPOUNDFORBIDFLAG))
|
|
1959
|
+
passes ignore lookup tests
|
|
1960
|
+
passes germancompoundingold lookup tests
|
|
1961
|
+
passes germancompounding lookup tests
|
|
1962
|
+
passes IJ lookup tests
|
|
1963
|
+
passes ignoreutf lookup tests
|
|
1964
|
+
passes nepali lookup tests
|
|
1965
|
+
Base
|
|
1966
|
+
passes base lookup tests
|
|
1967
|
+
passes base_utf lookup tests
|
|
1968
|
+
Compounding
|
|
1969
|
+
passes onlyincompound2 lookup tests
|
|
1970
|
+
passes checkcompoundpattern4 lookup tests
|
|
1971
|
+
passes fogemorpheme lookup tests
|
|
1972
|
+
passes compoundrule5 lookup tests
|
|
1973
|
+
passes checkcompoundcase lookup tests
|
|
1974
|
+
passes checkcompoundtriple lookup tests
|
|
1975
|
+
passes compoundrule6 lookup tests
|
|
1976
|
+
passes opentaal_cpdpat2 lookup tests
|
|
1977
|
+
passes forceucase lookup tests
|
|
1978
|
+
passes checkcompoundpattern lookup tests
|
|
1979
|
+
passes compoundrule8 lookup tests
|
|
1980
|
+
passes onlyincompound lookup tests
|
|
1981
|
+
passes compoundaffix lookup tests
|
|
1982
|
+
passes checkcompoundcase2 lookup tests
|
|
1983
|
+
passes checkcompoundrep lookup tests
|
|
1984
|
+
passes compoundrule7 lookup tests
|
|
1985
|
+
passes utfcompound lookup tests
|
|
1986
|
+
passes compoundforbid lookup tests
|
|
1987
|
+
passes compoundaffix2 lookup tests
|
|
1988
|
+
passes compoundrule3 lookup tests
|
|
1989
|
+
passes compoundaffix3 lookup tests
|
|
1990
|
+
passes checkcompoundcaseutf lookup tests
|
|
1991
|
+
passes compoundrule lookup tests
|
|
1992
|
+
passes compoundflag lookup tests
|
|
1993
|
+
passes compoundrule2 lookup tests
|
|
1994
|
+
passes opentaal_forbiddenword2 lookup tests
|
|
1995
|
+
passes simplifiedtriple lookup tests
|
|
1996
|
+
passes checkcompoundpattern2 lookup tests
|
|
1997
|
+
passes checkcompoundpattern3 lookup tests
|
|
1998
|
+
passes opentaal_cpdpat lookup tests
|
|
1999
|
+
passes checkcompounddup lookup tests
|
|
2000
|
+
passes wordpair lookup tests
|
|
2001
|
+
passes compoundrule4 lookup tests
|
|
2002
|
+
passes opentaal_forbiddenword1 lookup tests
|
|
2003
|
+
Input/Output
|
|
2004
|
+
passes iconv2 lookup tests
|
|
2005
|
+
passes iconv lookup tests
|
|
2006
|
+
passes oconv lookup tests
|
|
2007
|
+
passes oconv2 lookup tests
|
|
2008
|
+
Exclusion Flags
|
|
2009
|
+
passes forbiddenword lookup tests
|
|
2010
|
+
passes allcaps lookup tests
|
|
2011
|
+
passes keepcase lookup tests
|
|
2012
|
+
passes allcaps3 lookup tests
|
|
2013
|
+
passes nosuggest lookup tests
|
|
2014
|
+
passes allcaps_utf lookup tests
|
|
2015
|
+
passes allcaps2 lookup tests
|
|
2016
|
+
Break
|
|
2017
|
+
passes break lookup tests
|
|
2018
|
+
passes breakdefault lookup tests
|
|
2019
|
+
passes breakoff lookup tests
|
|
2020
|
+
Need Affix
|
|
2021
|
+
passes needaffix2 lookup tests
|
|
2022
|
+
passes fullstrip lookup tests
|
|
2023
|
+
passes needaffix3 lookup tests
|
|
2024
|
+
passes needaffix lookup tests
|
|
2025
|
+
passes needaffix4 lookup tests
|
|
2026
|
+
passes needaffix5 lookup tests
|
|
2027
|
+
passes zeroaffix lookup tests
|
|
2028
|
+
Edge Cases and Bugs
|
|
2029
|
+
passes i58202 lookup tests
|
|
2030
|
+
passes 2970242 lookup tests
|
|
2031
|
+
passes slash lookup tests
|
|
2032
|
+
passes 1975530 lookup tests
|
|
2033
|
+
passes i68568utf lookup tests
|
|
2034
|
+
passes arabic lookup tests
|
|
2035
|
+
passes i54980 lookup tests
|
|
2036
|
+
passes i53643 lookup tests
|
|
2037
|
+
passes 2970240 lookup tests
|
|
2038
|
+
passes digits_in_words lookup tests
|
|
2039
|
+
passes 2999225 lookup tests
|
|
2040
|
+
passes 1592880 lookup tests
|
|
2041
|
+
passes timelimit lookup tests
|
|
2042
|
+
passes i54633 lookup tests
|
|
2043
|
+
passes 1706659 lookup tests
|
|
2044
|
+
passes i68568 lookup tests
|
|
2045
|
+
passes i35725 lookup tests
|
|
2046
|
+
|
|
2047
|
+
Kotoshu::Suggestions::Strategies::BaseStrategy
|
|
2048
|
+
#generate (abstract)
|
|
2049
|
+
raises NotImplementedError on the abstract parent
|
|
2050
|
+
is fulfilled by a concrete subclass
|
|
2051
|
+
#handles?
|
|
2052
|
+
is false when the word IS in the dictionary (no suggestions needed)
|
|
2053
|
+
is false when the strategy is disabled
|
|
2054
|
+
is true when the word is NOT in the dictionary (suggestions needed)
|
|
2055
|
+
dispatches through IndexedDictionary#has_word? when given an IndexedDictionary
|
|
2056
|
+
#create_suggestion_set
|
|
2057
|
+
honours an explicit distances map
|
|
2058
|
+
builds a SuggestionSet with each word wrapped in a Suggestion
|
|
2059
|
+
falls back to the downcased distance key when the exact key is missing
|
|
2060
|
+
defaults distance to 1 when neither exact nor downcased key is present
|
|
2061
|
+
stamps original_length metadata when original_word is supplied
|
|
2062
|
+
stamps ngram_score 0 when no original_word is supplied
|
|
2063
|
+
stamps a non-zero ngram_score when original_word is supplied
|
|
2064
|
+
#initialize
|
|
2065
|
+
defaults max_results to 10
|
|
2066
|
+
honours an explicit enabled: false
|
|
2067
|
+
exposes the config hash
|
|
2068
|
+
defaults enabled to true when not specified
|
|
2069
|
+
defaults name to :base
|
|
2070
|
+
coerces name to a Symbol
|
|
2071
|
+
honours an explicit max_results
|
|
2072
|
+
#get_config / #has_config?
|
|
2073
|
+
returns the stored value even when it is nil
|
|
2074
|
+
returns nil when absent and no default is given
|
|
2075
|
+
returns the supplied default when absent
|
|
2076
|
+
returns the stored value when present
|
|
2077
|
+
has_config? returns true for present keys, including nil-valued
|
|
2078
|
+
#calculate_ngram_similarity
|
|
2079
|
+
is 1.0 for identical (case-insensitive) words
|
|
2080
|
+
is clamped to the 0.0..1.0 range
|
|
2081
|
+
is 0 for nil or empty inputs
|
|
2082
|
+
is higher for words that share a prefix than for words that don't
|
|
2083
|
+
#create_suggestion
|
|
2084
|
+
absorbs extra kwargs into metadata via Suggestion's catch-all
|
|
2085
|
+
builds a Suggestion tagged with the strategy name as source
|
|
2086
|
+
dictionary dispatch (private API exercised through #handles?)
|
|
2087
|
+
with an Array dictionary
|
|
2088
|
+
looks up via Array#include?
|
|
2089
|
+
with a Hash dictionary
|
|
2090
|
+
looks up via Hash#key?
|
|
2091
|
+
with a real PlainText dictionary backend
|
|
2092
|
+
looks up via the documented lookup(word) interface
|
|
2093
|
+
with a non-dictionary object
|
|
2094
|
+
surfaces a NoMethodError rather than silently returning false
|
|
2095
|
+
#priority
|
|
2096
|
+
defaults to 100
|
|
2097
|
+
honours an explicit priority
|
|
2098
|
+
#skip_when_confident?
|
|
2099
|
+
is false by default (only opt-in rerankers are cascade-skippable)
|
|
2100
|
+
#to_s / #inspect
|
|
2101
|
+
includes class name, name, and enabled flag
|
|
2102
|
+
is aliased as inspect
|
|
2103
|
+
|
|
2104
|
+
Kotoshu::Algorithms::Lookup
|
|
2105
|
+
Kotoshu::Algorithms::Lookup::CompoundPos
|
|
2106
|
+
exposes BEGIN_POS, MIDDLE, END_POS as symbols
|
|
2107
|
+
NUMBER_REGEXP
|
|
2108
|
+
matches a decimal
|
|
2109
|
+
does not match a word with digits inside
|
|
2110
|
+
does not match a bare word
|
|
2111
|
+
matches an integer
|
|
2112
|
+
CHECKCOMPOUNDPATTERN replacement, end to end
|
|
2113
|
+
bounds COMPOUNDMIN by the surface word, as Hunspell does
|
|
2114
|
+
does not choke when a member is a single character
|
|
2115
|
+
does not apply CHECKCOMPOUNDTRIPLE to a seam a replacement rebuilt
|
|
2116
|
+
treats a right-side 0 as a literal, not a wildcard
|
|
2117
|
+
accepts the same word once COMPOUNDMIN leaves room for the cut
|
|
2118
|
+
does not treat a rebuilt seam as a written word pair
|
|
2119
|
+
treats . in the right side as a single-character wildcard
|
|
2120
|
+
does not apply CHECKCOMPOUNDCASE to a seam a replacement rebuilt
|
|
2121
|
+
still forbids the unsimplified spelling the pattern rejects
|
|
2122
|
+
runs CHECKCOMPOUNDREP against the surface spelling
|
|
2123
|
+
still applies CHECKCOMPOUNDTRIPLE to an ordinary seam
|
|
2124
|
+
Kotoshu::Algorithms::Lookup::CompoundForm
|
|
2125
|
+
aliases #inspect to #to_s
|
|
2126
|
+
handles a single-part compound
|
|
2127
|
+
treats a junction past the recorded list as ordinary
|
|
2128
|
+
renders via to_s by joining parts with ' + '
|
|
2129
|
+
stores the parts array
|
|
2130
|
+
reports no junction pattern by default
|
|
2131
|
+
reports the junctions a pattern replacement built
|
|
2132
|
+
Kotoshu::Algorithms::Lookup::Lookuper
|
|
2133
|
+
#call (BREAK patterns)
|
|
2134
|
+
does NOT accept when BREAK is explicitly disabled (no defaults)
|
|
2135
|
+
accepts a word that breaks into two dictionary words
|
|
2136
|
+
#call (IGNORE chars)
|
|
2137
|
+
strips IGNORE chars from the word before lookup
|
|
2138
|
+
#good_forms
|
|
2139
|
+
yields at least one form for an in-dictionary word
|
|
2140
|
+
yields nothing for an unknown word
|
|
2141
|
+
honors affix_forms: false (compound_forms only)
|
|
2142
|
+
returns an Enumerator when no block is given
|
|
2143
|
+
yields both affix and compound forms when applicable
|
|
2144
|
+
#correct? (case variants)
|
|
2145
|
+
accepts an all-caps variant of a lowercase dictionary stem
|
|
2146
|
+
accepts a titlecase variant of a lowercase dictionary stem
|
|
2147
|
+
skips case variants when capitalization: false
|
|
2148
|
+
#correct? (basic dictionary lookup)
|
|
2149
|
+
returns false for a word not in the dictionary
|
|
2150
|
+
is aliased as #is_correct?
|
|
2151
|
+
returns true for a word directly in the dictionary
|
|
2152
|
+
#call (numerals shortcut)
|
|
2153
|
+
does not shortcut a word that merely contains digits
|
|
2154
|
+
accepts an integer as a number
|
|
2155
|
+
accepts a decimal as a number
|
|
2156
|
+
#correct? (prefix rules)
|
|
2157
|
+
accepts a word that matches a dictionary stem + prefix rule
|
|
2158
|
+
#initialize
|
|
2159
|
+
exposes aff and dic readers
|
|
2160
|
+
#call (FORBIDDENWORD top-level guard)
|
|
2161
|
+
accepts a word whose some homonym does not have FORBIDDENWORD
|
|
2162
|
+
rejects a word whose every homonym has FORBIDDENWORD
|
|
2163
|
+
#correct? (suffix + prefix cross-product)
|
|
2164
|
+
accepts a word that needs both a prefix and a suffix (crossproduct on)
|
|
2165
|
+
#call (the outermost check)
|
|
2166
|
+
returns false for an incorrect word
|
|
2167
|
+
returns true for a correct word
|
|
2168
|
+
#correct? (NOSUGGEST directive)
|
|
2169
|
+
rejects NOSUGGEST-flagged words when allow_nosuggest: false
|
|
2170
|
+
accepts NOSUGGEST-flagged words by default
|
|
2171
|
+
#break_word
|
|
2172
|
+
returns nothing (depth limit reached) when recursion exceeds depth 10
|
|
2173
|
+
yields splits by the BREAK patterns
|
|
2174
|
+
returns just [text] when no BREAK is configured
|
|
2175
|
+
always yields the whole text as the first option
|
|
2176
|
+
yields via Enumerator when no block given
|
|
2177
|
+
#correct? (suffix rules)
|
|
2178
|
+
rejects a word whose suffix does not satisfy the affix condition
|
|
2179
|
+
accepts a second-suffix derivation when nested
|
|
2180
|
+
accepts a word that matches a dictionary stem + suffix rule
|
|
2181
|
+
Kotoshu::Algorithms::Lookup::AffixForm
|
|
2182
|
+
aliases #inspect to #to_s
|
|
2183
|
+
#initialize
|
|
2184
|
+
stores text and stem, with nil affixes by default
|
|
2185
|
+
honors all kwargs
|
|
2186
|
+
#to_s
|
|
2187
|
+
returns the text alone for a base form
|
|
2188
|
+
renders prefix2 + prefix + stem + suffix2 + suffix for an affixed form
|
|
2189
|
+
#has_affixes?
|
|
2190
|
+
ignores in_dictionary (root homonym is not an affix)
|
|
2191
|
+
is true when suffix is present
|
|
2192
|
+
is false for a base form
|
|
2193
|
+
is true when prefix is present
|
|
2194
|
+
#is_base?
|
|
2195
|
+
is the inverse of has_affixes?
|
|
2196
|
+
#replace
|
|
2197
|
+
preserves fields not mentioned in changes
|
|
2198
|
+
returns a new form with one field changed (text)
|
|
2199
|
+
replaces stem
|
|
2200
|
+
replaces suffix
|
|
2201
|
+
#all_affixes
|
|
2202
|
+
compacts out nil secondary affixes
|
|
2203
|
+
is empty for a base form
|
|
2204
|
+
returns [prefix2, prefix, suffix, suffix2] in order, compacted
|
|
2205
|
+
#flags
|
|
2206
|
+
excludes secondary affix flags, matching Spylls
|
|
2207
|
+
merges suffix flags into the set
|
|
2208
|
+
merges prefix flags into the set
|
|
2209
|
+
returns an empty set when in_dictionary is nil
|
|
2210
|
+
returns the in_dictionary flags when present
|
|
2211
|
+
|
|
2212
|
+
Kotoshu::Embeddings::Vocabulary
|
|
2213
|
+
#lookup
|
|
2214
|
+
returns nil for non-existent word
|
|
2215
|
+
returns index for existing word
|
|
2216
|
+
#to_h
|
|
2217
|
+
returns a copy (not the original)
|
|
2218
|
+
returns word_to_index mapping
|
|
2219
|
+
#size
|
|
2220
|
+
returns vocabulary size
|
|
2221
|
+
.from_words
|
|
2222
|
+
creates vocabulary from array of words
|
|
2223
|
+
#words_starting_with
|
|
2224
|
+
returns empty array if no matches
|
|
2225
|
+
finds words starting with prefix
|
|
2226
|
+
#sample
|
|
2227
|
+
returns sample of words
|
|
2228
|
+
.from_file
|
|
2229
|
+
loads vocabulary from JSON file (array format)
|
|
2230
|
+
loads vocabulary from JSON file (hash format)
|
|
2231
|
+
auto-detects language from filename
|
|
2232
|
+
raises ArgumentError for non-existent file
|
|
2233
|
+
loads vocabulary from JSON file (wrapped word_to_idx format)
|
|
2234
|
+
#sub_vocabulary
|
|
2235
|
+
creates sub-vocabulary with subset of words
|
|
2236
|
+
#common_words
|
|
2237
|
+
returns first N words
|
|
2238
|
+
#empty?
|
|
2239
|
+
returns false for non-empty vocabulary
|
|
2240
|
+
#words
|
|
2241
|
+
returns enumerator of all words
|
|
2242
|
+
#to_s
|
|
2243
|
+
returns informative string representation
|
|
2244
|
+
#initialize
|
|
2245
|
+
creates vocabulary from word_to_index hash
|
|
2246
|
+
builds reverse mapping automatically
|
|
2247
|
+
raises a clear error when values are not integer indices
|
|
2248
|
+
raises error for empty word_to_index
|
|
2249
|
+
#save_to_file
|
|
2250
|
+
saves vocabulary to file
|
|
2251
|
+
#valid_index?
|
|
2252
|
+
returns false for invalid indices
|
|
2253
|
+
returns true for valid indices
|
|
2254
|
+
#get_word
|
|
2255
|
+
returns word for valid index
|
|
2256
|
+
returns nil for invalid index
|
|
2257
|
+
#include?
|
|
2258
|
+
returns false for non-existent word
|
|
2259
|
+
returns true for existing word
|
|
2260
|
+
|
|
2261
|
+
Kotoshu::Languages::English
|
|
2262
|
+
#create_spell_checker
|
|
2263
|
+
creates a Hunspell spell checker
|
|
2264
|
+
with spell checking
|
|
2265
|
+
detects misspelled words
|
|
2266
|
+
provides suggestions for misspelled words
|
|
2267
|
+
checks common words
|
|
2268
|
+
#create_tokenizer
|
|
2269
|
+
creates an English tokenizer
|
|
2270
|
+
with tokenization
|
|
2271
|
+
tokenizes English text
|
|
2272
|
+
handles contractions
|
|
2273
|
+
#initialize
|
|
2274
|
+
creates British English with en-GB code
|
|
2275
|
+
creates American English by default
|
|
2276
|
+
creates American English with en-US code
|
|
2277
|
+
#create_pos_tagger
|
|
2278
|
+
creates a Hunspell POS tagger
|
|
2279
|
+
with POS tagging
|
|
2280
|
+
tags single words
|
|
2281
|
+
#description
|
|
2282
|
+
returns full name with variant
|
|
2283
|
+
returns just name for base English
|
|
2284
|
+
#valid_in_other_variant?
|
|
2285
|
+
returns nil for en-US when only en-US is available
|
|
2286
|
+
|
|
2287
|
+
Kotoshu::Readers::PassthroughConditionChecker
|
|
2288
|
+
#matches?
|
|
2289
|
+
always returns true
|
|
2290
|
+
|
|
2291
|
+
Kotoshu::Models::Result::WordResult
|
|
2292
|
+
.correct
|
|
2293
|
+
honours the position keyword
|
|
2294
|
+
builds a correct result with no suggestions
|
|
2295
|
+
#to_s / #inspect
|
|
2296
|
+
shows 'no suggestions' when incorrect without suggestions
|
|
2297
|
+
aliases inspect to to_s
|
|
2298
|
+
shows top suggestions when incorrect with suggestions
|
|
2299
|
+
shows just the word when correct
|
|
2300
|
+
.incorrect
|
|
2301
|
+
defaults suggestions to an empty array
|
|
2302
|
+
builds an incorrect result
|
|
2303
|
+
stores the suggestions array
|
|
2304
|
+
accepts a SuggestionSet for suggestions
|
|
2305
|
+
raises ArgumentError for an unsupported suggestions type
|
|
2306
|
+
#initialize
|
|
2307
|
+
accepts metadata
|
|
2308
|
+
defaults metadata to an empty hash
|
|
2309
|
+
stringifies the word
|
|
2310
|
+
#== / #eql? / #hash
|
|
2311
|
+
is consistent with hash equality
|
|
2312
|
+
differs when the correct flag differs
|
|
2313
|
+
equals another WordResult with the same word and correct flag
|
|
2314
|
+
returns false when compared to a non-WordResult
|
|
2315
|
+
differs when the word differs
|
|
2316
|
+
#has_suggestions? / #suggestion_count
|
|
2317
|
+
reports suggestions present
|
|
2318
|
+
reports no suggestions when empty
|
|
2319
|
+
#first_suggestion
|
|
2320
|
+
returns nil when there are no suggestions
|
|
2321
|
+
returns the first suggestion's word
|
|
2322
|
+
#correct? / #incorrect?
|
|
2323
|
+
is incorrect when correct: false
|
|
2324
|
+
is correct when correct: true
|
|
2325
|
+
#top_suggestions
|
|
2326
|
+
defaults to 3
|
|
2327
|
+
returns the first n suggestion words
|
|
2328
|
+
#to_suggestion_set
|
|
2329
|
+
wraps the suggestions in a SuggestionSet
|
|
2330
|
+
|
|
2331
|
+
Kotoshu::Suggestions::Strategies::KeyboardProximityStrategy
|
|
2332
|
+
#generate
|
|
2333
|
+
returns a SuggestionSet of Suggestion objects
|
|
2334
|
+
honours a stricter max_distance by returning at most the same number of suggestions
|
|
2335
|
+
honours a stricter min_similarity by returning at most the same number of suggestions
|
|
2336
|
+
tags every suggestion with source = 'keyboard_proximity'
|
|
2337
|
+
excludes the input word from the result set
|
|
2338
|
+
returns an empty set for a nil word
|
|
2339
|
+
respects the max_distance cap: no suggestion exceeds the cap
|
|
2340
|
+
stamps original_length metadata on each suggestion
|
|
2341
|
+
KEYBOARD_LAYOUT constant
|
|
2342
|
+
lists space as having no neighbours
|
|
2343
|
+
is frozen so external mutation is impossible
|
|
2344
|
+
documents the QWERTY 'h' neighbours used by the smoke tests below
|
|
2345
|
+
#initialize
|
|
2346
|
+
is enabled by default
|
|
2347
|
+
defaults name to :keyboard_proximity
|
|
2348
|
+
honours an explicit name override
|
|
2349
|
+
ranking
|
|
2350
|
+
sorts suggestions by ascending distance
|
|
2351
|
+
smoke: typo correction via QWERTY neighbours
|
|
2352
|
+
finds single-key typo corrections for 'hello'
|
|
2353
|
+
finds single-key typo corrections for 'help'
|
|
2354
|
+
#handles?
|
|
2355
|
+
is true for a word not in the dictionary
|
|
2356
|
+
is false when the strategy is disabled
|
|
2357
|
+
is false for a word in the dictionary
|
|
2358
|
+
|
|
2359
|
+
Kotoshu::Core::Trie::Trie
|
|
2360
|
+
#clear
|
|
2361
|
+
returns self for chaining
|
|
2362
|
+
empties the trie
|
|
2363
|
+
#| (union)
|
|
2364
|
+
produces a new trie with words from both
|
|
2365
|
+
#find_node
|
|
2366
|
+
returns the terminal node for an inserted word
|
|
2367
|
+
returns nil when the prefix is absent
|
|
2368
|
+
returns an interior node for a prefix
|
|
2369
|
+
#has_prefix?
|
|
2370
|
+
returns false when no word has the prefix
|
|
2371
|
+
returns true when any word starts with the prefix
|
|
2372
|
+
#words_with_prefix
|
|
2373
|
+
returns the single word when the prefix is a full word
|
|
2374
|
+
returns all words starting with the prefix
|
|
2375
|
+
returns an empty array when no words match
|
|
2376
|
+
#& (intersection)
|
|
2377
|
+
produces a new trie with words in both
|
|
2378
|
+
#to_s / #inspect
|
|
2379
|
+
includes the size
|
|
2380
|
+
aliases inspect to to_s
|
|
2381
|
+
#initialize
|
|
2382
|
+
exposes a root Node
|
|
2383
|
+
starts empty
|
|
2384
|
+
#traverse
|
|
2385
|
+
returns an Enumerator when no block is given
|
|
2386
|
+
visits every node with its accumulated prefix
|
|
2387
|
+
#count_prefix
|
|
2388
|
+
counts words with the given prefix
|
|
2389
|
+
#merge!
|
|
2390
|
+
returns self
|
|
2391
|
+
absorbs words from the other trie
|
|
2392
|
+
#suggestions
|
|
2393
|
+
honours the max_results cap
|
|
2394
|
+
returns completions sharing the longest matching prefix
|
|
2395
|
+
#all_words
|
|
2396
|
+
returns every word in insertion traversal order
|
|
2397
|
+
returns an empty array for an empty trie
|
|
2398
|
+
#each_word
|
|
2399
|
+
yields word and payload for terminal nodes
|
|
2400
|
+
returns an Enumerator when no block is given
|
|
2401
|
+
#insert / #lookup
|
|
2402
|
+
returns self for chaining
|
|
2403
|
+
returns false for a prefix that is not itself a word
|
|
2404
|
+
increments size only for new words
|
|
2405
|
+
inserts a word and confirms it via lookup
|
|
2406
|
+
aliases has_word? and contains? to lookup
|
|
2407
|
+
returns false for a word that was never inserted
|
|
2408
|
+
|
|
2409
|
+
Kotoshu::Core::IndexedDictionary
|
|
2410
|
+
#find_by_prefix
|
|
2411
|
+
returns an empty array for no matches
|
|
2412
|
+
returns a duplicate (caller can mutate without breaking the index)
|
|
2413
|
+
honours ignore_case: true
|
|
2414
|
+
returns words starting with the prefix
|
|
2415
|
+
#find_by_length_range
|
|
2416
|
+
returns words within the inclusive range
|
|
2417
|
+
#to_trie
|
|
2418
|
+
returns a Trie containing all words
|
|
2419
|
+
#find_by_length
|
|
2420
|
+
returns words of exactly that length
|
|
2421
|
+
returns an empty array when no words match
|
|
2422
|
+
#to_s / #inspect
|
|
2423
|
+
aliases inspect to to_s
|
|
2424
|
+
includes the size
|
|
2425
|
+
#statistics
|
|
2426
|
+
reports total and unique word counts
|
|
2427
|
+
reports zero lengths for an empty dictionary
|
|
2428
|
+
reports min/max/avg lengths
|
|
2429
|
+
nests count_by_first_letter and count_by_length
|
|
2430
|
+
#initialize
|
|
2431
|
+
accepts an empty word list
|
|
2432
|
+
is not empty when words are provided
|
|
2433
|
+
counts every word including duplicates
|
|
2434
|
+
is empty when no words are provided
|
|
2435
|
+
#all_words
|
|
2436
|
+
returns every word in insertion order
|
|
2437
|
+
.from_file
|
|
2438
|
+
builds a dictionary from a word-list file, ignoring blanks and comments
|
|
2439
|
+
#count_by_first_letter
|
|
2440
|
+
returns an empty hash for an empty dictionary
|
|
2441
|
+
groups words by uppercased first letter
|
|
2442
|
+
#count_by_length
|
|
2443
|
+
groups words by length
|
|
2444
|
+
#has_word_ignorecase?
|
|
2445
|
+
returns false for a missing word
|
|
2446
|
+
matches regardless of case
|
|
2447
|
+
#add_words
|
|
2448
|
+
appends multiple words
|
|
2449
|
+
returns self for chaining
|
|
2450
|
+
#find_by_suffix
|
|
2451
|
+
honours ignore_case: true
|
|
2452
|
+
returns a duplicate (caller can mutate without breaking the index)
|
|
2453
|
+
returns an empty array for no matches
|
|
2454
|
+
returns words ending with the suffix
|
|
2455
|
+
#find_by_pattern
|
|
2456
|
+
returns an empty array when nothing matches
|
|
2457
|
+
returns words matching the regex
|
|
2458
|
+
#add_word
|
|
2459
|
+
increments size
|
|
2460
|
+
indexes the word for suffix search
|
|
2461
|
+
makes the new word findable by has_word?
|
|
2462
|
+
indexes the word for prefix search
|
|
2463
|
+
returns self for chaining
|
|
2464
|
+
#each_word
|
|
2465
|
+
yields every word when a block is given
|
|
2466
|
+
returns an Enumerator when no block is given
|
|
2467
|
+
#has_word? (case-sensitive)
|
|
2468
|
+
returns false for a missing word
|
|
2469
|
+
finds an exact word
|
|
2470
|
+
distinguishes case
|
|
2471
|
+
#lookup_ignorecase
|
|
2472
|
+
returns nil for a missing word
|
|
2473
|
+
finds the entry regardless of case
|
|
2474
|
+
#lookup
|
|
2475
|
+
returns nil for a missing word
|
|
2476
|
+
returns the entry hash for an exact match
|
|
2477
|
+
returns nil for a wrong-case word
|
|
2478
|
+
stamps the index
|
|
2479
|
+
#each_with_index
|
|
2480
|
+
returns an Enumerator when no block is given
|
|
2481
|
+
yields word and index pairs
|
|
2482
|
+
#random_words
|
|
2483
|
+
returns an empty array for an empty dictionary
|
|
2484
|
+
returns words that exist in the dictionary
|
|
2485
|
+
returns the requested count
|
|
2486
|
+
|
|
2487
|
+
Kotoshu::Keyboard::Layouts::QWERTY
|
|
2488
|
+
#position
|
|
2489
|
+
has correct position for top row (QWERTY)
|
|
2490
|
+
has correct position for number row keys
|
|
2491
|
+
has correct position for home row (ASDFG)
|
|
2492
|
+
has correct position for bottom row (ZXCVB)
|
|
2493
|
+
#distance
|
|
2494
|
+
adjacent keys
|
|
2495
|
+
returns 1 for a-s
|
|
2496
|
+
returns 1 for q-w
|
|
2497
|
+
returns 1 for z-x
|
|
2498
|
+
same row distances
|
|
2499
|
+
calculates distance across number row
|
|
2500
|
+
calculates distance across top row
|
|
2501
|
+
QWERTY-specific characteristics
|
|
2502
|
+
has z and y far apart (key difference from QWERTZ)
|
|
2503
|
+
language support
|
|
2504
|
+
does not support German
|
|
2505
|
+
is the default layout for most languages
|
|
2506
|
+
does not support Russian
|
|
2507
|
+
does not support French
|
|
2508
|
+
#initialize
|
|
2509
|
+
supports Spanish
|
|
2510
|
+
creates QWERTY layout
|
|
2511
|
+
supports US English
|
|
2512
|
+
supports English and variants
|
|
2513
|
+
supports Portuguese
|
|
2514
|
+
#adjacent_keys
|
|
2515
|
+
returns adjacent keys for home row a
|
|
2516
|
+
returns adjacent keys for q
|
|
2517
|
+
includes diagonally adjacent keys for corner positions
|
|
2518
|
+
|
|
2519
|
+
Kotoshu
|
|
2520
|
+
does something useful (spellchecking)
|
|
2521
|
+
has a version number
|
|
2522
|
+
|
|
2523
|
+
Kotoshu::Cache::ModelRegistry
|
|
2524
|
+
parses the top-level fields
|
|
2525
|
+
holds one entry per (language, tier) id
|
|
2526
|
+
.id_for
|
|
2527
|
+
is the key under which entries are stored
|
|
2528
|
+
builds the stable registry id
|
|
2529
|
+
lutaml-model round trip
|
|
2530
|
+
deserializes a raw resource hash through Resource.from_hash
|
|
2531
|
+
#find
|
|
2532
|
+
returns nil for an unknown language
|
|
2533
|
+
accepts a tier given as a symbol
|
|
2534
|
+
returns a typed resource for an existing (language, tier) pair
|
|
2535
|
+
returns nil for an unknown tier
|
|
2536
|
+
leaves nullable fields nil for the full tier
|
|
2537
|
+
#languages
|
|
2538
|
+
lists the languages the registry covers
|
|
2539
|
+
|
|
2540
|
+
Kotoshu::Keyboard::Layouts::TurkishQ
|
|
2541
|
+
language support
|
|
2542
|
+
supports tr and tr-TR
|
|
2543
|
+
does not support other languages
|
|
2544
|
+
adjacency
|
|
2545
|
+
gives the classic Turkish typo pair ı/o distance 1
|
|
2546
|
+
makes ı adjacent to u and o on the top row
|
|
2547
|
+
gives ğ and ü distance 1
|
|
2548
|
+
makes ş adjacent to l and i on the home row
|
|
2549
|
+
Turkish-specific keys
|
|
2550
|
+
places i on the semicolon key position
|
|
2551
|
+
has all six Turkish letters as real keys
|
|
2552
|
+
places the dotless ı where QWERTY has i
|
|
2553
|
+
has no semicolon or bracket keys
|
|
2554
|
+
registry integration
|
|
2555
|
+
is returned by layout_for for Turkish
|
|
2556
|
+
is found by name
|
|
2557
|
+
|
|
2558
|
+
Kotoshu::Suggestions::Generator
|
|
2559
|
+
.default_algorithms
|
|
2560
|
+
returns a duplicate of DEFAULT_ALGORITHMS
|
|
2561
|
+
freezes the source constant so external mutation is impossible
|
|
2562
|
+
#generate / #suggest
|
|
2563
|
+
returns an empty SuggestionSet for an empty word
|
|
2564
|
+
returns a non-empty SuggestionSet for a misspelled word
|
|
2565
|
+
returns Suggestion objects, not Strings, from each entry
|
|
2566
|
+
honours a per-call max_suggestions override
|
|
2567
|
+
is aliased as #suggest
|
|
2568
|
+
returns an empty SuggestionSet for a nil word
|
|
2569
|
+
.default_algorithms=
|
|
2570
|
+
is writable but does not affect the DEFAULT_ALGORITHMS constant
|
|
2571
|
+
#correct? / #incorrect?
|
|
2572
|
+
returns false for nil
|
|
2573
|
+
returns false for a word not in the dictionary
|
|
2574
|
+
is the negation of #incorrect?
|
|
2575
|
+
returns true for a word in the dictionary
|
|
2576
|
+
is aliased as #misspelled?
|
|
2577
|
+
returns false for an empty string
|
|
2578
|
+
dictionary dispatch
|
|
2579
|
+
with a non-dictionary object
|
|
2580
|
+
surfaces a NoMethodError on lookup rather than silently returning false
|
|
2581
|
+
with an Array dictionary
|
|
2582
|
+
looks up via Array#include?
|
|
2583
|
+
with a Hash dictionary
|
|
2584
|
+
looks up via Hash#key?
|
|
2585
|
+
#initialize
|
|
2586
|
+
raises ArgumentError when an algorithm is neither a Class nor a BaseStrategy
|
|
2587
|
+
accepts a pre-built strategy instance in the algorithms array
|
|
2588
|
+
forwards max_suggestions through to the strategy via Context
|
|
2589
|
+
accepts a strategy class and instantiates it with the config hash
|
|
2590
|
+
exposes the dictionary reader
|
|
2591
|
+
builds a CompositeStrategy by default
|
|
2592
|
+
composes the four default algorithm classes by default
|
|
2593
|
+
|
|
2594
|
+
Kotoshu::Cli::PersonalCommand
|
|
2595
|
+
#remove
|
|
2596
|
+
Added 3 words to /var/folders/2t/xmdrn2sd2lv2w49dv0zw9_q00000gp/T/kotoshu-personal-cli-spec20260905-34527-cexehc/personal.dic
|
|
2597
|
+
ignores words not in the dictionary
|
|
2598
|
+
Added 3 words to /var/folders/2t/xmdrn2sd2lv2w49dv0zw9_q00000gp/T/kotoshu-personal-cli-spec20260905-34527-4t5y3l/personal.dic
|
|
2599
|
+
removes words and reports the count
|
|
2600
|
+
#add
|
|
2601
|
+
adds words and reports the count
|
|
2602
|
+
raises UsageError when called with no words
|
|
2603
|
+
Added 1 word to /var/folders/2t/xmdrn2sd2lv2w49dv0zw9_q00000gp/T/kotoshu-personal-cli-spec20260905-34527-6s67if/personal.dic
|
|
2604
|
+
ignores duplicates
|
|
2605
|
+
wiring into kotoshu CLI
|
|
2606
|
+
is registered as a subcommand on Kotoshu::Cli::Cli
|
|
2607
|
+
#list
|
|
2608
|
+
Added 2 words to /var/folders/2t/xmdrn2sd2lv2w49dv0zw9_q00000gp/T/kotoshu-personal-cli-spec20260905-34527-wo64x2/personal.dic
|
|
2609
|
+
prints every word one per line
|
|
2610
|
+
prints (empty) when nothing is added
|
|
2611
|
+
#path
|
|
2612
|
+
prints the on-disk location of the personal dictionary
|
|
2613
|
+
#clear
|
|
2614
|
+
Added 2 words to /var/folders/2t/xmdrn2sd2lv2w49dv0zw9_q00000gp/T/kotoshu-personal-cli-spec20260905-34527-wqr2m9/personal.dic
|
|
2615
|
+
is a no-op when stdin returns 'n'
|
|
2616
|
+
Added 2 words to /var/folders/2t/xmdrn2sd2lv2w49dv0zw9_q00000gp/T/kotoshu-personal-cli-spec20260905-34527-oqyiin/personal.dic
|
|
2617
|
+
wipes the file when --yes is passed
|
|
2618
|
+
#import
|
|
2619
|
+
raises UsageError when a file does not exist
|
|
2620
|
+
dry_run mode lists what would be added without writing
|
|
2621
|
+
adds non-comment, non-blank lines
|
|
2622
|
+
|
|
2623
|
+
Kotoshu::Results::Result
|
|
2624
|
+
::Success
|
|
2625
|
+
supports and_then
|
|
2626
|
+
can be unwrapped
|
|
2627
|
+
is successful
|
|
2628
|
+
returns nil for error
|
|
2629
|
+
returns the wrapped value
|
|
2630
|
+
supports map
|
|
2631
|
+
does not call or_else
|
|
2632
|
+
composable operations
|
|
2633
|
+
chains multiple operations
|
|
2634
|
+
recovers from failure
|
|
2635
|
+
short-circuits on first failure
|
|
2636
|
+
::Failure
|
|
2637
|
+
returns the wrapped error
|
|
2638
|
+
returns nil for value
|
|
2639
|
+
does not call map
|
|
2640
|
+
is a failure
|
|
2641
|
+
raises error on unwrap
|
|
2642
|
+
does not call and_then
|
|
2643
|
+
supports or_else
|
|
2644
|
+
pattern matching
|
|
2645
|
+
supports case-like pattern matching
|
|
2646
|
+
|
|
2647
|
+
Kotoshu::Grammar::PatternMatchers::PhraseMatcher
|
|
2648
|
+
#match
|
|
2649
|
+
returns [] when the pattern has no phrase_check condition
|
|
2650
|
+
returns [] when the phrase is not present
|
|
2651
|
+
is case-insensitive on the wrong phrase
|
|
2652
|
+
flags every occurrence of the wrong phrase
|
|
2653
|
+
returns [] when only part of the phrase matches
|
|
2654
|
+
supports three-word phrases
|
|
2655
|
+
carries the suggestion and context in each error
|
|
2656
|
+
|
|
2657
|
+
Kotoshu::Language::Tokenizer::LatinTokenizer
|
|
2658
|
+
#tokenize
|
|
2659
|
+
handles punctuation
|
|
2660
|
+
handles contractions
|
|
2661
|
+
handles slashes and backslashes
|
|
2662
|
+
returns empty array for nil
|
|
2663
|
+
filters out single non-letter characters
|
|
2664
|
+
keeps words with accents
|
|
2665
|
+
handles mixed case
|
|
2666
|
+
filters out pure numbers
|
|
2667
|
+
returns empty array for empty string
|
|
2668
|
+
filters out empty tokens
|
|
2669
|
+
handles apostrophes within words
|
|
2670
|
+
handles parentheses and brackets
|
|
2671
|
+
handles hyphens in words
|
|
2672
|
+
returns empty array for whitespace only
|
|
2673
|
+
splits text into words
|
|
2674
|
+
#skip_token?
|
|
2675
|
+
returns true for empty string
|
|
2676
|
+
returns false for normal words
|
|
2677
|
+
returns true for tokens with no letters
|
|
2678
|
+
returns true for pure numbers
|
|
2679
|
+
returns false for words with numbers
|
|
2680
|
+
#normalize
|
|
2681
|
+
strips whitespace
|
|
2682
|
+
#word_boundary_regex
|
|
2683
|
+
returns regex for Latin characters
|
|
2684
|
+
|
|
2685
|
+
Kotoshu::Documents
|
|
2686
|
+
Kotoshu::Documents
|
|
2687
|
+
.register / .parser_for / .registered_formats
|
|
2688
|
+
parser_for returns nil for an unregistered format
|
|
2689
|
+
registers a parser class under a format symbol
|
|
2690
|
+
register accepts string format names by coercing to symbol
|
|
2691
|
+
.parse
|
|
2692
|
+
falls back to PlainTextDocument when no parser is registered
|
|
2693
|
+
uses the registered parser for the requested format
|
|
2694
|
+
forwards language_code to the parser
|
|
2695
|
+
.discovered_plugin_files / .discovered_formats
|
|
2696
|
+
discovers plugin files via Gem.find_files
|
|
2697
|
+
loads the plugin file and exposes its registered format
|
|
2698
|
+
tracks which formats came from auto-discovered plugins
|
|
2699
|
+
.reset!
|
|
2700
|
+
clears every registration
|
|
2701
|
+
clears the discovered_formats list
|
|
2702
|
+
resets the discovery flag so the next lookup re-runs discovery
|
|
2703
|
+
Kotoshu::Documents::Document
|
|
2704
|
+
rejects empty text_nodes
|
|
2705
|
+
#flattened_text
|
|
2706
|
+
is the concatenation of every text node
|
|
2707
|
+
#source_range_for
|
|
2708
|
+
spans multiple nodes when the flattened range crosses a markup boundary
|
|
2709
|
+
returns a single-node range when both offsets are inside the same node
|
|
2710
|
+
defaults the end to flattened_length when nil
|
|
2711
|
+
#source_range_at
|
|
2712
|
+
returns node A's source range for a flattened offset in node A
|
|
2713
|
+
returns nil for out-of-range offsets
|
|
2714
|
+
returns node B's source range for a flattened offset in node B (the bolded word)
|
|
2715
|
+
#flattened_length
|
|
2716
|
+
is the total character count of the flattened text
|
|
2717
|
+
#each_node
|
|
2718
|
+
yields every text node in source order
|
|
2719
|
+
returns an Enumerator when no block given
|
|
2720
|
+
Kotoshu::Documents::SourcePosition
|
|
2721
|
+
rejects negative offset
|
|
2722
|
+
returns nil <=> for non-SourcePosition
|
|
2723
|
+
rejects line < 1
|
|
2724
|
+
rejects column < 1
|
|
2725
|
+
is a frozen Struct with offset, line, column
|
|
2726
|
+
is Comparable — lexicographic by (offset, line, column)
|
|
2727
|
+
Kotoshu::Documents::SourceRange
|
|
2728
|
+
is frozen
|
|
2729
|
+
exposes start, end, and length
|
|
2730
|
+
rejects non-SourcePosition args
|
|
2731
|
+
rejects end < start
|
|
2732
|
+
#empty?
|
|
2733
|
+
is true when start == end
|
|
2734
|
+
is false otherwise
|
|
2735
|
+
#contains?
|
|
2736
|
+
is true for a position between start (inclusive) and end (exclusive)
|
|
2737
|
+
#union
|
|
2738
|
+
is reflexive — union(self) returns an equivalent range
|
|
2739
|
+
spans both ranges
|
|
2740
|
+
Kotoshu::Documents::PlainTextDocument
|
|
2741
|
+
is a Document
|
|
2742
|
+
.from_string
|
|
2743
|
+
computes the source range covering the whole string
|
|
2744
|
+
carries the language_code through
|
|
2745
|
+
wraps the entire string in one text node
|
|
2746
|
+
.from_file
|
|
2747
|
+
reads the file and wraps it
|
|
2748
|
+
Kotoshu::Documents::TextNode
|
|
2749
|
+
rejects non-SourceRange source_range
|
|
2750
|
+
rejects negative flattened_offset
|
|
2751
|
+
is a frozen Struct with text, source_range, flattened_offset, format, metadata
|
|
2752
|
+
defaults format to :plain and metadata to {}
|
|
2753
|
+
#contains_flattened?
|
|
2754
|
+
is true for offsets inside flattened_range
|
|
2755
|
+
#flattened_range
|
|
2756
|
+
returns flattened_offset...(flattened_offset + text.length)
|
|
2757
|
+
|
|
2758
|
+
Kotoshu::Models::OnnxModel
|
|
2759
|
+
.from_file
|
|
2760
|
+
raises ArgumentError when the vocab sibling is missing
|
|
2761
|
+
loads a wrapped word_to_idx vocab.json (models-repo shape)
|
|
2762
|
+
loads a flat word-to-index vocab.json
|
|
2763
|
+
|
|
2764
|
+
Kotoshu::Embeddings::SimilaritySearch
|
|
2765
|
+
#preload_embeddings!
|
|
2766
|
+
preloads all embeddings
|
|
2767
|
+
with preloaded embeddings
|
|
2768
|
+
uses preloaded embeddings for search
|
|
2769
|
+
#find_nearest
|
|
2770
|
+
returns empty array for unknown word
|
|
2771
|
+
filters by minimum similarity
|
|
2772
|
+
includes the query word when exclude_self is false
|
|
2773
|
+
returns hashes with word and similarity keys
|
|
2774
|
+
finds nearest neighbors for a word
|
|
2775
|
+
excludes the query word when exclude_self is true
|
|
2776
|
+
#cosine_similarity
|
|
2777
|
+
computes similarity for orthogonal vectors
|
|
2778
|
+
computes similarity between two vectors
|
|
2779
|
+
computes similarity for opposite vectors
|
|
2780
|
+
computes partial similarity
|
|
2781
|
+
handles nil vectors
|
|
2782
|
+
#to_s
|
|
2783
|
+
returns informative string representation
|
|
2784
|
+
#clear_cache
|
|
2785
|
+
clears the embedding cache
|
|
2786
|
+
#similarity
|
|
2787
|
+
computes similarity between two words
|
|
2788
|
+
returns nil for unknown word
|
|
2789
|
+
returns 1.0 for identical words
|
|
2790
|
+
#find_nearest_batch
|
|
2791
|
+
returns array of neighbors for each word
|
|
2792
|
+
finds neighbors for multiple words
|
|
2793
|
+
#initialize
|
|
2794
|
+
preloads embeddings when requested
|
|
2795
|
+
creates similarity search with vocabulary and model
|
|
2796
|
+
does not preload embeddings by default
|
|
2797
|
+
|
|
2798
|
+
Kotoshu::Configuration::Resolver
|
|
2799
|
+
#merge
|
|
2800
|
+
creates a new resolver with merged values
|
|
2801
|
+
does not modify the original resolver
|
|
2802
|
+
#get_all
|
|
2803
|
+
returns all priority levels for another key
|
|
2804
|
+
returns all priority levels for a key
|
|
2805
|
+
#key?
|
|
2806
|
+
returns true for keys in defaults
|
|
2807
|
+
returns true for keys in programmatic settings
|
|
2808
|
+
returns false for unknown keys
|
|
2809
|
+
returns true for keys in CLI
|
|
2810
|
+
returns true for keys in ENV
|
|
2811
|
+
#initialize
|
|
2812
|
+
creates a resolver with default empty values
|
|
2813
|
+
creates a resolver with provided values
|
|
2814
|
+
#get
|
|
2815
|
+
with all priority levels set
|
|
2816
|
+
returns CLI value when set (highest priority)
|
|
2817
|
+
with only defaults
|
|
2818
|
+
returns default value when nothing else set
|
|
2819
|
+
without CLI and ENV values
|
|
2820
|
+
returns programmatic value when CLI and ENV not set
|
|
2821
|
+
without CLI value
|
|
2822
|
+
returns ENV value when CLI not set
|
|
2823
|
+
with unknown key
|
|
2824
|
+
returns nil when key not found anywhere
|
|
2825
|
+
|
|
2826
|
+
Kotoshu::Cache::ModelCache
|
|
2827
|
+
.normalize_tier
|
|
2828
|
+
raises ArgumentError listing valid tiers for anything else
|
|
2829
|
+
accepts symbols and strings, case-insensitively
|
|
2830
|
+
#download_tiered_model
|
|
2831
|
+
raises and removes corrupt bytes when the sha256 does not match the registry
|
|
2832
|
+
falls back to the mirror when the primary 404s
|
|
2833
|
+
raises when the registry has no entry for the pair
|
|
2834
|
+
downloads, verifies, and stores the model + vocab under the tier path
|
|
2835
|
+
leaves no partial file behind when both primary and mirror fail
|
|
2836
|
+
#cached_resources
|
|
2837
|
+
lists tiered and legacy entries without the registry storage
|
|
2838
|
+
#cached_tiers
|
|
2839
|
+
lists coexisting tiers in preference order (mini first)
|
|
2840
|
+
returns an empty list when nothing is cached
|
|
2841
|
+
counts the legacy directory as :full
|
|
2842
|
+
tier -> resource id -> path mapping
|
|
2843
|
+
maps :mini and :fluency to tiered ids and sibling directories
|
|
2844
|
+
recognizes tiered ids in supports_resource? and rejects bogus tiers
|
|
2845
|
+
maps :full to the legacy id and directory (backwards compat)
|
|
2846
|
+
reports the tier of a tiered id
|
|
2847
|
+
registry storage
|
|
2848
|
+
downloads and stores the registry once, then reuses it
|
|
2849
|
+
reuses a cached registry in offline mode
|
|
2850
|
+
refuses to trust a cached registry whose bytes fail the recorded sha
|
|
2851
|
+
reuses a cached registry without fetching (unreachable URL would raise)
|
|
2852
|
+
returns nil for a pair the registry does not know
|
|
2853
|
+
raises (never fetches) when offline with no cached registry
|
|
2854
|
+
|
|
2855
|
+
Kotoshu::Cli::DirectoryWalker
|
|
2856
|
+
default skips
|
|
2857
|
+
skips hidden files and directories
|
|
2858
|
+
skips the default directories
|
|
2859
|
+
.gitignore and .ignore support
|
|
2860
|
+
never descends into ignored directories
|
|
2861
|
+
cannot re-include a file inside an ignored directory
|
|
2862
|
+
supports globstar
|
|
2863
|
+
reads .ignore with the same semantics
|
|
2864
|
+
ignores matched files
|
|
2865
|
+
scopes nested ignore files to their subtree
|
|
2866
|
+
applies the root ignore to nested paths
|
|
2867
|
+
honors negation with the last pattern winning
|
|
2868
|
+
extension selection
|
|
2869
|
+
finds files at any depth, deterministically sorted
|
|
2870
|
+
selects the known text extensions
|
|
2871
|
+
skips unknown extensions
|
|
2872
|
+
--include and --exclude
|
|
2873
|
+
matches slashless globs against the basename at any depth
|
|
2874
|
+
matches slashed globs against the path from the root
|
|
2875
|
+
checks non-text files when included explicitly
|
|
2876
|
+
excludes always win over the extension default
|
|
2877
|
+
excludes win over includes
|
|
2878
|
+
replaces the extension default with include globs
|
|
2879
|
+
|
|
2880
|
+
Kotoshu::Language::Normalizer::Base
|
|
2881
|
+
#normalize_word
|
|
2882
|
+
normalizes single word
|
|
2883
|
+
#normalize_whitespace
|
|
2884
|
+
collapses multiple spaces
|
|
2885
|
+
strips leading and trailing
|
|
2886
|
+
converts various space characters
|
|
2887
|
+
#remove_accents
|
|
2888
|
+
preserves non-accented characters
|
|
2889
|
+
removes accents from characters
|
|
2890
|
+
handles German umlauts
|
|
2891
|
+
#normalize
|
|
2892
|
+
strips leading and trailing whitespace
|
|
2893
|
+
collapses multiple whitespace
|
|
2894
|
+
handles nil
|
|
2895
|
+
downcases by default
|
|
2896
|
+
handles empty string
|
|
2897
|
+
combines options
|
|
2898
|
+
with downcase: false
|
|
2899
|
+
preserves case
|
|
2900
|
+
with strip_punct: true
|
|
2901
|
+
removes punctuation
|
|
2902
|
+
with collapse_ws: false
|
|
2903
|
+
preserves multiple spaces
|
|
2904
|
+
#normalize_quotes
|
|
2905
|
+
converts backticks
|
|
2906
|
+
converts curly quotes to straight
|
|
2907
|
+
#normalized_eql?
|
|
2908
|
+
returns true for equal strings
|
|
2909
|
+
returns false for different words
|
|
2910
|
+
returns true for strings with different whitespace
|
|
2911
|
+
#strip_punctuation
|
|
2912
|
+
removes punctuation
|
|
2913
|
+
preserves whitespace
|
|
2914
|
+
preserves letters and numbers
|
|
2915
|
+
|
|
2916
|
+
Kotoshu::Grammar
|
|
2917
|
+
Kotoshu::Grammar::PatternMatchers::PossessiveContextMatcher
|
|
2918
|
+
flags "there" + NOUN pos-tag
|
|
2919
|
+
flags "there" + possessive-noun-list word (word-list fallback)
|
|
2920
|
+
flags "there" + ADJ pos-tag
|
|
2921
|
+
flags "there" + NOUN_PROPER pos-tag
|
|
2922
|
+
does not flag when 'there' is the last token
|
|
2923
|
+
does NOT flag "there" + verb (location context)
|
|
2924
|
+
reports the rule's suggestion and message verbatim
|
|
2925
|
+
matches 'there' case-insensitively
|
|
2926
|
+
Kotoshu::Grammar::PatternMatchers::VowelSoundMatcher
|
|
2927
|
+
passes through correct usage
|
|
2928
|
+
flags "an" before a consonant-initial word
|
|
2929
|
+
ignores empty/nil next-word tokens
|
|
2930
|
+
interpolates {expected} and {word} into the rule message
|
|
2931
|
+
flags multiple "a elephant" pairs in the same stream
|
|
2932
|
+
respects silent-consonant exceptions (uses 'an' before 'hour')
|
|
2933
|
+
ignores the article when its pos_tag is non-DET and non-nil
|
|
2934
|
+
flags "a" before a vowel-initial word
|
|
2935
|
+
respects consonant-sound exceptions (uses 'a' before 'unicorn')
|
|
2936
|
+
Kotoshu::Grammar::PatternMatchers::DoubleNegativeMatcher
|
|
2937
|
+
still fires for negatives outside an unclosed 'not only'
|
|
2938
|
+
flags contractions ending in "n't"
|
|
2939
|
+
aggregates multiple negative pairs
|
|
2940
|
+
flags two negatives within the max-distance window
|
|
2941
|
+
does not flag two negatives outside the window
|
|
2942
|
+
uses the rule's message and suggestion verbatim
|
|
2943
|
+
ignores empty/nil words
|
|
2944
|
+
suppresses negatives inside the 'not only...but also' correlative
|
|
2945
|
+
recognizes the full negative word list
|
|
2946
|
+
Kotoshu::Grammar::PatternMatchers::BaseMatcher
|
|
2947
|
+
#extract_tokens_from_context (protected)
|
|
2948
|
+
is exposed for subclass reuse
|
|
2949
|
+
matches case-insensitively
|
|
2950
|
+
#match
|
|
2951
|
+
returns an empty array by default (subclass responsibility)
|
|
2952
|
+
Kotoshu::Grammar::RuleEngine
|
|
2953
|
+
#rule_exists?
|
|
2954
|
+
is true for a loaded rule
|
|
2955
|
+
is false for an unknown rule
|
|
2956
|
+
#get_rule
|
|
2957
|
+
returns the rule with the given id
|
|
2958
|
+
returns nil for an unknown id
|
|
2959
|
+
rules_path resolution
|
|
2960
|
+
joins dictionaries_base/<language>/grammar when no rules_path is given
|
|
2961
|
+
#check
|
|
2962
|
+
returns [] when no rules fire
|
|
2963
|
+
runs every loaded rule and aggregates errors
|
|
2964
|
+
#rule_names
|
|
2965
|
+
returns the list of rule ids
|
|
2966
|
+
#initialize
|
|
2967
|
+
exposes the language code
|
|
2968
|
+
loads rules eagerly from rules_path
|
|
2969
|
+
Kotoshu::Grammar::RuleLoader
|
|
2970
|
+
returns [] when rules.yaml is empty
|
|
2971
|
+
defaults exceptions to {} when not present in a rule config
|
|
2972
|
+
returns [] when rules.yaml has a null rules value
|
|
2973
|
+
returns [] when rules.yaml has no 'rules' key
|
|
2974
|
+
loads rules from rules.yaml
|
|
2975
|
+
returns [] when rules.yaml does not exist
|
|
2976
|
+
Kotoshu::Grammar::Rule
|
|
2977
|
+
#check
|
|
2978
|
+
aggregates errors from every pattern
|
|
2979
|
+
falls back to BaseMatcher for an unknown condition type
|
|
2980
|
+
returns an empty array when there are no patterns
|
|
2981
|
+
uses BaseMatcher when conditions is empty
|
|
2982
|
+
selects the matcher based on condition type
|
|
2983
|
+
.from_yaml
|
|
2984
|
+
builds a Rule from a YAML-shaped config hash
|
|
2985
|
+
defaults exceptions to {} when not provided
|
|
2986
|
+
|
|
2987
|
+
Kotoshu::Tasks::CheckTask
|
|
2988
|
+
uses the plan-88 file selection over the root
|
|
2989
|
+
defines kotoshu:check when kotoshu/tasks is required
|
|
2990
|
+
kotoshu: 1 spelling error(s) in 1 file(s)
|
|
2991
|
+
prints errors and aborts when a file has misspellings
|
|
2992
|
+
succeeds quietly for clean trees
|
|
2993
|
+
honors an explicit file list and fail_on_error = false
|
|
2994
|
+
|
|
2995
|
+
Kotoshu::Cache::LookupCache
|
|
2996
|
+
#delete
|
|
2997
|
+
removes a key from cache
|
|
2998
|
+
does nothing for nonexistent key
|
|
2999
|
+
#clear
|
|
3000
|
+
removes all entries
|
|
3001
|
+
#size
|
|
3002
|
+
returns number of entries
|
|
3003
|
+
LRU eviction
|
|
3004
|
+
evicts least recently used entries when max size reached
|
|
3005
|
+
updates LRU order on read
|
|
3006
|
+
#stats
|
|
3007
|
+
returns cache statistics
|
|
3008
|
+
tracks hits and misses
|
|
3009
|
+
#reset_stats
|
|
3010
|
+
resets statistics counters
|
|
3011
|
+
#key?
|
|
3012
|
+
returns false for missing key
|
|
3013
|
+
returns true for existing key
|
|
3014
|
+
#initialize
|
|
3015
|
+
creates cache with default max size
|
|
3016
|
+
creates cache with custom max size
|
|
3017
|
+
#write
|
|
3018
|
+
stores a value
|
|
3019
|
+
overwrites existing value
|
|
3020
|
+
#read
|
|
3021
|
+
returns stored value
|
|
3022
|
+
returns nil for missing key
|
|
3023
|
+
#fetch
|
|
3024
|
+
stores and retrieves values
|
|
3025
|
+
returns cached value without executing block
|
|
3026
|
+
calls block only on cache miss
|
|
3027
|
+
|
|
3028
|
+
Kotoshu::Spellchecker::ParallelChecker
|
|
3029
|
+
thread safety
|
|
3030
|
+
handles concurrent file checking safely
|
|
3031
|
+
#check_files_parallel
|
|
3032
|
+
finds errors in files
|
|
3033
|
+
checks multiple files in parallel
|
|
3034
|
+
returns empty results for empty file list
|
|
3035
|
+
handles single file
|
|
3036
|
+
#check_file
|
|
3037
|
+
checks a single file
|
|
3038
|
+
#initialize
|
|
3039
|
+
creates checker with custom worker count
|
|
3040
|
+
creates checker with default worker count
|
|
3041
|
+
|
|
3042
|
+
Kotoshu::Keyboard::Layouts::Ukrainian
|
|
3043
|
+
adjacency
|
|
3044
|
+
gives the common typo pair и/т distance 1
|
|
3045
|
+
keeps the JCUKEN top-row order ц у к
|
|
3046
|
+
makes і adjacent to ф and в
|
|
3047
|
+
language support
|
|
3048
|
+
does not support Russian
|
|
3049
|
+
supports uk and uk-UA
|
|
3050
|
+
registry integration
|
|
3051
|
+
is returned by layout_for for Ukrainian
|
|
3052
|
+
Ukrainian-specific keys
|
|
3053
|
+
has all four Ukrainian-only letters as real keys
|
|
3054
|
+
has no Russian-only keys
|
|
3055
|
+
places ґ two keys right of х, beside ї
|
|
3056
|
+
places і where Russian JCUKEN has ы
|
|
3057
|
+
|
|
3058
|
+
Kotoshu::Models::Result::DocumentResult
|
|
3059
|
+
#== / #eql? / #hash
|
|
3060
|
+
returns false when compared to a non-DocumentResult
|
|
3061
|
+
differs when the file differs
|
|
3062
|
+
equals another DocumentResult with same file and errors
|
|
3063
|
+
.success
|
|
3064
|
+
builds a result with no errors
|
|
3065
|
+
#first_errors
|
|
3066
|
+
defaults to 10
|
|
3067
|
+
returns the first n errors
|
|
3068
|
+
#initialize
|
|
3069
|
+
accepts file, errors, word_count, and metadata
|
|
3070
|
+
defaults sensibly
|
|
3071
|
+
.failure
|
|
3072
|
+
builds a result with the given errors
|
|
3073
|
+
#each_error
|
|
3074
|
+
yields each error
|
|
3075
|
+
returns an Enumerator when no block is given
|
|
3076
|
+
.merge
|
|
3077
|
+
returns an empty result when the array is empty
|
|
3078
|
+
combines multiple DocumentResults into one
|
|
3079
|
+
#has_error_for? / #errors_for
|
|
3080
|
+
reports whether a word has any error entries
|
|
3081
|
+
returns the matching WordResult entries
|
|
3082
|
+
#error_summary
|
|
3083
|
+
is empty for a successful result
|
|
3084
|
+
builds a Hash of word => occurrence count
|
|
3085
|
+
#error_count / #unique_error_count
|
|
3086
|
+
counts total and unique errors
|
|
3087
|
+
#success? / #failed?
|
|
3088
|
+
is success when errors are empty
|
|
3089
|
+
is failed when errors are present
|
|
3090
|
+
#to_s / #inspect
|
|
3091
|
+
reports 'no errors' for a successful result with a file
|
|
3092
|
+
reports counts for a failed result
|
|
3093
|
+
reports 'no errors' for a successful result without a file
|
|
3094
|
+
aliases inspect to to_s
|
|
3095
|
+
#each_unique_error
|
|
3096
|
+
yields (word, [WordResult, ...]) pairs grouped by word
|
|
3097
|
+
returns an Enumerator when no block is given
|
|
3098
|
+
|
|
3099
|
+
Kotoshu::Language::Segment
|
|
3100
|
+
exposes language_code, text_nodes, confidence
|
|
3101
|
+
#flattened_text
|
|
3102
|
+
concatenates every node's text
|
|
3103
|
+
#empty?
|
|
3104
|
+
is true when text_nodes is empty
|
|
3105
|
+
|
|
3106
|
+
Kotoshu::Algorithms::PhonetSuggest
|
|
3107
|
+
.suggest
|
|
3108
|
+
returns an Enumerator-like interface via the block
|
|
3109
|
+
yields suggestions as strings
|
|
3110
|
+
yields at least one suggestion when a phonetically similar stem exists
|
|
3111
|
+
MAX_ROOTS constant
|
|
3112
|
+
is 100
|
|
3113
|
+
.metaphone
|
|
3114
|
+
skips characters with no matching rule
|
|
3115
|
+
returns the word unchanged when the table is nil
|
|
3116
|
+
applies a single literal-letter rule
|
|
3117
|
+
returns the word unchanged when the table is empty
|
|
3118
|
+
handles multi-character search patterns
|
|
3119
|
+
is case-insensitive on input — uppercases the word before matching
|
|
3120
|
+
.final_score
|
|
3121
|
+
is positive for identical words
|
|
3122
|
+
factors in the left-common-substring bonus
|
|
3123
|
+
gives a higher score to more similar words
|
|
3124
|
+
.match_rule
|
|
3125
|
+
returns nil when the pattern does not match
|
|
3126
|
+
end-anchored rule matches from the given position to end of word
|
|
3127
|
+
returns nil when start-anchored rule is invoked past position 0
|
|
3128
|
+
returns the match length for a matching unanchored rule
|
|
3129
|
+
allows start-anchored rule at position 0
|
|
3130
|
+
|
|
3131
|
+
Kotoshu::Suggestions::Strategies::SymSpellStrategy
|
|
3132
|
+
#generate
|
|
3133
|
+
includes words with 1 deletion distance
|
|
3134
|
+
handles case-insensitive matching
|
|
3135
|
+
returns suggestions sorted by distance
|
|
3136
|
+
returns empty set for words with no close matches
|
|
3137
|
+
respects max_results config
|
|
3138
|
+
generates suggestions for a misspelled word
|
|
3139
|
+
#initialize
|
|
3140
|
+
accepts max_deletion_distance config
|
|
3141
|
+
creates a strategy with default config
|
|
3142
|
+
#handles?
|
|
3143
|
+
returns false when strategy is disabled
|
|
3144
|
+
returns true when word is not in dictionary
|
|
3145
|
+
returns false when word is in dictionary
|
|
3146
|
+
#deletion_distance
|
|
3147
|
+
calculates deletion distance between words
|
|
3148
|
+
returns correct distance for multiple deletions
|
|
3149
|
+
returns 0 for identical words
|
|
3150
|
+
|
|
3151
|
+
Kotoshu::Languages::Greek
|
|
3152
|
+
registry
|
|
3153
|
+
registers el and el-GR
|
|
3154
|
+
Greek-aware normalization
|
|
3155
|
+
does not touch medial sigma
|
|
3156
|
+
folds uppercase words with the final sigma
|
|
3157
|
+
keeps lowercase final sigma untouched
|
|
3158
|
+
strips accents only when asked
|
|
3159
|
+
Greek tokenizer
|
|
3160
|
+
keeps Greek-script words the Latin tokenizer would drop
|
|
3161
|
+
rejects tokens without Greek letters
|
|
3162
|
+
splits a real Greek sentence on Greek punctuation
|
|
3163
|
+
is a GreekTokenizer
|
|
3164
|
+
|
|
3165
|
+
Kotoshu::Grammar::PatternMatchers::PossessiveContractionMatcher
|
|
3166
|
+
emits once per occurrence (multiple "its" in stream)
|
|
3167
|
+
does not emit when the target token is absent
|
|
3168
|
+
handles case-insensitively (Its/ITS match target "its")
|
|
3169
|
+
does not emit when target is the last token
|
|
3170
|
+
does not emit when the target is followed by a non-trigger token
|
|
3171
|
+
emits an error when target is followed by a trigger word
|
|
3172
|
+
emits an error when target is followed by a trigger tag
|
|
3173
|
+
|
|
3174
|
+
Kotoshu::ConformanceRunner
|
|
3175
|
+
#run
|
|
3176
|
+
fails loudly when native is requested without the extension
|
|
3177
|
+
records a failure for every row that diverges from its expectation
|
|
3178
|
+
replays every vector through the native backend with zero failures (PENDING: native extension not built (rake compile))
|
|
3179
|
+
replays every vector through the ruby backend with zero failures
|
|
3180
|
+
default path
|
|
3181
|
+
points at the committed vectors file
|
|
3182
|
+
#compare
|
|
3183
|
+
reports zero divergences when both backends agree (PENDING: native extension not built (rake compile))
|
|
3184
|
+
|
|
3185
|
+
Kotoshu::Suggestions::SemanticCascade
|
|
3186
|
+
#skip?
|
|
3187
|
+
at a mid threshold
|
|
3188
|
+
skips when the top confidence is at or above the threshold
|
|
3189
|
+
does not skip when the top confidence is below the threshold
|
|
3190
|
+
judges by the top candidate, not the rest of the pool
|
|
3191
|
+
does not skip an empty pool
|
|
3192
|
+
at threshold 0.0 (never rerank)
|
|
3193
|
+
skips any non-empty pool, even a low-confidence one
|
|
3194
|
+
does not skip an empty pool (traditional found nothing)
|
|
3195
|
+
at the default threshold of 1.0
|
|
3196
|
+
never skips, even for a top candidate with confidence exactly 1.0
|
|
3197
|
+
#armed?
|
|
3198
|
+
is false at the default threshold (always rerank)
|
|
3199
|
+
is false above 1.0 (never skips)
|
|
3200
|
+
is true for any threshold strictly below 1.0
|
|
3201
|
+
#initialize
|
|
3202
|
+
coerces non-Float thresholds (e.g. ENV strings) to Float
|
|
3203
|
+
defaults to the always-rerank threshold
|
|
3204
|
+
falls back to always-rerank for a nil threshold
|
|
3205
|
+
.from_configuration
|
|
3206
|
+
reads a programmatic threshold from the Configuration
|
|
3207
|
+
reads KOTOSHU_SEMANTIC_CASCADE_THRESHOLD and converts it to Float
|
|
3208
|
+
reads the SCHEMA default (1.0) from a fresh Configuration
|
|
3209
|
+
|
|
3210
|
+
Unit: Hunspell FileReader
|
|
3211
|
+
#encodings
|
|
3212
|
+
handles Windows-1251 encoding
|
|
3213
|
+
#bom
|
|
3214
|
+
handles UTF-8 BOM
|
|
3215
|
+
#stringio
|
|
3216
|
+
reads from a string
|
|
3217
|
+
#lines
|
|
3218
|
+
reads lines from a basic UTF-8 file
|
|
3219
|
+
|
|
3220
|
+
Kotoshu::Suggestions::Strategies::EditDistanceStrategy
|
|
3221
|
+
English language behavior
|
|
3222
|
+
with keyboard proximity errors
|
|
3223
|
+
recognizes adjacent key substitutions on QWERTY
|
|
3224
|
+
ranks adjacent-key substitutions higher than distant-key substitutions
|
|
3225
|
+
with transposition errors
|
|
3226
|
+
ranks "world" first for "wrold"
|
|
3227
|
+
gives "world" highest confidence for "wrold"
|
|
3228
|
+
with missing double letters
|
|
3229
|
+
ranks "hello" above "help" for "helo"
|
|
3230
|
+
ranks "hello" first for "helo"
|
|
3231
|
+
gives "hello" highest confidence for "helo"
|
|
3232
|
+
with common English words
|
|
3233
|
+
gives frequency bonus to common words
|
|
3234
|
+
integration with other strategies
|
|
3235
|
+
provides source information
|
|
3236
|
+
includes metadata in suggestions
|
|
3237
|
+
produces suggestions compatible with SuggestionSet
|
|
3238
|
+
edge cases
|
|
3239
|
+
handles special characters
|
|
3240
|
+
handles very long word
|
|
3241
|
+
handles empty word
|
|
3242
|
+
handles single character word
|
|
3243
|
+
handles unicode characters
|
|
3244
|
+
multi-language support
|
|
3245
|
+
with Russian language
|
|
3246
|
+
selects the JCUKEN keyboard layout
|
|
3247
|
+
with French language
|
|
3248
|
+
generates a suggestion for a French typo
|
|
3249
|
+
selects the AZERTY keyboard layout
|
|
3250
|
+
with German language
|
|
3251
|
+
treats z and y as adjacent on QWERTZ (transposition bonus)
|
|
3252
|
+
selects the QWERTZ keyboard layout
|
|
3253
|
+
generates a suggestion for a German typo
|
|
3254
|
+
with English language
|
|
3255
|
+
selects the QWERTY keyboard layout as the default
|
|
3256
|
+
core algorithm (language-agnostic)
|
|
3257
|
+
#edit_distance_with_threshold
|
|
3258
|
+
returns nil when exceeding threshold
|
|
3259
|
+
returns 0 when threshold is 0 and words match
|
|
3260
|
+
returns distance when within threshold
|
|
3261
|
+
#calculate_ngram_similarity
|
|
3262
|
+
returns 1.0 for identical words
|
|
3263
|
+
gives high similarity for words with common suffix
|
|
3264
|
+
gives high similarity for words with common prefix
|
|
3265
|
+
handles words with character overlap
|
|
3266
|
+
returns 0.0 for completely different words
|
|
3267
|
+
#edit_distance
|
|
3268
|
+
calculates Levenshtein distance correctly
|
|
3269
|
+
calculates distance for deletions
|
|
3270
|
+
calculates distance for insertions
|
|
3271
|
+
handles empty strings
|
|
3272
|
+
calculates distance for substitutions
|
|
3273
|
+
handles transpositions correctly (Damerau-Levenshtein)
|
|
3274
|
+
#typo_pattern_bonus
|
|
3275
|
+
with missing double letters
|
|
3276
|
+
detects missing double letter at end of word
|
|
3277
|
+
does not give bonus when no double letter exists
|
|
3278
|
+
detects missing double letter in middle of word
|
|
3279
|
+
with extra double letters
|
|
3280
|
+
does not give bonus for single deletions
|
|
3281
|
+
detects extra double letter
|
|
3282
|
+
#transposition_bonus
|
|
3283
|
+
detects single transposition
|
|
3284
|
+
gives higher bonus for single transposition than multiple
|
|
3285
|
+
returns 0 when no transposition exists
|
|
3286
|
+
#calculate_enhanced_score
|
|
3287
|
+
combines multiple scoring factors
|
|
3288
|
+
gives lower score (better) for common typo patterns
|
|
3289
|
+
penalizes length differences
|
|
3290
|
+
#keyboard_penalty
|
|
3291
|
+
with QWERTY layout
|
|
3292
|
+
gives low penalty for adjacent key substitutions
|
|
3293
|
+
returns 0 when no substitutions exist
|
|
3294
|
+
gives high penalty for distant key substitutions
|
|
3295
|
+
threshold filtering
|
|
3296
|
+
filters out low-similarity suggestions
|
|
3297
|
+
respects min_results configuration even with threshold
|
|
3298
|
+
filters by confidence threshold as well
|
|
3299
|
+
|
|
3300
|
+
Kotoshu::PersonalDictionary
|
|
3301
|
+
.remove_word
|
|
3302
|
+
returns false for non-existent word
|
|
3303
|
+
removes a word from personal dictionary
|
|
3304
|
+
.add_word
|
|
3305
|
+
normalizes to lowercase
|
|
3306
|
+
adds a word to personal dictionary
|
|
3307
|
+
prevents duplicates
|
|
3308
|
+
.words
|
|
3309
|
+
returns all personal words
|
|
3310
|
+
.include?
|
|
3311
|
+
returns true for added words
|
|
3312
|
+
is case-insensitive
|
|
3313
|
+
|
|
3314
|
+
keyboard layout sync with the models repo eval grids
|
|
3315
|
+
keeps every eval grid key on the gem layout at the same position
|
|
3316
|
+
can rank the eval grids common typo neighbors
|
|
3317
|
+
keeps the committed fixture in sync with the live eval grids (PENDING: models repo absent or predates the wave-1 grids)
|
|
3318
|
+
|
|
3319
|
+
Kotoshu::Components::WhitespaceTokenizer
|
|
3320
|
+
#pattern
|
|
3321
|
+
returns the token pattern
|
|
3322
|
+
can use a custom pattern
|
|
3323
|
+
behaves like a tokenizer
|
|
3324
|
+
handles text with only whitespace
|
|
3325
|
+
tokenizes text
|
|
3326
|
+
handles empty text
|
|
3327
|
+
handles nil text
|
|
3328
|
+
can tokenize to strings
|
|
3329
|
+
returns hashes with token, position, length
|
|
3330
|
+
#punctuation?
|
|
3331
|
+
returns false for word characters
|
|
3332
|
+
returns true for punctuation
|
|
3333
|
+
#tokenize_to_strings
|
|
3334
|
+
returns just the token strings
|
|
3335
|
+
#tokenize
|
|
3336
|
+
splits on whitespace and separates punctuation
|
|
3337
|
+
handles tabs
|
|
3338
|
+
includes position information
|
|
3339
|
+
handles multiple spaces
|
|
3340
|
+
handles special characters
|
|
3341
|
+
preserves contractions
|
|
3342
|
+
handles numbers
|
|
3343
|
+
handles newlines
|
|
3344
|
+
#word_char?
|
|
3345
|
+
returns true for underscore
|
|
3346
|
+
returns false for punctuation
|
|
3347
|
+
returns true for letters
|
|
3348
|
+
returns true for numbers
|
|
3349
|
+
returns false for spaces
|
|
3350
|
+
|
|
3351
|
+
Kotoshu::Suggestions::Suggestion
|
|
3352
|
+
lutaml-model serialization
|
|
3353
|
+
to_json round-trips through parse (smoke-level)
|
|
3354
|
+
round-trips a Suggestion through from_hash
|
|
3355
|
+
to_hash exposes word/distance/confidence/source as strings/numbers
|
|
3356
|
+
#initialize
|
|
3357
|
+
coerces source to a string for clean serialization
|
|
3358
|
+
absorbs extra kwargs into the metadata hash (legacy catch-all)
|
|
3359
|
+
accepts word, distance, confidence, source as keyword args
|
|
3360
|
+
defaults distance to 0, confidence to 1.0, source to 'unknown'
|
|
3361
|
+
#to_s / #inspect
|
|
3362
|
+
renders a readable summary
|
|
3363
|
+
inspect is aliased to to_s
|
|
3364
|
+
#combined_score
|
|
3365
|
+
honors custom distance_weight / confidence_weight
|
|
3366
|
+
weights distance (low is good) and confidence (high is good)
|
|
3367
|
+
.from_word
|
|
3368
|
+
accepts a custom source
|
|
3369
|
+
builds a confidence-1.0, distance-0 Suggestion from a word
|
|
3370
|
+
#<=> (sort order)
|
|
3371
|
+
breaks ties on distance (lower wins)
|
|
3372
|
+
uses alphabetical (case-insensitive) only as the final tiebreaker
|
|
3373
|
+
sorts higher combined_score first
|
|
3374
|
+
is nil-safe (returns nil for non-Suggestion)
|
|
3375
|
+
breaks further ties on length similarity to original
|
|
3376
|
+
breaks further ties on ngram_score (higher wins)
|
|
3377
|
+
#from_source?
|
|
3378
|
+
returns false on a different source
|
|
3379
|
+
matches Symbol source against the stored String
|
|
3380
|
+
#same_word?
|
|
3381
|
+
matches against another Suggestion case-insensitively
|
|
3382
|
+
matches against a String case-insensitively
|
|
3383
|
+
#high_confidence? / #low_confidence?
|
|
3384
|
+
high_confidence? is false below 0.8
|
|
3385
|
+
low_confidence? is true strictly below 0.5
|
|
3386
|
+
high_confidence? is true at exactly 0.8 (inclusive)
|
|
3387
|
+
low_confidence? is false at exactly 0.5
|
|
3388
|
+
#== / #eql? / #hash
|
|
3389
|
+
== compares words case-insensitively
|
|
3390
|
+
hash is consistent with == (case-insensitive word)
|
|
3391
|
+
hash can be used as a Hash key without collisions across cases
|
|
3392
|
+
== returns false against non-Suggestion
|
|
3393
|
+
eql? is aliased to ==
|
|
3394
|
+
|
|
3395
|
+
EditDistanceStrategy length filter (perf optimization)
|
|
3396
|
+
returns the same candidates regardless of length filter (property: soundness)
|
|
3397
|
+
does not crash on very long input (length filter handles it)
|
|
3398
|
+
still finds candidates of varying lengths (within max_dist)
|
|
3399
|
+
|
|
3400
|
+
Kotoshu::Cache::BaseCache#evict
|
|
3401
|
+
removes the evicted directories when not a dry run
|
|
3402
|
+
skips directories that have no metadata.json
|
|
3403
|
+
treats a corrupt metadata.json as oldest (sorted first for eviction)
|
|
3404
|
+
plans to evict the oldest entry when the cap is exceeded (dry_run)
|
|
3405
|
+
respects the configured max_cache_size on the instance
|
|
3406
|
+
returns a no-op plan when nothing exceeds the cap (dry_run)
|
|
3407
|
+
|
|
3408
|
+
Kotoshu::Language::Tokenizer::Base
|
|
3409
|
+
#skip_token?
|
|
3410
|
+
returns true for pure numbers
|
|
3411
|
+
returns true for empty string
|
|
3412
|
+
returns false for normal words
|
|
3413
|
+
#normalize
|
|
3414
|
+
returns input unchanged by default
|
|
3415
|
+
#word_char?
|
|
3416
|
+
returns true for word characters
|
|
3417
|
+
returns false for non-word characters
|
|
3418
|
+
#tokenize_with_positions
|
|
3419
|
+
returns empty array for nil
|
|
3420
|
+
returns empty array for empty string
|
|
3421
|
+
handles text with only whitespace
|
|
3422
|
+
#tokenize
|
|
3423
|
+
raises NotImplementedError
|
|
3424
|
+
|
|
3425
|
+
Kotoshu::StringMetrics
|
|
3426
|
+
integration tests
|
|
3427
|
+
shows low similarity for dissimilar words
|
|
3428
|
+
combines metrics for word similarity scoring
|
|
3429
|
+
.leftcommonsubstring
|
|
3430
|
+
returns shorter string length when one is prefix of other
|
|
3431
|
+
returns 0 for completely different strings
|
|
3432
|
+
returns full length when strings match
|
|
3433
|
+
handles empty strings
|
|
3434
|
+
calculates common prefix length
|
|
3435
|
+
.ngram
|
|
3436
|
+
basic n-gram calculation
|
|
3437
|
+
calculates n-gram similarity
|
|
3438
|
+
handles identical strings
|
|
3439
|
+
returns 0 for empty second string
|
|
3440
|
+
handles completely different strings
|
|
3441
|
+
with longer_worse: true
|
|
3442
|
+
does not penalize small length differences
|
|
3443
|
+
penalizes when second string is significantly longer
|
|
3444
|
+
with weighted: true
|
|
3445
|
+
penalizes missing n-grams
|
|
3446
|
+
penalizes missing prefix/suffix n-grams more
|
|
3447
|
+
real-world examples
|
|
3448
|
+
handles transposition errors
|
|
3449
|
+
handles similar words with typos
|
|
3450
|
+
handles extra letter
|
|
3451
|
+
handles missing letter
|
|
3452
|
+
with any_mismatch: true
|
|
3453
|
+
does not penalize small length differences
|
|
3454
|
+
penalizes significant length differences
|
|
3455
|
+
.commoncharacters
|
|
3456
|
+
handles strings of different lengths
|
|
3457
|
+
handles empty strings
|
|
3458
|
+
handles nil values
|
|
3459
|
+
counts matching characters at same positions
|
|
3460
|
+
.lcslen
|
|
3461
|
+
handles one string being subsequence of other
|
|
3462
|
+
calculates longest common subsequence length
|
|
3463
|
+
handles empty strings
|
|
3464
|
+
handles completely different strings
|
|
3465
|
+
handles identical strings
|
|
3466
|
+
handles common subsequences at different positions
|
|
3467
|
+
real-world spelling correction examples
|
|
3468
|
+
finds common subsequence in similar words
|
|
3469
|
+
handles insertion/deletion
|
|
3470
|
+
handles transposition
|
|
3471
|
+
|
|
3472
|
+
Kotoshu::Integrity
|
|
3473
|
+
Kotoshu::Integrity::AuditLog
|
|
3474
|
+
#entries
|
|
3475
|
+
returns the array form of #each
|
|
3476
|
+
is empty when no entries have been recorded
|
|
3477
|
+
.default_path
|
|
3478
|
+
returns the Paths.audit_log_path
|
|
3479
|
+
#each
|
|
3480
|
+
preserves every entry when capacity exceeds the total payload
|
|
3481
|
+
iterates entries newest-first across current + rotations
|
|
3482
|
+
returns an Enumerator when no block is given
|
|
3483
|
+
#clear!
|
|
3484
|
+
removes the current log and all rotations
|
|
3485
|
+
is safe to call on an empty log
|
|
3486
|
+
#record
|
|
3487
|
+
creates the parent directory when missing
|
|
3488
|
+
returns the written entry hash
|
|
3489
|
+
writes one JSON object per line
|
|
3490
|
+
appends multiple entries
|
|
3491
|
+
rotation integration
|
|
3492
|
+
never grows beyond the configured bound across many writes
|
|
3493
|
+
renames the current file to .1 when the policy says rotate
|
|
3494
|
+
Kotoshu::Integrity::Manifest
|
|
3495
|
+
#empty?
|
|
3496
|
+
is false when resources are present
|
|
3497
|
+
is true when no resources were parsed
|
|
3498
|
+
#fetch
|
|
3499
|
+
returns the Entry for a known path
|
|
3500
|
+
returns nil for an unknown path
|
|
3501
|
+
Entry#verify?
|
|
3502
|
+
is false otherwise
|
|
3503
|
+
is true when the content hashes to the recorded sha256
|
|
3504
|
+
#verify_content!
|
|
3505
|
+
raises IntegrityError when the SHA-256 mismatches
|
|
3506
|
+
includes the URL in the error when provided
|
|
3507
|
+
returns true when the SHA-256 matches
|
|
3508
|
+
returns nil (no-op) when the manifest has no entry for the path
|
|
3509
|
+
.parse
|
|
3510
|
+
parses each resource into an Entry
|
|
3511
|
+
raises IntegrityError on malformed JSON
|
|
3512
|
+
builds a Manifest from a JSON string
|
|
3513
|
+
parses manifests with no resources section as empty
|
|
3514
|
+
.load
|
|
3515
|
+
returns nil when the http layer returns nil (404 / 410)
|
|
3516
|
+
propagates JSON parse errors
|
|
3517
|
+
delegates to the http layer and parses the body
|
|
3518
|
+
Kotoshu::Integrity::RotationPolicy
|
|
3519
|
+
#plan_for
|
|
3520
|
+
is purely functional — does not touch the filesystem
|
|
3521
|
+
deletes the oldest rotation slot
|
|
3522
|
+
shifts each existing rotation up by one suffix, oldest-first
|
|
3523
|
+
with rotations=1 deletes .1 and moves current to .1
|
|
3524
|
+
preserves move ordering so a verbatim executor never clobbers a live file
|
|
3525
|
+
deletes the current path (truncate) when rotations is zero
|
|
3526
|
+
#initialize
|
|
3527
|
+
accepts custom max_bytes and rotations
|
|
3528
|
+
raises ArgumentError for negative rotations
|
|
3529
|
+
defaults max_bytes to 10 MB and rotations to 5
|
|
3530
|
+
raises ArgumentError for negative max_bytes
|
|
3531
|
+
coerces string inputs to integers
|
|
3532
|
+
accepts zero for both (effectively truncate-on-rotate / never-rotate)
|
|
3533
|
+
#rotate?
|
|
3534
|
+
is true when current_size > max_bytes
|
|
3535
|
+
is false when current_size <= max_bytes
|
|
3536
|
+
|
|
3537
|
+
Kotoshu::SuikaUnavailable
|
|
3538
|
+
explains how to install the gem
|
|
3539
|
+
is a Kotoshu::Error
|
|
3540
|
+
includes the optional detail when provided
|
|
3541
|
+
|
|
3542
|
+
Kotoshu::Models
|
|
3543
|
+
Kotoshu::Models::Suggestion
|
|
3544
|
+
aliases #inspect to #to_s
|
|
3545
|
+
#initialize
|
|
3546
|
+
accepts confidence boundaries 0.0 and 1.0
|
|
3547
|
+
raises ArgumentError when confidence is below 0
|
|
3548
|
+
stores word, confidence, source, metadata
|
|
3549
|
+
freezes the metadata hash
|
|
3550
|
+
defaults source to :unknown when not provided
|
|
3551
|
+
freezes the instance
|
|
3552
|
+
raises ArgumentError when confidence is above 1
|
|
3553
|
+
defaults metadata to an empty hash
|
|
3554
|
+
#<=>
|
|
3555
|
+
returns 0 when comparing against a non-Suggestion
|
|
3556
|
+
sorts by confidence descending (higher is better)
|
|
3557
|
+
#high_confidence?
|
|
3558
|
+
is false when confidence == 0.8
|
|
3559
|
+
is true when confidence > 0.8
|
|
3560
|
+
metadata accessors
|
|
3561
|
+
#embedding returns metadata[:embedding]
|
|
3562
|
+
#embedding returns nil when metadata lacks :embedding
|
|
3563
|
+
#edit_distance returns metadata[:edit_distance]
|
|
3564
|
+
#explanation returns metadata[:explanation]
|
|
3565
|
+
#to_s
|
|
3566
|
+
includes word, percentage, and source when source is set
|
|
3567
|
+
omits the source suffix when source is :unknown
|
|
3568
|
+
#== and #eql?
|
|
3569
|
+
is equal when the word matches (regardless of confidence)
|
|
3570
|
+
is not equal to non-Suggestion objects
|
|
3571
|
+
has a hash based on the word
|
|
3572
|
+
Kotoshu::Models::EmbeddingModel
|
|
3573
|
+
#similarity
|
|
3574
|
+
returns nil when either word is OOV
|
|
3575
|
+
returns the cosine similarity between two known words
|
|
3576
|
+
#distance
|
|
3577
|
+
returns nil when either word is OOV
|
|
3578
|
+
returns the Euclidean distance between two known words
|
|
3579
|
+
#embedding_for (abstract)
|
|
3580
|
+
returns nil for OOV words
|
|
3581
|
+
raises NotImplementedError on the abstract base
|
|
3582
|
+
returns a WordEmbedding for words in the vocabulary
|
|
3583
|
+
#vocabulary (abstract)
|
|
3584
|
+
raises NotImplementedError on the abstract base
|
|
3585
|
+
#metadata
|
|
3586
|
+
includes language_code, dimension, vocabulary_size, model_type
|
|
3587
|
+
#nearest_neighbors_for_embedding
|
|
3588
|
+
returns [] when the embedding is nil
|
|
3589
|
+
returns neighbors for an OOV embedding (closest vocab word first)
|
|
3590
|
+
includes the source word when given an in-vocab embedding
|
|
3591
|
+
#to_s
|
|
3592
|
+
includes class name, language, dimension, vocabulary_size
|
|
3593
|
+
#has_word?
|
|
3594
|
+
is false for OOV words
|
|
3595
|
+
is true for words in the vocabulary
|
|
3596
|
+
#statistics
|
|
3597
|
+
reports language, dimension, vocabulary_size, loaded
|
|
3598
|
+
#loaded?
|
|
3599
|
+
is true when vocabulary_size is positive
|
|
3600
|
+
is false when vocabulary_size is zero
|
|
3601
|
+
#initialize
|
|
3602
|
+
raises ArgumentError when dimension is not positive
|
|
3603
|
+
raises ArgumentError when language_code is nil
|
|
3604
|
+
stores language_code and dimension
|
|
3605
|
+
does not freeze the base — subclasses may add ivars post-super
|
|
3606
|
+
#nearest_neighbors
|
|
3607
|
+
returns up to k neighbors sorted by similarity
|
|
3608
|
+
excludes the query word from results
|
|
3609
|
+
returns [] when the query is OOV
|
|
3610
|
+
Kotoshu::Models::Context
|
|
3611
|
+
#initialize
|
|
3612
|
+
compact-filters nil segments when joining
|
|
3613
|
+
defaults window to 5
|
|
3614
|
+
stores before/current/after/location/window
|
|
3615
|
+
joins before/current/after into full_context with newlines
|
|
3616
|
+
freezes itself
|
|
3617
|
+
#with_highlight
|
|
3618
|
+
returns full_context unchanged when error_word is nil
|
|
3619
|
+
wraps the error word with ANSI underline codes
|
|
3620
|
+
#surrounding_words
|
|
3621
|
+
returns an empty array when current is nil
|
|
3622
|
+
returns all words when the target word is not found
|
|
3623
|
+
limits the window to n words on each side of the target
|
|
3624
|
+
#word_at_location
|
|
3625
|
+
returns nil when location is nil
|
|
3626
|
+
returns the character at the column index when set
|
|
3627
|
+
falls back to the current text when column is nil
|
|
3628
|
+
#to_s
|
|
3629
|
+
returns full_context alone when location.line is nil
|
|
3630
|
+
prefixes with 'Line N:' when location.line is set
|
|
3631
|
+
#==/#eql?/#hash
|
|
3632
|
+
is equal when location and full_context match
|
|
3633
|
+
Kotoshu::Models::NearestNeighbor
|
|
3634
|
+
#initialize
|
|
3635
|
+
accepts an explicit distance overriding the cosine-derived default
|
|
3636
|
+
freezes the instance
|
|
3637
|
+
raises ArgumentError when similarity is out of range
|
|
3638
|
+
accepts an optional embedding reference
|
|
3639
|
+
stores word, similarity, and computes distance
|
|
3640
|
+
#==/#eql?/#hash
|
|
3641
|
+
is equal when the word matches
|
|
3642
|
+
#<=>
|
|
3643
|
+
sorts by similarity descending
|
|
3644
|
+
#to_s
|
|
3645
|
+
renders as word [similarity%]
|
|
3646
|
+
#high_confidence?/#confidence_level
|
|
3647
|
+
confidence_level returns :medium for 0.5 < similarity <= 0.8
|
|
3648
|
+
confidence_level returns :high for similarity > 0.8
|
|
3649
|
+
confidence_level returns :low for similarity <= 0.5
|
|
3650
|
+
high_confidence? is true when similarity > 0.8
|
|
3651
|
+
Kotoshu::Models::WordEmbedding
|
|
3652
|
+
#==/#eql?/#hash
|
|
3653
|
+
is not equal when languages differ
|
|
3654
|
+
is equal when word and language match (regardless of vector)
|
|
3655
|
+
#similarity
|
|
3656
|
+
returns 1.0 for identical vectors
|
|
3657
|
+
raises TypeError when other is not a WordEmbedding
|
|
3658
|
+
returns 0.0 when one vector is zero
|
|
3659
|
+
returns 0.0 when dimensions differ
|
|
3660
|
+
returns 0.0 for orthogonal vectors
|
|
3661
|
+
#initialize
|
|
3662
|
+
freezes the vector
|
|
3663
|
+
raises ArgumentError when vector size does not match dimension
|
|
3664
|
+
freezes itself
|
|
3665
|
+
defaults dimension to 300
|
|
3666
|
+
stores word, vector, language_code, dimension
|
|
3667
|
+
#distance
|
|
3668
|
+
is Float::INFINITY when dimensions differ
|
|
3669
|
+
raises TypeError when other is not a WordEmbedding
|
|
3670
|
+
is sqrt(2) for orthogonal unit vectors
|
|
3671
|
+
is 0 for identical vectors
|
|
3672
|
+
#to_s
|
|
3673
|
+
includes class name, word, language, dimension
|
|
3674
|
+
Kotoshu::Models::SemanticError
|
|
3675
|
+
#<=>
|
|
3676
|
+
returns 0 when other is not a SemanticError
|
|
3677
|
+
sorts by location (line, then column)
|
|
3678
|
+
#==/#eql?/#hash
|
|
3679
|
+
is not equal when ids differ
|
|
3680
|
+
is equal when ids match
|
|
3681
|
+
#to_s
|
|
3682
|
+
renders with location, original, recommended word, and percentage
|
|
3683
|
+
#initialize
|
|
3684
|
+
stringifies a Symbol id
|
|
3685
|
+
freezes the instance
|
|
3686
|
+
raises ArgumentError when suggestions is nil
|
|
3687
|
+
raises ArgumentError for an invalid error_type
|
|
3688
|
+
freezes suggestions sorted by confidence descending
|
|
3689
|
+
raises ArgumentError when suggestions is empty
|
|
3690
|
+
raises ArgumentError when confidence is out of range
|
|
3691
|
+
stores all attributes
|
|
3692
|
+
#abbreviated
|
|
3693
|
+
renders a compact location/word/suggestion/percentage form
|
|
3694
|
+
#display_type
|
|
3695
|
+
returns the human-readable name for the error_type
|
|
3696
|
+
#recommended_suggestion
|
|
3697
|
+
returns the highest-confidence suggestion
|
|
3698
|
+
#confidence_level
|
|
3699
|
+
returns :low for confidence <= 0.5
|
|
3700
|
+
returns :medium for 0.5 < confidence <= 0.8
|
|
3701
|
+
returns :high for confidence > 0.8
|
|
3702
|
+
#high_confidence?
|
|
3703
|
+
is false when confidence == 0.8
|
|
3704
|
+
is true when confidence > 0.8
|
|
3705
|
+
ERROR_TYPES
|
|
3706
|
+
maps each category to a display name
|
|
3707
|
+
exposes the ten semantic categories
|
|
3708
|
+
|
|
3709
|
+
Unit: Hunspell AFF Reader
|
|
3710
|
+
#utf_flags
|
|
3711
|
+
parses UTF-8 flag format
|
|
3712
|
+
#numeric_flags
|
|
3713
|
+
parses numeric flag format
|
|
3714
|
+
#directives
|
|
3715
|
+
parses PFX directive
|
|
3716
|
+
parses MAP directive
|
|
3717
|
+
parses REP directive
|
|
3718
|
+
#long_flags
|
|
3719
|
+
parses long flag format
|
|
3720
|
+
#flag_aliases
|
|
3721
|
+
parses flag aliases (AF directive)
|
|
3722
|
+
|
|
3723
|
+
Kotoshu::ConformanceExporter
|
|
3724
|
+
.export
|
|
3725
|
+
exercises both correct and incorrect words
|
|
3726
|
+
exports more than 500 vectors over the full default corpora
|
|
3727
|
+
writes every line in the declared vector shape
|
|
3728
|
+
produces byte-identical output when run twice
|
|
3729
|
+
.spec_fixture_corpus
|
|
3730
|
+
builds words from the test dictionary entries and the word list
|
|
3731
|
+
corpus handling
|
|
3732
|
+
skips a corpus whose dictionary fails to load instead of aborting
|
|
3733
|
+
excludes the pathological timelimit fixture from the default corpora
|
|
3734
|
+
|
|
3735
|
+
Kotoshu::Readers::ZipReader
|
|
3736
|
+
reads lines from a zip entry
|
|
3737
|
+
|
|
3738
|
+
Property-Based Tests
|
|
3739
|
+
Dictionary mutation properties
|
|
3740
|
+
finds word in custom dictionary after creation
|
|
3741
|
+
always finds word immediately after adding
|
|
3742
|
+
maintains word count property
|
|
3743
|
+
LookupCache properties
|
|
3744
|
+
provides consistent cache statistics
|
|
3745
|
+
clears all entries on clear
|
|
3746
|
+
maintains LRU eviction order
|
|
3747
|
+
grows until max_size, then evicts
|
|
3748
|
+
Parallel checker properties
|
|
3749
|
+
produces same results as sequential checking
|
|
3750
|
+
handles empty file list gracefully
|
|
3751
|
+
SymSpell strategy properties
|
|
3752
|
+
maintains distance upper bound
|
|
3753
|
+
returns empty for very distant words
|
|
3754
|
+
finds words within deletion distance
|
|
3755
|
+
SuggestionCache properties
|
|
3756
|
+
caches suggestions with same word regardless of max_results
|
|
3757
|
+
generates correct cache keys for word/max_results combinations
|
|
3758
|
+
BloomFilter properties
|
|
3759
|
+
never produces false negatives
|
|
3760
|
+
maintains false positive rate within bounds
|
|
3761
|
+
handles case-insensitive lookups correctly
|
|
3762
|
+
becomes more accurate as size increases
|
|
3763
|
+
Dictionary lookup properties
|
|
3764
|
+
returns same result for repeated lookups
|
|
3765
|
+
returns false for non-existent words across different cases
|
|
3766
|
+
with case-insensitive dictionary
|
|
3767
|
+
maintains case-insensitive lookup property
|
|
3768
|
+
maintains case-insensitive suggestion property
|
|
3769
|
+
with case-sensitive dictionary
|
|
3770
|
+
maintains case-sensitive lookup property
|
|
3771
|
+
Result pattern properties
|
|
3772
|
+
and_then short-circuits on failure
|
|
3773
|
+
or_else recovers from failure
|
|
3774
|
+
failure chained with map returns failure
|
|
3775
|
+
and_then chains successes
|
|
3776
|
+
success chained with map always returns success
|
|
3777
|
+
Suggestion generation properties
|
|
3778
|
+
respects max_suggestions limit
|
|
3779
|
+
returns same suggestions for same input (deterministic)
|
|
3780
|
+
finds correct word in suggestions for misspellings
|
|
3781
|
+
orders suggestions by relevance
|
|
3782
|
+
returns suggestions with valid distances
|
|
3783
|
+
Personal dictionary properties
|
|
3784
|
+
handles duplicate adds idempotently
|
|
3785
|
+
can remove added words
|
|
3786
|
+
persists words across instances
|
|
3787
|
+
|
|
3788
|
+
Kotoshu::Readers::LatinScriptConditionChecker
|
|
3789
|
+
literal dash handling
|
|
3790
|
+
treats '-' as a literal char, not a range
|
|
3791
|
+
distinguishing prefix vs suffix anchoring with the same condition
|
|
3792
|
+
the same 'ab' condition matches different stems as prefix vs suffix
|
|
3793
|
+
#matches? for prefix conditions
|
|
3794
|
+
'ij' matches stems starting with ij
|
|
3795
|
+
'wr.' matches stems starting with wr + any char
|
|
3796
|
+
.compile
|
|
3797
|
+
builds a prefix checker (anchored at start)
|
|
3798
|
+
builds a suffix checker (anchored at end)
|
|
3799
|
+
exposes condition, type, anchor, and pattern readers
|
|
3800
|
+
#matches? for suffix conditions
|
|
3801
|
+
'y' matches stems ending in y
|
|
3802
|
+
handles nil/empty condition as match-any
|
|
3803
|
+
'[^y]' matches stems NOT ending in y
|
|
3804
|
+
'[aeiou]y' matches stems ending in vowel + y
|
|
3805
|
+
'.' matches any stem
|
|
3806
|
+
|
|
3807
|
+
Kotoshu::Cache::SuggestionCache
|
|
3808
|
+
#fetch
|
|
3809
|
+
respects max_results in cache key
|
|
3810
|
+
computes and caches on miss
|
|
3811
|
+
returns cached value without executing block
|
|
3812
|
+
#delete
|
|
3813
|
+
respects max_results when deleting
|
|
3814
|
+
removes cached suggestions
|
|
3815
|
+
#invalidate_word
|
|
3816
|
+
does not affect other words
|
|
3817
|
+
returns self for chaining
|
|
3818
|
+
removes all cached entries for a word
|
|
3819
|
+
inheritance from LookupCache
|
|
3820
|
+
supports LRU eviction
|
|
3821
|
+
provides stats
|
|
3822
|
+
supports clear
|
|
3823
|
+
#key?
|
|
3824
|
+
returns false for missing word
|
|
3825
|
+
respects max_results
|
|
3826
|
+
returns true for cached word
|
|
3827
|
+
#write and #read
|
|
3828
|
+
separates cache entries by max_results
|
|
3829
|
+
stores and retrieves suggestions with default max_results
|
|
3830
|
+
is case-insensitive for words
|
|
3831
|
+
stores and retrieves suggestions with custom max_results
|
|
3832
|
+
#initialize
|
|
3833
|
+
creates cache with default max size
|
|
3834
|
+
creates cache with custom max size
|
|
3835
|
+
|
|
3836
|
+
Kotoshu::Documents::Suppressions
|
|
3837
|
+
Kotoshu::Documents::SourcePosition.line_for_offset
|
|
3838
|
+
clamps nil and out-of-range offsets
|
|
3839
|
+
maps flat offsets to 1-based lines
|
|
3840
|
+
.scan
|
|
3841
|
+
returns a frozen empty list for empty and nil sources
|
|
3842
|
+
ignores unknown and malformed directives
|
|
3843
|
+
with the :auto profile
|
|
3844
|
+
recognizes bare, HTML-comment, and // directives at once
|
|
3845
|
+
with markdown
|
|
3846
|
+
keeps the directive comment itself out of scope as prose
|
|
3847
|
+
recognizes a whole-line HTML comment directive
|
|
3848
|
+
recognizes a trailing HTML comment directive
|
|
3849
|
+
with asciidoc
|
|
3850
|
+
recognizes a whole-line // directive
|
|
3851
|
+
recognizes a trailing // directive
|
|
3852
|
+
does not treat URLs as line comments
|
|
3853
|
+
with plain text
|
|
3854
|
+
recognizes a bare disable-line
|
|
3855
|
+
does not treat trailing directive text as a directive
|
|
3856
|
+
recognizes a bare disable-next-line with a word list
|
|
3857
|
+
ignores prose that merely mentions a directive
|
|
3858
|
+
with file blocks
|
|
3859
|
+
ignores a stray enable-file
|
|
3860
|
+
suppresses from disable-file to the matching enable-file
|
|
3861
|
+
runs to EOF when never re-enabled
|
|
3862
|
+
supports nested blocks: inner enable only closes the inner block
|
|
3863
|
+
attachment to documents
|
|
3864
|
+
PlainTextDocument scans bare directives for :plain
|
|
3865
|
+
lets the caller supply suppressions explicitly
|
|
3866
|
+
scans an explicit :markdown document with comment syntax
|
|
3867
|
+
Kotoshu::Documents::Suppressions::Suppression
|
|
3868
|
+
rejects unknown kinds and invalid line ranges
|
|
3869
|
+
downcases and freezes its word list
|
|
3870
|
+
matches words case-insensitively
|
|
3871
|
+
|
|
3872
|
+
Kotoshu::Embeddings::OnnxRuntimeModel
|
|
3873
|
+
#load! with an undeserializable model file
|
|
3874
|
+
raises an actionable error pointing at the cache subcommand
|
|
3875
|
+
|
|
3876
|
+
Kotoshu::Language::Normalizer::Hebrew
|
|
3877
|
+
with normalize_maqaf: false
|
|
3878
|
+
preserves the maqaf
|
|
3879
|
+
#normalize
|
|
3880
|
+
strips dagesh (consonant dot) by default
|
|
3881
|
+
normalizes the maqaf (Hebrew hyphen) to ASCII hyphen
|
|
3882
|
+
returns '' for nil
|
|
3883
|
+
is idempotent — bare form stays bare
|
|
3884
|
+
strips niqqud (vowel points)
|
|
3885
|
+
does not downcase (Hebrew has no case)
|
|
3886
|
+
#normalize_word
|
|
3887
|
+
normalizes a single word identically to #normalize
|
|
3888
|
+
with strip_dagesh: false
|
|
3889
|
+
preserves dagesh when configured to keep it
|
|
3890
|
+
|
|
3891
|
+
Kotoshu::Readers::AffReader
|
|
3892
|
+
SFX / PFX grouping
|
|
3893
|
+
parses crossproduct Y as true and N as false
|
|
3894
|
+
groups SFX entries under their flag
|
|
3895
|
+
groups PFX entries under their flag
|
|
3896
|
+
parses flags embedded in the add field via '/X'
|
|
3897
|
+
treats strip/add value '0' as the empty string
|
|
3898
|
+
synonym resolution
|
|
3899
|
+
rewrites PSEUDOROOT to NEEDAFFIX
|
|
3900
|
+
rewrites COMPOUNDLAST to COMPOUNDEND
|
|
3901
|
+
ICONV / OCONV directives
|
|
3902
|
+
parses OCONV count + N conversion pairs
|
|
3903
|
+
parses ICONV count + N conversion pairs
|
|
3904
|
+
#initialize
|
|
3905
|
+
defaults encoding to UTF-8 when path is empty
|
|
3906
|
+
exposes path, encoding, flag_format readers
|
|
3907
|
+
defaults encoding to UTF-8 when path is nil
|
|
3908
|
+
defaults flag_format to short
|
|
3909
|
+
INTEGER directives
|
|
3910
|
+
parses COMPOUNDMIN as an integer
|
|
3911
|
+
parses MAXDIFF as an integer
|
|
3912
|
+
returns nil for INTEGER directives with no value
|
|
3913
|
+
parses MAXCPDSUGS as an integer
|
|
3914
|
+
parses MAXNGRAMSUGS as an integer
|
|
3915
|
+
parses COMPOUNDWORDMAX as an integer
|
|
3916
|
+
CHECKCOMPOUNDPATTERN directive
|
|
3917
|
+
parses count + N compound patterns
|
|
3918
|
+
encoding detection from real files
|
|
3919
|
+
defaults to UTF-8 when SET is missing and bytes are valid UTF-8
|
|
3920
|
+
defaults to ISO-8859-1 when SET is missing and bytes are not valid UTF-8
|
|
3921
|
+
uses the SET directive when present
|
|
3922
|
+
normalizes ISO8859-N to ISO-8859-N
|
|
3923
|
+
passes UTF-8 through unchanged
|
|
3924
|
+
IGNORE directive
|
|
3925
|
+
returns an Ignore instance exposing the chars
|
|
3926
|
+
returns an Ignore instance even with no chars
|
|
3927
|
+
AM directive (morphological aliases)
|
|
3928
|
+
parses count + N morph alias sets
|
|
3929
|
+
BREAK directive
|
|
3930
|
+
returns an empty array when count is 0
|
|
3931
|
+
parses count + N break patterns
|
|
3932
|
+
flag format edge cases (spylls parity)
|
|
3933
|
+
FLAG long drops a trailing odd character from a flag run
|
|
3934
|
+
FLAG num splits a flag run into digit runs
|
|
3935
|
+
FLAG UTF-8 decodes multi-byte flags as whole characters
|
|
3936
|
+
STRING directives
|
|
3937
|
+
parses WORDCHARS as a raw string
|
|
3938
|
+
parses KEY as a raw string
|
|
3939
|
+
parses LANG as a raw string
|
|
3940
|
+
parses TRY as a raw string
|
|
3941
|
+
parses SET as a raw string
|
|
3942
|
+
lines that are not directives
|
|
3943
|
+
ignores unknown directives
|
|
3944
|
+
ignores non-alphabetic lines
|
|
3945
|
+
ignores lowercase lines (directives must be all caps)
|
|
3946
|
+
AF directive (flag aliases)
|
|
3947
|
+
decodes AF values with the active FLAG format (long)
|
|
3948
|
+
builds a positional index → flag-set map
|
|
3949
|
+
decodes AF values with the active FLAG format (num)
|
|
3950
|
+
does not alias-substitute AF values while the AF table is being built
|
|
3951
|
+
decodes AF values with the active FLAG format (UTF-8)
|
|
3952
|
+
COMPOUNDSYLLABLE directive
|
|
3953
|
+
returns a [count, flag] pair
|
|
3954
|
+
COMPOUNDRULE
|
|
3955
|
+
parses rules whose flag characters are regex metacharacters
|
|
3956
|
+
FLAG format switching
|
|
3957
|
+
updates flag_format when FLAG is encountered
|
|
3958
|
+
applies the new flag format to FLAG directives that follow it
|
|
3959
|
+
COMPOUNDRULE directive
|
|
3960
|
+
parses count + N compound rules
|
|
3961
|
+
FLAG directives (single-flag value)
|
|
3962
|
+
CIRCUMFIX parses as a single flag string
|
|
3963
|
+
COMPOUNDPERMITFLAG parses as a single flag string
|
|
3964
|
+
NEEDAFFIX parses as a single flag string
|
|
3965
|
+
SUBSTANDARD parses as a single flag string
|
|
3966
|
+
FORBIDDENWORD parses as a single flag string
|
|
3967
|
+
WARN parses as a single flag string
|
|
3968
|
+
KEEPCASE parses as a single flag string
|
|
3969
|
+
COMPOUNDFLAG parses as a single flag string
|
|
3970
|
+
ONLYINCOMPOUND parses as a single flag string
|
|
3971
|
+
COMPOUNDMIDDLE parses as a single flag string
|
|
3972
|
+
COMPOUNDFORBIDFLAG parses as a single flag string
|
|
3973
|
+
COMPOUNDROOT parses as a single flag string
|
|
3974
|
+
COMPOUNDBEGIN parses as a single flag string
|
|
3975
|
+
SYLLABLENUM parses as a single flag string
|
|
3976
|
+
FORCEUCASE parses as a single flag string
|
|
3977
|
+
COMPOUNDEND parses as a single flag string
|
|
3978
|
+
PHONE directive
|
|
3979
|
+
parses count + N phone rules into a PhonetTable
|
|
3980
|
+
BOOLEAN directives
|
|
3981
|
+
COMPOUNDMORESUFFIXES parses as true
|
|
3982
|
+
CHECKCOMPOUNDDUP parses as true
|
|
3983
|
+
ONLYMAXDIFF parses as true
|
|
3984
|
+
CHECKCOMPOUNDCASE parses as true
|
|
3985
|
+
FULLSTRIP parses as true
|
|
3986
|
+
SIMPLIFIEDTRIPLE parses as true
|
|
3987
|
+
COMPLEXPREFIXES parses as true
|
|
3988
|
+
CHECKCOMPOUNDREP parses as true
|
|
3989
|
+
NOSPLITSUGS parses as true
|
|
3990
|
+
CHECKCOMPOUNDTRIPLE parses as true
|
|
3991
|
+
CHECKSHARPS parses as true
|
|
3992
|
+
|
|
3993
|
+
Kotoshu::Readers::ConditionChecker
|
|
3994
|
+
.compile
|
|
3995
|
+
returns a LatinScriptConditionChecker for :latin script
|
|
3996
|
+
returns a PassthroughConditionChecker for unsupported scripts
|
|
3997
|
+
defaults to :latin script
|
|
3998
|
+
#matches? (abstract)
|
|
3999
|
+
raises NotImplementedError on the base class
|
|
4000
|
+
|
|
4001
|
+
Kotoshu::Keyboard::Layouts::Dvorak
|
|
4002
|
+
English language support
|
|
4003
|
+
is not the default for English (QWERTY is)
|
|
4004
|
+
supports English as alternative layout
|
|
4005
|
+
#distance
|
|
4006
|
+
Dvorak-specific characteristics
|
|
4007
|
+
has vowels close together on home row
|
|
4008
|
+
has home row optimized for typing efficiency
|
|
4009
|
+
#initialize
|
|
4010
|
+
creates Dvorak layout
|
|
4011
|
+
supports English (alternative layout)
|
|
4012
|
+
#position
|
|
4013
|
+
Dvorak-specific: vowels on home row left
|
|
4014
|
+
places a, o, e, u, i on home row left
|
|
4015
|
+
Dvorak-specific: high-frequency consonants on home row right
|
|
4016
|
+
places d, h, t, n, s on home row right
|
|
4017
|
+
layout efficiency
|
|
4018
|
+
places punctuation on top row for easy access
|
|
4019
|
+
|
|
4020
|
+
Kotoshu::Plugins::Plugin
|
|
4021
|
+
dependency injection
|
|
4022
|
+
resolves dependencies with keyword arguments
|
|
4023
|
+
lifecycle hooks
|
|
4024
|
+
calls before_start hook
|
|
4025
|
+
calls after_stop hook
|
|
4026
|
+
plugin definition
|
|
4027
|
+
has dependencies
|
|
4028
|
+
has provided services
|
|
4029
|
+
has a plugin name
|
|
4030
|
+
|
|
4031
|
+
Kotoshu::Language::Normalizer::Persian
|
|
4032
|
+
#normalize
|
|
4033
|
+
strips diacritics (inherited from Arabic)
|
|
4034
|
+
returns '' for nil
|
|
4035
|
+
maps Arabic Kaf to Persian Kaf
|
|
4036
|
+
maps Arabic Yeh to Persian Yeh
|
|
4037
|
+
is idempotent on already-Persian text
|
|
4038
|
+
|
|
4039
|
+
Unit: Hunspell Flags
|
|
4040
|
+
Compound flags
|
|
4041
|
+
tests compound flag processing (PENDING: Different architecture in Kotoshu — covered by integrational lookup specs)
|
|
4042
|
+
Affix flags
|
|
4043
|
+
tests affix flag processing (PENDING: Different architecture in Kotoshu — covered by integrational lookup specs)
|
|
4044
|
+
|
|
4045
|
+
Kotoshu::Suggestions::Context
|
|
4046
|
+
#has_option?
|
|
4047
|
+
is true even when the stored value is nil
|
|
4048
|
+
is false for an option that was not passed
|
|
4049
|
+
is true for an option that was passed
|
|
4050
|
+
integration with Generator
|
|
4051
|
+
exposes the three fields strategies read
|
|
4052
|
+
#option
|
|
4053
|
+
returns nil when the option is absent and no default is given
|
|
4054
|
+
returns the stored value even when it is falsy (nil/false)
|
|
4055
|
+
returns the stored value when present
|
|
4056
|
+
returns the supplied default when the option is absent
|
|
4057
|
+
#initialize
|
|
4058
|
+
defaults max_results to 10
|
|
4059
|
+
defaults options to an empty hash when no extra kwargs are given
|
|
4060
|
+
exposes word, dictionary, max_results, and options as readers
|
|
4061
|
+
freezes nothing — callers may mutate options hash if they must
|
|
4062
|
+
#inspect / #to_s
|
|
4063
|
+
does not leak the dictionary object_id into the summary
|
|
4064
|
+
is aliased as to_s
|
|
4065
|
+
renders a readable summary including word and max_results
|
|
4066
|
+
|
|
4067
|
+
Kotoshu::Components::Synthesizer
|
|
4068
|
+
#synthesize
|
|
4069
|
+
raises NotImplementedError when called directly
|
|
4070
|
+
#synthesize_all
|
|
4071
|
+
calls synthesize for each POS type
|
|
4072
|
+
|
|
4073
|
+
Kotoshu::Integrity
|
|
4074
|
+
Kotoshu::Integrity::AuditLog
|
|
4075
|
+
exposes entries via #each and #entries
|
|
4076
|
+
appends one JSON object per line per record
|
|
4077
|
+
returns the written entry from #record
|
|
4078
|
+
can be cleared
|
|
4079
|
+
creates the parent directory if it does not exist
|
|
4080
|
+
with a rotation policy
|
|
4081
|
+
does not rotate while under the threshold
|
|
4082
|
+
exposes rotated entries via #entries (newest-first)
|
|
4083
|
+
promotes the current log to .1 once over the threshold
|
|
4084
|
+
shifts existing rotations up before promoting current
|
|
4085
|
+
clears the current log and all rotations on clear!
|
|
4086
|
+
caps total rotations at the configured count
|
|
4087
|
+
Kotoshu::IntegrityError
|
|
4088
|
+
is a Kotoshu::Error
|
|
4089
|
+
carries resource_id, expected, actual, url
|
|
4090
|
+
Kotoshu::Integrity::Manifest
|
|
4091
|
+
.parse
|
|
4092
|
+
returns a Manifest with entries keyed by relative path
|
|
4093
|
+
returns an empty manifest when the resources section is absent
|
|
4094
|
+
raises IntegrityError on malformed JSON
|
|
4095
|
+
.load
|
|
4096
|
+
fetches and parses the manifest from a URL
|
|
4097
|
+
returns nil when manifest is absent (HTTP 404)
|
|
4098
|
+
#verify_content!
|
|
4099
|
+
returns nil (no-op) when the path is not in the manifest
|
|
4100
|
+
raises IntegrityError with expected and actual hashes on mismatch
|
|
4101
|
+
returns true when content matches the manifest entry
|
|
4102
|
+
Kotoshu::Integrity::RotationPolicy
|
|
4103
|
+
rejects negative max_bytes
|
|
4104
|
+
is wired to Configuration via the audit_max_bytes / audit_rotations accessors
|
|
4105
|
+
rejects negative rotations
|
|
4106
|
+
uses the documented defaults
|
|
4107
|
+
#rotate?
|
|
4108
|
+
is true above the threshold
|
|
4109
|
+
is false at and below the threshold
|
|
4110
|
+
#plan_for
|
|
4111
|
+
preserves plan shape at rotations == 1 (current → .1 only)
|
|
4112
|
+
produces a drop + shift + promote plan when rotations > 0
|
|
4113
|
+
truncates the current log when rotations == 0
|
|
4114
|
+
|
|
4115
|
+
Kotoshu::Keyboard::Layouts::AZERTY
|
|
4116
|
+
#position
|
|
4117
|
+
AZERTY-specific: a and q are swapped from QWERTY
|
|
4118
|
+
places a in top row (position 0)
|
|
4119
|
+
places q in home row (position 0)
|
|
4120
|
+
AZERTY-specific: z and w are swapped from QWERTY
|
|
4121
|
+
places z in top row (position 1)
|
|
4122
|
+
places w in bottom row (position 0)
|
|
4123
|
+
French language support
|
|
4124
|
+
is the default layout for French
|
|
4125
|
+
does not support German
|
|
4126
|
+
does not support English
|
|
4127
|
+
#initialize
|
|
4128
|
+
creates AZERTY layout
|
|
4129
|
+
supports French and variants
|
|
4130
|
+
supports Belgian (be)
|
|
4131
|
+
#distance
|
|
4132
|
+
AZERTY-specific characteristics
|
|
4133
|
+
has z and w far apart (swapped from QWERTY)
|
|
4134
|
+
has a and q far apart (swapped from QWERTY)
|
|
4135
|
+
#adjacent_keys
|
|
4136
|
+
returns adjacent keys for a (in top row)
|
|
4137
|
+
|
|
4138
|
+
Kotoshu::Readers::FileReader
|
|
4139
|
+
#initialize
|
|
4140
|
+
opens the file and exposes path and encoding
|
|
4141
|
+
#has_next? / #next / #peek
|
|
4142
|
+
supports iterator-style consumption
|
|
4143
|
+
#reset
|
|
4144
|
+
resets to the beginning
|
|
4145
|
+
encoding transcoding
|
|
4146
|
+
falls back to ISO-8859-1 when the declared encoding is invalid
|
|
4147
|
+
transcodes ISO-8859-1 to UTF-8
|
|
4148
|
+
#reset_encoding
|
|
4149
|
+
reopens the file with a new encoding and resets line_no
|
|
4150
|
+
#each
|
|
4151
|
+
yields [line_no, line] pairs with stripped content
|
|
4152
|
+
returns an Enumerator when no block is given
|
|
4153
|
+
skips empty lines and increments line_no correctly
|
|
4154
|
+
BOM handling
|
|
4155
|
+
strips a UTF-8 BOM from the first line
|
|
4156
|
+
|
|
4157
|
+
Unit: Hunspell read_aff
|
|
4158
|
+
#directives
|
|
4159
|
+
parses REP directive
|
|
4160
|
+
parses MAP directive
|
|
4161
|
+
parses PFX directive
|
|
4162
|
+
#long_flags
|
|
4163
|
+
parses long flag format
|
|
4164
|
+
#utf_flags
|
|
4165
|
+
parses UTF-8 flag format
|
|
4166
|
+
#flag_aliases
|
|
4167
|
+
parses flag aliases (AF directive)
|
|
4168
|
+
#numeric_flags
|
|
4169
|
+
parses numeric flag format
|
|
4170
|
+
|
|
4171
|
+
Kotoshu::Dictionaries::Catalog
|
|
4172
|
+
.all
|
|
4173
|
+
returns a frozen array of DictionaryEntry instances
|
|
4174
|
+
.find
|
|
4175
|
+
finds a dictionary by exact code
|
|
4176
|
+
returns nil for an unknown code
|
|
4177
|
+
.by_format / .hunspell / .plain_text
|
|
4178
|
+
.hunspell returns only hunspell-format entries
|
|
4179
|
+
.by_format(:hunspell) equals .hunspell
|
|
4180
|
+
.plain_text returns only plain_text-format entries
|
|
4181
|
+
Kotoshu::Dictionaries::Catalog::DictionaryEntry
|
|
4182
|
+
is frozen
|
|
4183
|
+
exposes all constructor fields as readers
|
|
4184
|
+
#description omits region when nil
|
|
4185
|
+
#description includes name, region, and word count
|
|
4186
|
+
#plain_text? is true for plain_text format
|
|
4187
|
+
#hunspell? is true for hunspell format
|
|
4188
|
+
.by_license
|
|
4189
|
+
returns entries whose license includes the query string
|
|
4190
|
+
.by_language
|
|
4191
|
+
returns all dictionaries for a language
|
|
4192
|
+
returns [] for an unknown language
|
|
4193
|
+
.statistics
|
|
4194
|
+
returns a hash with the documented keys
|
|
4195
|
+
|
|
4196
|
+
Kotoshu::Dictionary::Unified
|
|
4197
|
+
PATHES and DISTRIBUTED constants
|
|
4198
|
+
PATHES is a frozen Array of system search paths
|
|
4199
|
+
DISTRIBUTED maps fixture dictionary names to language codes
|
|
4200
|
+
.from_files
|
|
4201
|
+
raises ArgumentError when the .aff file is missing
|
|
4202
|
+
loads from the bundled test fixture
|
|
4203
|
+
#suggest
|
|
4204
|
+
yields suggestions when a block is given
|
|
4205
|
+
returns an Enumerator when no block is given
|
|
4206
|
+
#lookup
|
|
4207
|
+
returns true for a word in the dictionary
|
|
4208
|
+
returns false for an unknown word
|
|
4209
|
+
|
|
4210
|
+
Kotoshu::Dictionary::Repository# Walking Skeleton - Dictionary Repository
|
|
4211
|
+
#keys
|
|
4212
|
+
returns all registered keys
|
|
4213
|
+
#empty?
|
|
4214
|
+
returns true for empty repository
|
|
4215
|
+
returns false for non-empty repository
|
|
4216
|
+
#find_by_language
|
|
4217
|
+
returns empty array when no matches
|
|
4218
|
+
returns dictionaries matching language code
|
|
4219
|
+
is case-insensitive
|
|
4220
|
+
#register
|
|
4221
|
+
registers dictionary under key
|
|
4222
|
+
replaces existing dictionary
|
|
4223
|
+
converts string keys to symbols
|
|
4224
|
+
has alias add
|
|
4225
|
+
has alias []=
|
|
4226
|
+
#unregister
|
|
4227
|
+
removes dictionary
|
|
4228
|
+
has alias remove
|
|
4229
|
+
returns nil for non-existing key
|
|
4230
|
+
#clear
|
|
4231
|
+
removes all dictionaries
|
|
4232
|
+
#get
|
|
4233
|
+
has alias []
|
|
4234
|
+
returns dictionary for existing key
|
|
4235
|
+
converts string keys to symbols
|
|
4236
|
+
returns nil for non-existing key
|
|
4237
|
+
#each
|
|
4238
|
+
iterates over key-dictionary pairs
|
|
4239
|
+
returns enumerator when no block given
|
|
4240
|
+
#registered?
|
|
4241
|
+
has alias has_key?
|
|
4242
|
+
has alias key?
|
|
4243
|
+
returns false for unregistered key
|
|
4244
|
+
returns true for registered key
|
|
4245
|
+
.keys
|
|
4246
|
+
returns all keys from global repository
|
|
4247
|
+
#values
|
|
4248
|
+
returns all dictionaries
|
|
4249
|
+
#to_h
|
|
4250
|
+
returns hash representation
|
|
4251
|
+
creation
|
|
4252
|
+
creates empty repository
|
|
4253
|
+
creates repository with initial dictionaries
|
|
4254
|
+
#to_s
|
|
4255
|
+
has alias inspect
|
|
4256
|
+
returns string representation
|
|
4257
|
+
.clear
|
|
4258
|
+
clears global repository
|
|
4259
|
+
#merge
|
|
4260
|
+
merges a hash
|
|
4261
|
+
overwrites existing keys
|
|
4262
|
+
merges another repository
|
|
4263
|
+
#size
|
|
4264
|
+
has alias count
|
|
4265
|
+
has alias length
|
|
4266
|
+
returns number of dictionaries
|
|
4267
|
+
.instance
|
|
4268
|
+
returns singleton instance
|
|
4269
|
+
returns same instance across calls
|
|
4270
|
+
.register
|
|
4271
|
+
registers dictionary in global repository
|
|
4272
|
+
.get
|
|
4273
|
+
gets dictionary from global repository
|
|
4274
|
+
.unregister
|
|
4275
|
+
unregisters dictionary from global repository
|
|
4276
|
+
|
|
4277
|
+
Kotoshu::Analyzers::SemanticAnalyzer
|
|
4278
|
+
#suggest_corrections for an OOV word
|
|
4279
|
+
falls back to edit-distance neighbors when the model returns []
|
|
4280
|
+
returns [] when no vocabulary word is within edit distance 2
|
|
4281
|
+
scored by inverse edit distance (distance-1 ranks above distance-2)
|
|
4282
|
+
#suggest_corrections for an in-vocab word
|
|
4283
|
+
uses the model's nearest_neighbors (no fallback)
|
|
4284
|
+
#analyze with a Documents::Document
|
|
4285
|
+
rejects a non-Document argument
|
|
4286
|
+
produces an error whose id is stable for the same source range
|
|
4287
|
+
emits SemanticErrors carrying source_range from the document
|
|
4288
|
+
suggests the in-vocabulary friend for the frend typo
|
|
4289
|
+
|
|
4290
|
+
Kotoshu::Embeddings::LruCache
|
|
4291
|
+
#fetch (cache-aside)
|
|
4292
|
+
only invokes the block once per key
|
|
4293
|
+
returns the cached value when present
|
|
4294
|
+
computes, stores, and returns the block result on miss
|
|
4295
|
+
yields the key to the block, matching Hash#fetch
|
|
4296
|
+
#delete
|
|
4297
|
+
removes the key
|
|
4298
|
+
returns nil when deleting a missing key
|
|
4299
|
+
#clear
|
|
4300
|
+
removes all entries
|
|
4301
|
+
#size and #empty?
|
|
4302
|
+
reflects eviction in size
|
|
4303
|
+
tracks size as entries are added
|
|
4304
|
+
#stats
|
|
4305
|
+
reports size, max_size, ttl, and hit/miss counts
|
|
4306
|
+
computes hit_rate as hits / (hits + misses)
|
|
4307
|
+
counts hits on cache reads
|
|
4308
|
+
#[] and #[]=
|
|
4309
|
+
returns the stored value from []=
|
|
4310
|
+
stores and retrieves a value
|
|
4311
|
+
returns nil for a missing key
|
|
4312
|
+
overwrites an existing value without growing the cache
|
|
4313
|
+
#key?
|
|
4314
|
+
returns false for a deleted key
|
|
4315
|
+
returns false for a missing key
|
|
4316
|
+
returns true for an existing key
|
|
4317
|
+
#keys and #values
|
|
4318
|
+
returns keys in MRU-first order
|
|
4319
|
+
returns a defensive copy of keys
|
|
4320
|
+
returns values in MRU-first order
|
|
4321
|
+
LRU eviction at capacity
|
|
4322
|
+
evicts the least recently used key when capacity is exceeded
|
|
4323
|
+
evicts in insertion order when no reads occur
|
|
4324
|
+
honors max_size of 1 (always keeps the latest)
|
|
4325
|
+
treats a write to an existing key as a use, not an eviction trigger
|
|
4326
|
+
#initialize
|
|
4327
|
+
honors a custom max_size
|
|
4328
|
+
defaults max_size to 1000
|
|
4329
|
+
defaults ttl to nil (no expiry)
|
|
4330
|
+
starts empty with zero hits and misses
|
|
4331
|
+
honors a custom ttl
|
|
4332
|
+
access order tracking
|
|
4333
|
+
promotes the most recently read key to mru
|
|
4334
|
+
returns key-value pairs from lru/mru
|
|
4335
|
+
reports lru/mru as nil when empty
|
|
4336
|
+
|
|
4337
|
+
Kotoshu::Languages::Persian
|
|
4338
|
+
Kotoshu::Languages::Persian::Tokenizer
|
|
4339
|
+
returns [] for nil
|
|
4340
|
+
filters pure numbers
|
|
4341
|
+
tokenizes Persian text by splitting on whitespace
|
|
4342
|
+
normalization integration
|
|
4343
|
+
normalizer maps Arabic Yeh to Persian Yeh
|
|
4344
|
+
instance
|
|
4345
|
+
is RTL
|
|
4346
|
+
uses the Persian normalizer
|
|
4347
|
+
uses a Persian Tokenizer
|
|
4348
|
+
reports script_type :arabic (Persian uses Arabic script)
|
|
4349
|
+
uses Custom dictionary class
|
|
4350
|
+
registration
|
|
4351
|
+
registers fa and fa-IR
|
|
4352
|
+
|
|
4353
|
+
Kotoshu::ResourceManager
|
|
4354
|
+
.languages_setup
|
|
4355
|
+
lists set up languages
|
|
4356
|
+
returns empty array when nothing is set up
|
|
4357
|
+
.setup? predicate
|
|
4358
|
+
returns true after a local install
|
|
4359
|
+
returns false for an unset language
|
|
4360
|
+
returns false for :frequency when only spelling is set up
|
|
4361
|
+
.setup with want: parameter
|
|
4362
|
+
accepts multiple resource types
|
|
4363
|
+
.resolve / #resolve (cache-only)
|
|
4364
|
+
raises ResourceNotSetupError with normalized language code
|
|
4365
|
+
raises ResourceNotSetupError when not set up
|
|
4366
|
+
raises ResourceNotSetupError with symbol language code
|
|
4367
|
+
language normalization
|
|
4368
|
+
strips region suffixes
|
|
4369
|
+
handles underscore-separated locale codes
|
|
4370
|
+
downcases the code
|
|
4371
|
+
.setup_from_local
|
|
4372
|
+
installs the language and lets resolve succeed
|
|
4373
|
+
overwrites with force: true
|
|
4374
|
+
raises ArgumentError when aff file is missing
|
|
4375
|
+
is idempotent without force (raises on second run)
|
|
4376
|
+
raises ArgumentError when dic file is missing
|
|
4377
|
+
|
|
4378
|
+
Kotoshu::Dictionary
|
|
4379
|
+
Kotoshu::Dictionary::Hunspell
|
|
4380
|
+
AF flag aliases under FLAG num
|
|
4381
|
+
resolves numeric aliases through affixes and cross-products
|
|
4382
|
+
#initialize
|
|
4383
|
+
raises DictionaryNotFoundError when the .dic file is missing
|
|
4384
|
+
parses affix rules into prefix/suffix buckets
|
|
4385
|
+
loads aff and dic data
|
|
4386
|
+
raises DictionaryNotFoundError when the .aff file is missing
|
|
4387
|
+
registers itself as :hunspell in the Dictionary registry
|
|
4388
|
+
instance facade
|
|
4389
|
+
exposes a memoized Lookuper
|
|
4390
|
+
exposes a memoized Suggester
|
|
4391
|
+
Kotoshu::Dictionary::Custom
|
|
4392
|
+
#merge
|
|
4393
|
+
returns self
|
|
4394
|
+
is a no-op for other input types
|
|
4395
|
+
merges words from another Dictionary::Base
|
|
4396
|
+
merges words from a plain Array
|
|
4397
|
+
#clear / #readonly?
|
|
4398
|
+
clear empties the dictionary and returns self
|
|
4399
|
+
readonly? is always false
|
|
4400
|
+
#add_word / #remove_word
|
|
4401
|
+
add_word adds new words and rejects duplicates
|
|
4402
|
+
remove_word removes words
|
|
4403
|
+
remove_word returns false for missing words
|
|
4404
|
+
add_word strips whitespace before storing
|
|
4405
|
+
#lookup / #suggest
|
|
4406
|
+
suggest returns [] for nil/empty
|
|
4407
|
+
lookup is false for nil/empty
|
|
4408
|
+
suggest returns close matches and respects max_suggestions
|
|
4409
|
+
#initialize
|
|
4410
|
+
accepts an initial word list (case-insensitive)
|
|
4411
|
+
starts empty by default
|
|
4412
|
+
registers itself in the Dictionary registry as :custom
|
|
4413
|
+
preserves case when case_sensitive is true
|
|
4414
|
+
Kotoshu::Dictionary::UnixWords
|
|
4415
|
+
.detect_system_dictionary / .detect
|
|
4416
|
+
returns the first path in SYSTEM_PATHS that exists, or nil
|
|
4417
|
+
detect returns nil when no system dictionary is found
|
|
4418
|
+
#initialize
|
|
4419
|
+
skips blank lines and # comments
|
|
4420
|
+
raises DictionaryNotFoundError when the file does not exist
|
|
4421
|
+
registers itself in the Dictionary registry as :unix_words
|
|
4422
|
+
#add_word / #remove_word
|
|
4423
|
+
add_word returns false for an existing word
|
|
4424
|
+
remove_word removes and returns true
|
|
4425
|
+
add_word adds and returns true
|
|
4426
|
+
add_word returns false for nil/empty
|
|
4427
|
+
remove_word returns false for a missing word
|
|
4428
|
+
#lookup
|
|
4429
|
+
is true for words in the file (case-insensitive by default)
|
|
4430
|
+
is false for missing words
|
|
4431
|
+
is false for nil and empty input
|
|
4432
|
+
#suggest
|
|
4433
|
+
respects the max_suggestions limit
|
|
4434
|
+
returns close edit-distance matches
|
|
4435
|
+
returns [] for nil and empty input
|
|
4436
|
+
case sensitivity
|
|
4437
|
+
treats input case-sensitively when case_sensitive is true
|
|
4438
|
+
treats input case-insensitively when case_sensitive is false (default)
|
|
4439
|
+
Kotoshu::Dictionary::CSpell
|
|
4440
|
+
#words
|
|
4441
|
+
returns every word stored in the trie
|
|
4442
|
+
#lookup / #has_prefix?
|
|
4443
|
+
has_prefix? is true when at least one word starts with the prefix
|
|
4444
|
+
lookup is false for missing words
|
|
4445
|
+
lookup is false for nil/empty
|
|
4446
|
+
lookup is true for words in the file
|
|
4447
|
+
#initialize
|
|
4448
|
+
loads a .txt fixture into the trie
|
|
4449
|
+
raises DictionaryNotFoundError for a missing file
|
|
4450
|
+
registers itself as :cspell in the Dictionary registry
|
|
4451
|
+
#add_word / #remove_word
|
|
4452
|
+
remove_word always returns false (trie is immutable after load)
|
|
4453
|
+
add_word always returns false (trie is frozen post-load)
|
|
4454
|
+
Kotoshu::Dictionary::Base
|
|
4455
|
+
abstract template methods
|
|
4456
|
+
remove_word raises NotImplementedError
|
|
4457
|
+
add_word raises NotImplementedError
|
|
4458
|
+
words raises NotImplementedError
|
|
4459
|
+
suggest raises NotImplementedError
|
|
4460
|
+
lookup raises NotImplementedError
|
|
4461
|
+
#each_word
|
|
4462
|
+
returns an Enumerator when no block is given
|
|
4463
|
+
iterates words when a block is given
|
|
4464
|
+
aliases
|
|
4465
|
+
contains? is an alias for lookup
|
|
4466
|
+
has_word? is an alias for lookup
|
|
4467
|
+
include? is an alias for lookup
|
|
4468
|
+
lookup? is an alias for lookup
|
|
4469
|
+
count and length are aliases for size
|
|
4470
|
+
<< is an alias for add_word
|
|
4471
|
+
all_words is an alias for words
|
|
4472
|
+
#initialize
|
|
4473
|
+
preserves but freezes a passed-in locale
|
|
4474
|
+
raises ArgumentError for an empty language_code
|
|
4475
|
+
freezes language_code, locale, and metadata
|
|
4476
|
+
raises ArgumentError for a nil language_code
|
|
4477
|
+
#to_s / #inspect
|
|
4478
|
+
includes the class name, language code, and size
|
|
4479
|
+
#size / #empty?
|
|
4480
|
+
empty? is true when there are no words
|
|
4481
|
+
size returns the number of words
|
|
4482
|
+
class-level registry
|
|
4483
|
+
Base.load(type, *args) dispatches to the registered class constructor
|
|
4484
|
+
Base.register_type(type_key) registers self into the module-level registry
|
|
4485
|
+
module-level registry
|
|
4486
|
+
Kotoshu::Dictionary.load dispatches to the registered class constructor
|
|
4487
|
+
Kotoshu::Dictionary.register_type adds a class under a symbol
|
|
4488
|
+
Kotoshu::Dictionary.load raises ConfigurationError for an unknown type
|
|
4489
|
+
#words_with_prefix / #words_matching
|
|
4490
|
+
returns words starting with the prefix
|
|
4491
|
+
returns words matching a Regexp
|
|
4492
|
+
#type
|
|
4493
|
+
derives a snake_case symbol from the class name
|
|
4494
|
+
|
|
4495
|
+
kotoshu check directory mode
|
|
4496
|
+
single-file mode stays unchanged
|
|
4497
|
+
prints one section without a summary line for a lone file
|
|
4498
|
+
sarif output
|
|
4499
|
+
emits one run per file
|
|
4500
|
+
text output
|
|
4501
|
+
exits 0 when every file is clean
|
|
4502
|
+
reports when no text files are found
|
|
4503
|
+
prints one section per file plus a summary and exits 1 on errors
|
|
4504
|
+
ignore and glob flags
|