Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Cotabby.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extension SuggestionCoordinator {
currentWord: prefix, enabledLanguages: languages)
let candidates = language.map { symSpellCorrector.completionCandidates(for: prefix, language: $0) } ?? []
return WordCompletionFallback.suffix(for: prefix, references: completionReferenceWords(context: context),
dictionaryCandidates: candidates)
dictionaryCandidates: candidates, locale: language?.caseLocale)
}

func wasDismissed(_ text: String, context: FocusedInputContext) -> Bool {
Expand Down
17 changes: 17 additions & 0 deletions Cotabby/Models/Spelling/SpellingDictionaryCatalog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ nonisolated enum SpellingDictionaryLanguage: String, CaseIterable, Codable, Hash
case hebrew = "he"
case italian = "it"
case russian = "ru"
case turkish = "tr"
case macedonian = "mk"

var id: String { rawValue }

Expand All @@ -26,6 +28,8 @@ nonisolated enum SpellingDictionaryLanguage: String, CaseIterable, Codable, Hash
case .hebrew: return "Hebrew"
case .italian: return "Italian"
case .russian: return "Russian"
case .turkish: return "Turkish"
case .macedonian: return "Macedonian"
}
}

Expand All @@ -39,6 +43,8 @@ nonisolated enum SpellingDictionaryLanguage: String, CaseIterable, Codable, Hash
case .hebrew: return "עברית (Hebrew)"
case .italian: return "Italiano (Italian)"
case .russian: return "Русский (Russian)"
case .turkish: return "Türkçe (Turkish)"
case .macedonian: return "Македонски (Macedonian)"
}
}

Expand All @@ -54,8 +60,19 @@ nonisolated enum SpellingDictionaryLanguage: String, CaseIterable, Codable, Hash
case .hebrew: return "he-100k"
case .italian: return "it-100k"
case .russian: return "ru-100k"
// Not from SymSpell (it publishes no Turkish or Macedonian list): built from OpenSubtitles
// frequencies filtered through Hunspell, as documented in SpellingDictionaries/NOTICE.md.
case .turkish: return "tr-100k"
case .macedonian: return "mk-100k"
}
}

/// Locale for case conversion. Turkish pairs dotted and dotless i differently from every
/// other bundled language (I ↔ ı, İ ↔ i), so locale-free `lowercased()` would turn a
/// capitalized Turkish word into one the dictionary does not contain.
var caseLocale: Locale {
Locale(identifier: rawValue)
}
}

/// Pure catalog rules for the spelling-dictionary setting.
Expand Down
428 changes: 428 additions & 0 deletions Cotabby/Resources/SpellingDictionaries/Licenses/CC-BY-SA-4.0.txt

Large diffs are not rendered by default.

693 changes: 693 additions & 0 deletions Cotabby/Resources/SpellingDictionaries/Licenses/mk.txt

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions Cotabby/Resources/SpellingDictionaries/Licenses/tr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014 Harun Reşit Zafer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

27 changes: 26 additions & 1 deletion Cotabby/Resources/SpellingDictionaries/NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,32 @@ latest repository revision before SymSpell published these derived files.
| Italian | GPL-3.0 | `Licenses/it.txt` |
| Russian | Package metadata: LGPL-3.0; source notice contains additional redistribution terms | `Licenses/ru.txt` |

Complete GPL-3.0, LGPL-3.0, AGPL-3.0, and MPL-2.0 texts are included in `Licenses/`.
Complete GPL-3.0, LGPL-3.0, AGPL-3.0, MPL-2.0, and CC BY-SA 4.0 texts are included in `Licenses/`.

## Turkish and Macedonian

SymSpell publishes no Turkish or Macedonian dictionary, so these two files were built with the same
method SymSpell used (corpus frequencies intersected with a Hunspell word list) by
`scripts/build_hunspell_frequency_dictionary.py`, which reproduces them byte for byte:

| File | Language | SHA-256 |
| --- | --- | --- |
| `tr-100k.txt` | Turkish | `6c927006c2b3330bbb73675970f2ef21b8f36e19c9750d9989e47253dd7366f3` |
| `mk-100k.txt` | Macedonian | `034f5022fb98c9bbd1b3951c95fb58501fcac0fe07ea6a07ea5cf3e43a6f963d` |

- **Frequencies:** `hermitdave/FrequencyWords` commit `525f9b560de45753a5ea01069454e72e9aa541c6`,
`content/2018/{tr,mk}/*_full.txt`, generated from the OpenSubtitles 2018 corpus
(P. Lison and J. Tiedemann, 2016, "OpenSubtitles2016: Extracting Large Parallel Corpora from Movie
and TV Subtitles", http://opus.nlpl.eu/OpenSubtitles2018.php; http://www.opensubtitles.org/).
FrequencyWords licenses its content under CC BY-SA 4.0 (`Licenses/CC-BY-SA-4.0.txt`); the two
derived files are distributed under the same license.
- **Spelling validation:** `wooorm/dictionaries` commit `8cfea406b505e4d7df52d5a19bce525df98c54ab`,
checked with Hunspell 1.7.4. Only words Hunspell accepts are kept.

| Language | Hunspell dictionary license | Bundled notice |
| --- | --- | --- |
| Turkish | MIT (Harun Reşit Zafer) | `Licenses/tr.txt` |
| Macedonian | GPL-3.0-or-later (Dimitrij Mijoski) | `Licenses/mk.txt` |

Google Books Ngram data is licensed under
[CC BY 3.0](https://creativecommons.org/licenses/by/3.0/).
Loading