mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Check Spelling reads craft-i18n's English through craft-proof (#17083)
photocraft_text::spell checks and suggests through craft-proof, which embeds SCOWL's en-US dictionary from craft-i18n (CRAFT_I18N_DIR, the commit in craft-i18n.rev), instead of the in-tree SCOWL 50 list. words(), edit_distance() and the user dictionary are unchanged. craft-proof embeds English only (CRAFT_PROOF_EMBED=en). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
038d035110
commit
2d76dce9ff
10 files changed
+163
-361
No files matched your search
@@ -14,3 +14,9 @@ xtask-gate = "run --locked -p xtask --no-default-features -- ci"
|
||||
# they must hold for any cargo invocation, also one that never reads this file.
|
||||
[target.'cfg(all(windows, target_env = "msvc"))']
|
||||
rustflags = ["-Clink-arg=/DELAYLOAD:opengl32.dll", "-Clink-arg=delayimp.lib"]
|
||||
|
||||
# craft-proof embeds English only (RFC-0011): PhotoCraft checks English spelling and has no
|
||||
# hyphenation, so craft-proof's other carry-over languages (de, pl, pt, it, ru) stay out.
|
||||
# `CRAFT_I18N_DIR` comes from CI and releases (craft-common-actions' checkout-craft-i18n).
|
||||
[env]
|
||||
CRAFT_PROOF_EMBED = "en"
|
||||
+1
-1
@@ -20,7 +20,7 @@ next to them.
|
||||
| `assets/icons/spirit-level.svg` | Straighten tool glyph: a spirit level with its vial and bubble under a dotted arc | PhotoCraft contributors | Original work | MIT OR Apache-2.0 |
|
||||
| `assets/icons/path-op-{new-layer,combine,subtract,intersect,exclude,merge}.svg` | Path Operations glyphs (Pen options bar): a single square for New Layer, and two overlapping squares showing the area each operation keeps (union, back minus front, overlap, everything but the overlap, the merged outline), drawn on Lucide's 24 px grid and stroke | PhotoCraft contributors | Original work | MIT OR Apache-2.0 |
|
||||
| `assets/icons/history-brush.svg` | History Brush tool glyph: Lucide `brush` plus counter-clockwise history rewind arrow | Lucide Icons and Contributors; arrow by PhotoCraft contributors | Derived from <https://github.com/lucide-icons/lucide> `icons/brush.svg` | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) |
|
||||
| `assets/dict/en_US-scowl-50.txt.gz` | English word list for Check Spelling (SCOWL 2020.12.07, size 50, en_US; 72,403 words) | Kevin Atkinson and the SCOWL contributors | <http://wordlist.aspell.net/> | SCOWL license (permissive, keep the notice), [`assets/dict/LICENSE-SCOWL.txt`](assets/dict/LICENSE-SCOWL.txt), which also has the build recipe |
|
||||
| SCOWL en-US dictionary, embedded by craft-proof from craft-i18n (`language-data/en-us/`, the commit in `craft-i18n.rev`) | English dictionary for Check Spelling (SCOWL rel-2026.02.25, Hunspell en-US) | Kevin Atkinson and the SCOWL contributors | <http://wordlist.aspell.net/>, through [storytold/craft-i18n](https://github.com/storytold/craft-i18n) | SCOWL license (permissive, keep the notice), [`assets/dict/LICENSE-SCOWL.txt`](assets/dict/LICENSE-SCOWL.txt), a copy of craft-i18n's `language-data/en-us/LICENCE-SCOWL.txt` |
|
||||
| `assets/app-icon/` (all files) | PhotoCraft app icon (nine-tailed kitsune) | The project owner (drawn in ArtCraft, vectorised) | Original work, see [`assets/app-icon/README.md`](assets/app-icon/README.md) | MIT OR Apache-2.0, [`assets/app-icon/LICENSE.txt`](assets/app-icon/LICENSE.txt) |
|
||||
| `assets/app-icon/photocraft-nightly.png`, `photocraft-nightly-1024.png`, `photocraft-nightly.ico`, `photocraft-nightly.icns` | PhotoCraft nightly deep-background derivatives | @skylartaylor | Original project-owned256 and padded1024 masters at the revision and hashes in [`nightly-provenance.json`](assets/app-icon/nightly-provenance.json); code-generated background-contribution change only, preserving foreground/alpha; no badge or crescent | MIT OR Apache-2.0, [`assets/app-icon/LICENSE.txt`](assets/app-icon/LICENSE.txt) |
|
||||
| `packaging/nightly-archive-tests.py` (runtime-generated temporary files) | Synthetic flat-archive inventory and exclusive-output fixtures; regular-file payloads, not real image/executable validity | @skylartaylor | Original test-generated strings/files and symlinks from the committed script; no external media or user documents | MIT OR Apache-2.0 |
|
||||
|
||||
Generated
+12
@@ -1386,6 +1386,7 @@ dependencies = [
|
||||
"craft-pages",
|
||||
"craft-platform",
|
||||
"craft-print",
|
||||
"craft-proof",
|
||||
"craft-quit",
|
||||
"craft-review",
|
||||
"craft-settings",
|
||||
@@ -2121,6 +2122,17 @@ dependencies = [
|
||||
"winsafe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-proof"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=5c30761a86c2bb1814098139439be7c5b0a9e31c#5c30761a86c2bb1814098139439be7c5b0a9e31c"
|
||||
dependencies = [
|
||||
"log",
|
||||
"miniz_oxide 0.9.1",
|
||||
"toml",
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-psd"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -15,7 +15,7 @@ list (author, source, license) is in ATTRIBUTION.md.
|
||||
Inter font (assets/fonts/Inter-*.ttf) — SIL Open Font License 1.1. See assets/fonts/OFL-Inter.txt.
|
||||
JetBrains Mono font (assets/fonts/JetBrainsMono-Regular.ttf) — SIL Open Font License 1.1. See assets/fonts/OFL-JetBrainsMono.txt.
|
||||
Lucide icons (assets/icons/*.svg, except slice-knife.svg) — ISC; icons derived from Feather also MIT. See assets/icons/LICENSE-lucide.txt.
|
||||
SCOWL English word list (assets/dict/en_US-scowl-50.txt.gz) — SCOWL license. See assets/dict/LICENSE-SCOWL.txt.
|
||||
SCOWL English dictionary (en-US, from craft-i18n through craft-proof) — SCOWL license. See assets/dict/LICENSE-SCOWL.txt.
|
||||
libfacedetection face detection weights and network (crates/algo/data/libfacedetection.bin, crates/algo/src/faces/cnn.rs) — BSD-3-Clause, Copyright (c) 2015-2019, Shiqi Yu, all rights reserved. See crates/algo/data/LICENSE-libfacedetection.txt.
|
||||
Interface translations (embedded at build time from storytold/craft-i18n locales/<code>/common.tsv and photocraft.tsv, at the commit in craft-i18n.rev) — MIT OR Apache-2.0, Copyright (c) 2026 ArtCraft Team and the craft-i18n contributors; the license texts are the same as LICENSE-MIT and LICENSE-APACHE. Per-language credits and provenance: https://github.com/storytold/craft-i18n/blob/main/ATTRIBUTION.md
|
||||
|
||||
|
||||
+83
-187
@@ -1,216 +1,109 @@
|
||||
en_US-scowl-50.txt.gz: English word list for Edit > Check Spelling.
|
||||
Source: SCOWL (Spell Checker Oriented Word Lists) 2020.12.07 by Kevin Atkinson,
|
||||
http://wordlist.aspell.net/ (downloads.sourceforge.net/project/wordlist/SCOWL/2020.12.07/scowl-2020.12.07.tar.gz).
|
||||
Built from final/{english,american}-{words,upper,contractions,proper-names,abbreviations}.{10,20,35,40,50}
|
||||
(size 50, en_US spelling), converted Latin-1 -> UTF-8, possessives ("'s") removed (the checker strips them),
|
||||
grouped by SCOWL level ("#10", "#20", "#35", "#40", "#50" header lines; each word under the most common level it appears in), sorted within a level, one word per line, gzip -9. 72,403 words.
|
||||
en_US Hunspell Dictionary
|
||||
Version 2026.02.25
|
||||
Wed Feb 25 15:37:24 2026 -0500 [7e99eda]
|
||||
|
||||
SCOWL licence (verbatim from the distribution's Copyright file):
|
||||
-----------------------------------------------------------------
|
||||
https://wordlist.aspell.net
|
||||
|
||||
The collective work is Copyright 2000-2018 by Kevin Atkinson as well
|
||||
as any of the copyrights mentioned below:
|
||||
README file for English Hunspell dictionaries derived from SCOWL.
|
||||
|
||||
Copyright 2000-2018 by Kevin Atkinson
|
||||
These dictionaries are created using the speller/make-hunspell-dict
|
||||
script in SCOWL.
|
||||
|
||||
Permission to use, copy, modify, distribute and sell these word
|
||||
lists, the associated scripts, the output created from the scripts,
|
||||
and its documentation for any purpose is hereby granted without fee,
|
||||
provided that the above copyright notice appears in all copies and
|
||||
that both that copyright notice and this permission notice appear in
|
||||
supporting documentation. Kevin Atkinson makes no representations
|
||||
about the suitability of this array for any purpose. It is provided
|
||||
"as is" without express or implied warranty.
|
||||
The following dictionaries are available:
|
||||
|
||||
Alan Beale <[email protected]> also deserves special credit as he has,
|
||||
in addition to providing the 12Dicts package and being a major
|
||||
contributor to the ENABLE word list, given me an incredible amount of
|
||||
feedback and created a number of special lists (those found in the
|
||||
Supplement) in order to help improve the overall quality of SCOWL.
|
||||
en_US (American)
|
||||
en_CA (Canadian)
|
||||
en_GB-ise (British with -ise/traditional spelling)
|
||||
en_GB-ize (British with -ize/Oxford spelling)
|
||||
en_AU (Australian)
|
||||
|
||||
The 10 level includes the 1000 most common English words (according to
|
||||
the Moby (TM) Words II [MWords] package), a subset of the 1000 most
|
||||
common words on the Internet (again, according to Moby Words II), and
|
||||
frequently class 16 from Brian Kelk's "UK English Wordlist
|
||||
with Frequency Classification".
|
||||
en_US-large
|
||||
en_CA-large
|
||||
en_GB-large (with both -ise and -ize spelling)
|
||||
en_AU-large
|
||||
|
||||
The MWords package was explicitly placed in the public domain:
|
||||
The default dictionaries correspond to SCOWL size 60 and, to encourage
|
||||
consistent spelling, generally only include one spelling variant for a word.
|
||||
The large dictionaries correspond to SCOWL size 70 and include common
|
||||
spelling variants. The larger dictionaries, however, (1) have not been as
|
||||
carefully checked for errors as the normal dictionaries and thus may contain
|
||||
misspelled or invalid words; and (2) contain uncommon, yet valid, words that
|
||||
might cause problems as they are likely to be misspellings of more common
|
||||
words (for example, "ort" and "calender").
|
||||
|
||||
The Moby lexicon project is complete and has
|
||||
been place into the public domain. Use, sell,
|
||||
rework, excerpt and use in any way on any platform.
|
||||
The American, Canadian, and Australian dictionaries are considered the
|
||||
official version for Hunspell. The British ones are considered an
|
||||
alternative version. The official ones are maintained by Marco A.G.Pinto at
|
||||
https://proofingtoolgui.org.
|
||||
|
||||
Placing this material on internal or public servers is
|
||||
also encouraged. The compiler is not aware of any
|
||||
export restrictions so freely distribute world-wide.
|
||||
For additional information, including information on how to contribute, see
|
||||
https://wordlist.aspell.net/dicts/.
|
||||
|
||||
You can verify the public domain status by contacting
|
||||
IMPORTANT CHANGES INTRODUCED ON 2026-02-22:
|
||||
|
||||
Grady Ward
|
||||
3449 Martha Ct.
|
||||
Arcata, CA 95521-4884
|
||||
The Unicode "’" (U+2019) character was added to WORDCHARS so that Hunspell can
|
||||
recognize words with the apostrophe. Based on testing, this should allow
|
||||
Hunspell to recognize both "can't" and "can’t". The ASCII single quote at the
|
||||
end of the word won't be considered part of the word, but the Unicode
|
||||
character will. This means "'color'" is okay, but "‘color’" will get flagged
|
||||
when Hunspell does the tokenization.
|
||||
|
||||
[email protected]
|
||||
[email protected]
|
||||
IMPORTANT CHANGES INTRODUCED IN 2016.11.20:
|
||||
|
||||
The "UK English Wordlist With Frequency Classification" is also in the
|
||||
Public Domain:
|
||||
New Australian dictionaries thanks to the work of Benjamin Titze
|
||||
([email protected]).
|
||||
|
||||
Date: Sat, 08 Jul 2000 20:27:21 +0100
|
||||
From: Brian Kelk <[email protected]>
|
||||
IMPORTANT CHANGES INTRODUCED IN 2016.04.24:
|
||||
|
||||
> I was wondering what the copyright status of your "UK English
|
||||
> Wordlist With Frequency Classification" word list as it seems to
|
||||
> be lacking any copyright notice.
|
||||
The dictionaries are now in UTF-8 format instead of ISO-8859-1. This
|
||||
was required to handle smart quotes correctly.
|
||||
|
||||
There were many many sources in total, but any text marked
|
||||
"copyright" was avoided. Locally-written documentation was one
|
||||
source. An earlier version of the list resided in a filespace called
|
||||
PUBLIC on the University mainframe, because it was considered public
|
||||
domain.
|
||||
IMPORTANT CHANGES INTRODUCED IN 2016.01.19:
|
||||
|
||||
Date: Tue, 11 Jul 2000 19:31:34 +0100
|
||||
"SET UTF8" was changes to "SET UTF-8" in the affix file as some
|
||||
versions of Hunspell do not recognize "UTF8".
|
||||
|
||||
> So are you saying your word list is also in the public domain?
|
||||
ADDITIONAL NOTES:
|
||||
|
||||
That is the intention.
|
||||
The NOSUGGEST flag was added to certain taboo words. While I made an
|
||||
honest attempt to flag the strongest taboo words with the NOSUGGEST
|
||||
flag, I MAKE NO GUARANTEE THAT I FLAGGED EVERY POSSIBLE TABOO WORD.
|
||||
The list was originally derived from Németh László, however I removed
|
||||
some words which, while being considered taboo by some dictionaries,
|
||||
are not really considered swear words in today's society.
|
||||
|
||||
The 20 level includes frequency classes 7-15 from Brian's word list.
|
||||
COPYRIGHT, SOURCES, and CREDITS:
|
||||
|
||||
The 35 level includes frequency classes 2-6 and words appearing in at
|
||||
least 11 of 12 dictionaries as indicated in the 12Dicts package. All
|
||||
words from the 12Dicts package have had likely inflections added via
|
||||
my inflection database.
|
||||
The English dictionaries come directly from SCOWL and is thus under
|
||||
the same copyright terms as SCOWL. The affix file is a heavily
|
||||
modified version of the original english.aff file, which was
|
||||
released as part of Geoff Kuenning's Ispell and as such is covered by
|
||||
his BSD license.
|
||||
|
||||
The 12Dicts package and Supplement is in the Public Domain.
|
||||
Copyright 2000-2026 by Kevin Atkinson
|
||||
|
||||
The WordNet database, which was used in the creation of the
|
||||
Inflections database, is under the following copyright:
|
||||
Permission to use, copy, modify, distribute, and sell any part of SCOWLv2, or
|
||||
word lists created from it, is hereby granted without fee, provided that the
|
||||
above copyright notice appears in all copies and that both the above
|
||||
copyright notice and this notice appear in supporting documentation. Kevin
|
||||
Atkinson makes no representations about the suitability of this database for
|
||||
any purpose. It is provided "as is" without express or implied warranty.
|
||||
|
||||
This software and database is being provided to you, the LICENSEE,
|
||||
by Princeton University under the following license. By obtaining,
|
||||
using and/or copying this software and database, you agree that you
|
||||
have read, understood, and will comply with these terms and
|
||||
conditions.:
|
||||
SCOWL is derived from many sources, most of which are in the Public Domain.
|
||||
Data from the Corpus of Contemporary American English (COCA) was also used.
|
||||
|
||||
Permission to use, copy, modify and distribute this software and
|
||||
database and its documentation for any purpose and without fee or
|
||||
royalty is hereby granted, provided that you agree to comply with
|
||||
the following copyright notice and statements, including the
|
||||
disclaimer, and that the same appear on ALL copies of the software,
|
||||
database and documentation, including modifications that you make
|
||||
for internal use or for distribution.
|
||||
All data from COCA comes from 3-gram data that is not freely available;
|
||||
however, the usage is within the rights given by the NDA that was signed when
|
||||
purchasing the data. More information on COCA is available at
|
||||
https://www.english-corpora.org/coca/.
|
||||
|
||||
WordNet 1.6 Copyright 1997 by Princeton University. All rights
|
||||
reserved.
|
||||
The primary source of words for SCOWL comes from 12dicts and ENABLE2K. Both
|
||||
are in the Public Domain, but Alan Beale <[email protected]> deserves special
|
||||
credit as he is the author of 12dicts and a major contributor to ENABLE2K. In
|
||||
addition, he gave me an incredible amount of feedback and created a number of
|
||||
special lists in order to help improve the overall quality of SCOWL.
|
||||
|
||||
THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON
|
||||
UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON
|
||||
UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT-
|
||||
ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE
|
||||
LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY
|
||||
THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
|
||||
|
||||
The name of Princeton University or Princeton may not be used in
|
||||
advertising or publicity pertaining to distribution of the software
|
||||
and/or database. Title to copyright in this software, database and
|
||||
any associated documentation shall at all times remain with
|
||||
Princeton University and LICENSEE agrees to preserve same.
|
||||
|
||||
The 40 level includes words from Alan's 3esl list found in version 4.0
|
||||
of his 12dicts package. Like his other stuff the 3esl list is also in the
|
||||
public domain.
|
||||
|
||||
The 50 level includes Brian's frequency class 1, words appearing
|
||||
in at least 5 of 12 of the dictionaries as indicated in the 12Dicts
|
||||
package, and uppercase words in at least 4 of the previous 12
|
||||
dictionaries. A decent number of proper names is also included: The
|
||||
top 1000 male, female, and Last names from the 1990 Census report; a
|
||||
list of names sent to me by Alan Beale; and a few names that I added
|
||||
myself. Finally a small list of abbreviations not commonly found in
|
||||
other word lists is included.
|
||||
|
||||
The name files form the Census report is a government document which I
|
||||
don't think can be copyrighted.
|
||||
|
||||
The file special-jargon.50 uses common.lst and word.lst from the
|
||||
"Unofficial Jargon File Word Lists" which is derived from "The Jargon
|
||||
File". All of which is in the Public Domain. This file also contain
|
||||
a few extra UNIX terms which are found in the file "unix-terms" in the
|
||||
special/ directory.
|
||||
|
||||
The 55 level includes words from Alan's 2of4brif list found in version
|
||||
4.0 of his 12dicts package. Like his other stuff the 2of4brif is also
|
||||
in the public domain.
|
||||
|
||||
The 60 level includes all words appearing in at least 2 of the 12
|
||||
dictionaries as indicated by the 12Dicts package.
|
||||
|
||||
The 70 level includes Brian's frequency class 0 and the 74,550 common
|
||||
dictionary words from the MWords package. The common dictionary words,
|
||||
like those from the 12Dicts package, have had all likely inflections
|
||||
added. The 70 level also included the 5desk list from version 4.0 of
|
||||
the 12Dics package which is in the public domain.
|
||||
|
||||
The 80 level includes the ENABLE word list, all the lists in the
|
||||
ENABLE supplement package (except for ABLE), the "UK Advanced Cryptics
|
||||
Dictionary" (UKACD), the list of signature words from the YAWL package,
|
||||
and the 10,196 places list from the MWords package.
|
||||
|
||||
The ENABLE package, mainted by M\Cooper <[email protected]>,
|
||||
is in the Public Domain:
|
||||
|
||||
The ENABLE master word list, WORD.LST, is herewith formally released
|
||||
into the Public Domain. Anyone is free to use it or distribute it in
|
||||
any manner they see fit. No fee or registration is required for its
|
||||
use nor are "contributions" solicited (if you feel you absolutely
|
||||
must contribute something for your own peace of mind, the authors of
|
||||
the ENABLE list ask that you make a donation on their behalf to your
|
||||
favorite charity). This word list is our gift to the Scrabble
|
||||
community, as an alternate to "official" word lists. Game designers
|
||||
may feel free to incorporate the WORD.LST into their games. Please
|
||||
mention the source and credit us as originators of the list. Note
|
||||
that if you, as a game designer, use the WORD.LST in your product,
|
||||
you may still copyright and protect your product, but you may *not*
|
||||
legally copyright or in any way restrict redistribution of the
|
||||
WORD.LST portion of your product. This *may* under law restrict your
|
||||
rights to restrict your users' rights, but that is only fair.
|
||||
|
||||
UKACD, by J Ross Beresford <[email protected]>, is under the
|
||||
following copyright:
|
||||
|
||||
Copyright (c) J Ross Beresford 1993-1999. All Rights Reserved.
|
||||
|
||||
The following restriction is placed on the use of this publication:
|
||||
if The UK Advanced Cryptics Dictionary is used in a software package
|
||||
or redistributed in any form, the copyright notice must be
|
||||
prominently displayed and the text of this document must be included
|
||||
verbatim.
|
||||
|
||||
There are no other restrictions: I would like to see the list
|
||||
distributed as widely as possible.
|
||||
|
||||
The 95 level includes the 354,984 single words, 256,772 compound
|
||||
words, 4,946 female names and the 3,897 male names, and 21,986 names
|
||||
from the MWords package, ABLE.LST from the ENABLE Supplement, and some
|
||||
additional words found in my part-of-speech database that were not
|
||||
found anywhere else.
|
||||
|
||||
Accent information was taken from UKACD.
|
||||
|
||||
The VarCon package was used to create the American, British, Canadian,
|
||||
and Australian word list. It is under the following copyright:
|
||||
|
||||
Copyright 2000-2016 by Kevin Atkinson
|
||||
|
||||
Permission to use, copy, modify, distribute and sell this array, the
|
||||
associated software, and its documentation for any purpose is hereby
|
||||
granted without fee, provided that the above copyright notice appears
|
||||
in all copies and that both that copyright notice and this permission
|
||||
notice appear in supporting documentation. Kevin Atkinson makes no
|
||||
representations about the suitability of this array for any
|
||||
purpose. It is provided "as is" without express or implied warranty.
|
||||
The initial information for Australian English comes from Benjamin Titze:
|
||||
|
||||
Copyright 2016 by Benjamin Titze
|
||||
|
||||
@@ -222,7 +115,7 @@ and Australian word list. It is under the following copyright:
|
||||
representations about the suitability of this array for any
|
||||
purpose. It is provided "as is" without express or implied warranty.
|
||||
|
||||
Since the original words lists come from the Ispell distribution:
|
||||
Affix file Copyright:
|
||||
|
||||
Copyright 1993, Geoff Kuenning, Granada Hills, CA
|
||||
All rights reserved.
|
||||
@@ -256,3 +149,6 @@ and Australian word list. It is under the following copyright:
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Build Date: Wed Feb 25 15:40:53 EST 2026
|
||||
Wordlist Command: mk-list --accents=strip en_US 60
|
||||
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
//! Edit › Check Spelling… and glyph insertion (Window › Glyphs).
|
||||
//!
|
||||
//! `edit.checkSpelling` checks type layers against the bundled English dictionary
|
||||
//! (`photocraft_text::spell`, SCOWL size 50) plus the user dictionary in the preferences
|
||||
//! (`photocraft_text::spell`: craft-proof's SCOWL en-US from craft-i18n) plus the user dictionary in the preferences
|
||||
//! (`userDictionary`). Headless, it lists misspellings with suggestions and changes, changes all,
|
||||
//! or adds words to the dictionary; the UI's dialog drives the same actions. Offsets are
|
||||
//! character indices. An action records Check Spelling as one `{"allLayers"}` step with its
|
||||
|
||||
@@ -18,7 +18,7 @@ craft-psd = { workspace = true }
|
||||
craft-plist = { workspace = true }
|
||||
# No `system` feature: fontique's system backend links fontconfig on Linux. The installed fonts
|
||||
# come from the craft font Catalog; the bundled fonts are always registered (native + web).
|
||||
craft = { workspace = true, default-features = false, features = ["font-catalog", "font-manager"] }
|
||||
craft = { workspace = true, default-features = false, features = ["font-catalog", "font-manager", "proof"] }
|
||||
parley = { version = "0.11", default-features = false, features = ["std"] }
|
||||
skrifa = "0.47"
|
||||
flate2 = { workspace = true }
|
||||
|
||||
+57
-169
@@ -1,29 +1,21 @@
|
||||
//! Spelling checker for Edit › Check Spelling.
|
||||
//!
|
||||
//! The dictionary is SCOWL size 50 (American English, ~72k words; see
|
||||
//! `assets/dict/LICENSE-SCOWL.txt`), gzip-compressed into the binary and decoded on first use.
|
||||
//! Words are grouped by SCOWL level (10 = most common … 50), which ranks suggestions.
|
||||
//! Words are checked and suggested by craft-proof against SCOWL's American English dictionary,
|
||||
//! which craft-proof embeds from craft-i18n's Language data at build time (`CRAFT_I18N_DIR`, the
|
||||
//! commit in `craft-i18n.rev`; RFC-0011). Without that checkout craft-proof falls back to an
|
||||
//! installed Hunspell dictionary or its own English word list.
|
||||
//!
|
||||
//! Case rules follow common spell checkers: a lowercase dictionary word may be written
|
||||
//! capitalised or in all caps; a capitalised entry (proper noun) must keep its capital. Trailing
|
||||
//! possessive `'s` is ignored, typographic apostrophes count as `'`, and tokens containing digits
|
||||
//! are skipped.
|
||||
//! Words in capitals are checked too (`TEH` is flagged). A trailing possessive `'s` is checked and
|
||||
//! suggested on its stem, typographic apostrophes count as `'`, and tokens containing digits are
|
||||
//! skipped.
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::io::Read;
|
||||
use std::sync::OnceLock;
|
||||
use std::collections::HashSet;
|
||||
|
||||
static WORDS_GZ: &[u8] = include_bytes!("../../../assets/dict/en_US-scowl-50.txt.gz");
|
||||
/// craft-proof's English spelling, with what PhotoCraft skips.
|
||||
pub struct Dictionary(());
|
||||
|
||||
/// A word list with frequency levels.
|
||||
pub struct Dictionary {
|
||||
/// Word (as listed) → SCOWL level.
|
||||
words: HashMap<String, u8>,
|
||||
/// Lowercase form → listed forms (for case-insensitive lookups and suggestions).
|
||||
by_lower: HashMap<String, Vec<String>>,
|
||||
/// Lowercase words grouped by char length, for suggestions.
|
||||
by_len: Vec<Vec<(String, Vec<char>, u8)>>,
|
||||
}
|
||||
/// Words in capitals are checked; words with digits and web addresses are not.
|
||||
const OPTIONS: craft::proof::Options = craft::proof::Options { ignore_uppercase: false, ignore_numbers: true, ignore_internet: true };
|
||||
|
||||
/// A misspelled word in a string.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -35,141 +27,31 @@ pub struct Misspelling {
|
||||
}
|
||||
|
||||
impl Dictionary {
|
||||
/// The bundled English dictionary (decoded once).
|
||||
/// The English dictionary.
|
||||
pub fn english() -> &'static Dictionary {
|
||||
static D: OnceLock<Dictionary> = OnceLock::new();
|
||||
D.get_or_init(|| {
|
||||
let mut s = String::new();
|
||||
let _ = flate2::read::GzDecoder::new(WORDS_GZ).read_to_string(&mut s);
|
||||
Dictionary::from_list(&s)
|
||||
})
|
||||
}
|
||||
|
||||
/// Builds a dictionary from one word per line; `#NN` lines set the level of the words after.
|
||||
pub fn from_list(list: &str) -> Dictionary {
|
||||
let mut words = HashMap::new();
|
||||
let mut by_lower: HashMap<String, Vec<String>> = HashMap::new();
|
||||
let mut level = 50u8;
|
||||
for line in list.lines() {
|
||||
let w = line.trim();
|
||||
if let Some(l) = w.strip_prefix('#') {
|
||||
level = l.parse().unwrap_or(level);
|
||||
continue;
|
||||
}
|
||||
if w.is_empty() || words.contains_key(w) {
|
||||
continue;
|
||||
}
|
||||
words.insert(w.to_string(), level);
|
||||
by_lower.entry(w.to_lowercase()).or_default().push(w.to_string());
|
||||
}
|
||||
let mut by_len: Vec<Vec<(String, Vec<char>, u8)>> = Vec::new();
|
||||
for (lw, forms) in &by_lower {
|
||||
let n = lw.chars().count();
|
||||
if by_len.len() <= n {
|
||||
by_len.resize(n + 1, Vec::new());
|
||||
}
|
||||
let lvl = forms.iter().filter_map(|f| words.get(f)).min().copied().unwrap_or(50);
|
||||
by_len[n].push((lw.clone(), lw.chars().collect(), lvl));
|
||||
}
|
||||
for v in &mut by_len {
|
||||
v.sort();
|
||||
}
|
||||
Dictionary { words, by_lower, by_len }
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.words.len()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.words.is_empty()
|
||||
static D: Dictionary = Dictionary(());
|
||||
&D
|
||||
}
|
||||
|
||||
/// Whether `word` is spelled correctly (also accepting `user` words, compared without case).
|
||||
pub fn check(&self, word: &str, user: &HashSet<String>) -> bool {
|
||||
let w = normalize(word);
|
||||
let w = w.strip_suffix("'s").or_else(|| w.strip_suffix("'S")).filter(|b| !b.is_empty()).unwrap_or(&w);
|
||||
let (w, _) = stem(word);
|
||||
let w = w.trim_matches('\'');
|
||||
if w.is_empty() || w.chars().any(|c| c.is_numeric()) || !w.chars().any(char::is_alphabetic) {
|
||||
return true;
|
||||
}
|
||||
let lower = w.to_lowercase();
|
||||
if user.contains(&lower) || self.words.contains_key(w) {
|
||||
return true;
|
||||
}
|
||||
let Some(forms) = self.by_lower.get(&lower) else {
|
||||
return false;
|
||||
};
|
||||
let all_caps = w.chars().filter(|c| c.is_alphabetic()).all(char::is_uppercase);
|
||||
let first_cap = w.chars().next().is_some_and(char::is_uppercase) && w.chars().skip(1).all(|c| !c.is_uppercase());
|
||||
forms.iter().any(|f| {
|
||||
let f_lower = f.chars().all(|c| !c.is_uppercase());
|
||||
// "the" → "The"/"THE"; "Paris" → "PARIS"; "NASA" stays as listed (exact match above).
|
||||
all_caps || (f_lower && first_cap) || (first_cap && capitalize(f) == w)
|
||||
})
|
||||
user.contains(&w.to_lowercase()) || craft::proof::is_correct_with(w, &OPTIONS)
|
||||
}
|
||||
|
||||
/// Up to `max` suggestions for a misspelled word, nearest first (then most common), with the
|
||||
/// word's case pattern and possessive ending applied.
|
||||
/// Up to `max` suggestions for a misspelled word, best first, with its possessive ending kept.
|
||||
pub fn suggest(&self, word: &str, max: usize) -> Vec<String> {
|
||||
let (w, suffix) = stem(word);
|
||||
let normalized = normalize(word);
|
||||
let (w, suffix) = normalized
|
||||
.strip_suffix("'s")
|
||||
.filter(|w| !w.is_empty())
|
||||
.map(|w| (w, "'s"))
|
||||
.or_else(|| normalized.strip_suffix("'S").filter(|w| !w.is_empty()).map(|w| (w, "'S")))
|
||||
.unwrap_or((&normalized, ""));
|
||||
let lower = w.to_lowercase();
|
||||
let lc: Vec<char> = lower.chars().collect();
|
||||
let n = lc.len();
|
||||
let max_d = if n <= 4 { 1 } else { 2 };
|
||||
// Same letters in another order (transposed typing) ranks first among equal distances.
|
||||
let mut sorted = lc.clone();
|
||||
sorted.sort_unstable();
|
||||
let anagram = |c: &str| {
|
||||
let mut v: Vec<char> = c.chars().collect();
|
||||
v.sort_unstable();
|
||||
v == sorted
|
||||
};
|
||||
let mut found: Vec<(usize, bool, u8, &str)> = Vec::new();
|
||||
let mut rows = Rows::default();
|
||||
for len in n.saturating_sub(max_d)..=(n + max_d) {
|
||||
let Some(bucket) = self.by_len.get(len) else {
|
||||
continue;
|
||||
};
|
||||
for (cand, cc, lvl) in bucket {
|
||||
// The input's ending is restored below; do not append it to another possessive.
|
||||
if !suffix.is_empty() && cand.ends_with("'s") {
|
||||
continue;
|
||||
}
|
||||
if let Some(d) = distance(&lc, cc, max_d, &mut rows) {
|
||||
found.push((d, !anagram(cand), *lvl, cand));
|
||||
}
|
||||
}
|
||||
}
|
||||
found.sort();
|
||||
let all_caps = w.chars().filter(|c| c.is_alphabetic()).all(char::is_uppercase) && w.chars().filter(|c| c.is_alphabetic()).count() > 1;
|
||||
let first_cap = w.chars().next().is_some_and(char::is_uppercase);
|
||||
let mut out: Vec<String> = Vec::new();
|
||||
for (_, _, _, cand) in found {
|
||||
// Common (lowercase) forms before proper nouns: "brwon" → "brown", then "Brown".
|
||||
let mut forms: Vec<&String> = self.by_lower.get(cand).into_iter().flatten().collect();
|
||||
forms.sort_by_key(|f| f.chars().any(char::is_uppercase));
|
||||
for form in forms {
|
||||
let mut s = if all_caps {
|
||||
form.to_uppercase()
|
||||
} else if first_cap {
|
||||
capitalize(form)
|
||||
} else {
|
||||
form.clone()
|
||||
};
|
||||
s.push_str(suffix);
|
||||
if !out.contains(&s) && s != normalized {
|
||||
out.push(s);
|
||||
}
|
||||
}
|
||||
if out.len() >= max {
|
||||
break;
|
||||
for s in craft::proof::suggest(&w, max) {
|
||||
let s = format!("{s}{suffix}");
|
||||
if !out.contains(&s) && s != normalized {
|
||||
out.push(s);
|
||||
}
|
||||
}
|
||||
out.truncate(max);
|
||||
@@ -186,19 +68,23 @@ impl Dictionary {
|
||||
}
|
||||
}
|
||||
|
||||
/// `word` with typographic apostrophes as `'` and without a trailing possessive (`'s`/`'S`), and
|
||||
/// that ending.
|
||||
fn stem(word: &str) -> (String, &'static str) {
|
||||
let w = normalize(word);
|
||||
for suffix in ["'s", "'S"] {
|
||||
if let Some(b) = w.strip_suffix(suffix).filter(|b| !b.is_empty()) {
|
||||
return (b.to_string(), suffix);
|
||||
}
|
||||
}
|
||||
(w, "")
|
||||
}
|
||||
|
||||
/// Typographic apostrophes → `'`.
|
||||
fn normalize(w: &str) -> String {
|
||||
w.replace(['\u{2019}', '\u{2018}', '\u{02BC}'], "'")
|
||||
}
|
||||
|
||||
fn capitalize(w: &str) -> String {
|
||||
let mut c = w.chars();
|
||||
match c.next() {
|
||||
Some(f) => f.to_uppercase().chain(c).collect(),
|
||||
None => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Byte ranges of the words in `text`: letters/digits with inner apostrophes (hyphens split).
|
||||
pub fn words(text: &str) -> Vec<(usize, usize)> {
|
||||
let is_apos = |c: char| matches!(c, '\'' | '\u{2019}' | '\u{2018}' | '\u{02BC}');
|
||||
@@ -286,9 +172,8 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bundled_dictionary_loads() {
|
||||
fn english_dictionary_checks_words() {
|
||||
let d = Dictionary::english();
|
||||
assert!(d.len() > 70_000, "{}", d.len());
|
||||
for w in ["the", "The", "THE", "color", "colors", "running", "don't", "don’t", "Paris", "PARIS", "photographer's", "NASA"] {
|
||||
assert!(d.check(w, &none()), "{w}");
|
||||
}
|
||||
@@ -299,33 +184,36 @@ mod tests {
|
||||
assert!(d.check("2026", &none()) && d.check("B2B", &none()));
|
||||
}
|
||||
|
||||
/// The dictionary is craft-i18n's SCOWL (rel-2026.02.25), not the old in-tree SCOWL 50 list,
|
||||
/// which had neither word.
|
||||
#[test]
|
||||
fn suggestions_rank_by_distance_then_frequency() {
|
||||
fn english_dictionary_is_craft_i18ns() {
|
||||
let d = Dictionary::english();
|
||||
assert_eq!(d.suggest("teh", 3)[0], "the");
|
||||
assert!(d.suggest("recieve", 5).contains(&"receive".to_string()));
|
||||
assert_eq!(d.suggest("Wrold", 1), vec!["World".to_string()]);
|
||||
assert_eq!(d.suggest("brwon", 1), vec!["brown".to_string()]);
|
||||
for w in ["livestream", "vlog"] {
|
||||
assert!(d.check(w, &none()), "{w}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn suggestions_offer_the_correction() {
|
||||
let d = Dictionary::english();
|
||||
let has = |word: &str, want: &str| d.suggest(word, 5).contains(&want.to_string());
|
||||
assert!(has("teh", "the") && has("recieve", "receive") && has("brwon", "brown"));
|
||||
assert!(has("Wrold", "World"), "{:?}", d.suggest("Wrold", 5));
|
||||
assert_eq!(d.suggest("HELO", 5).first().map(|s| s.chars().all(|c| c.is_uppercase())), Some(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn possessive_suggestions_keep_the_ending_and_case() {
|
||||
let d = Dictionary::from_list("#10\nworld\nworlds\nMonday\n");
|
||||
for (word, want) in [("wrold's", "world's"), ("Wrold's", "World's"), ("WROLD'S", "WORLD'S"), ("WROLD's", "WORLD's"), ("Mnday's", "Monday's")] {
|
||||
assert_eq!(d.suggest(word, 1), vec![want.to_string()], "{word}");
|
||||
fn possessive_suggestions_keep_the_ending() {
|
||||
let d = Dictionary::english();
|
||||
for (word, want) in [("wrold's", "world's"), ("Wrold's", "World's"), ("Mnday's", "Monday's")] {
|
||||
assert!(d.suggest(word, 5).contains(&want.to_string()), "{word}: {:?}", d.suggest(word, 5));
|
||||
}
|
||||
assert!(d.suggest("wrold's", 0).is_empty());
|
||||
assert_eq!(d.suggest("wrold", 1), vec!["world".to_string()]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn possessive_suggestions_normalize_apostrophes_without_doubling_the_ending() {
|
||||
let d = Dictionary::from_list("world\nworld's\n");
|
||||
for apostrophe in ['\'', '\u{2019}', '\u{2018}', '\u{02BC}'] {
|
||||
assert_eq!(d.suggest(&format!("wrold{apostrophe}s"), 1), vec!["world's".to_string()]);
|
||||
let found = d.suggest(&format!("wrold{apostrophe}s"), 5);
|
||||
assert!(found.contains(&"world's".to_string()) && !found.iter().any(|s| s.ends_with("'s's")), "{found:?}");
|
||||
}
|
||||
assert!(d.suggest("world's", 8).is_empty(), "a listed possessive must not gain a second ending");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -340,7 +228,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn misspellings_and_user_words() {
|
||||
let d = Dictionary::from_list("#10\nhello\nworld\nParis\n");
|
||||
let d = Dictionary::english();
|
||||
let text = "Hello wrld, Paris paris photocraft 42x";
|
||||
let m: Vec<String> = d.misspellings(text, &none()).into_iter().map(|m| m.word).collect();
|
||||
assert_eq!(m, vec!["wrld", "paris", "photocraft"]);
|
||||
|
||||
@@ -18,4 +18,4 @@ Screenshots must use famous public-domain artwork (or content made in the app),
|
||||
|
||||
| File | Content | Source / licence |
|
||||
|---|---|---|
|
||||
| `assets/dict/en_US-scowl-50.txt.gz` | English word list (72,403 words, American spelling) for Edit › Check Spelling | [SCOWL](http://wordlist.aspell.net/) 2020.12.07, size 50, by Kevin Atkinson: permissive licence (use, copy, modify, distribute and sell, keeping the notice); full text and build recipe in `assets/dict/LICENSE-SCOWL.txt`. |
|
||||
| `assets/dict/LICENSE-SCOWL.txt` | The SCOWL notice for the English dictionary craft-proof embeds from craft-i18n for Edit › Check Spelling | Copy of craft-i18n's `language-data/en-us/LICENCE-SCOWL.txt` ([SCOWL](http://wordlist.aspell.net/), by Kevin Atkinson: permissive licence, keep the notice). |
|
||||
Reference in new issue
Block a user