Skip to content

Commit

Permalink
#292 remove addition of 'Scribe' and contracted preps to db
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis committed Apr 22, 2023
1 parent 9475942 commit 2b3f291
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 40 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ Emojis for the following are chosen based on [gitmoji](https://gitmoji.dev/).
- The steps to install the keyboard are no longer underlined to increase readability.
<!-- - The iPad keyboard layouts are more reflective of system keyboard designs in terms of key widths and key positioning. -->

### 🐞 Bug Fixes

- Fixed a bug where the word "Scribe" was not being added into the nouns by shifting this to Scribe-Data.
- Fixed a bug where German contracted prepositions were not being added by shifting this to Scribe-Data.

### ♻️ Code Refactoring

- All unnecessary explicit boolean checks were removed from the codes in favor of implicit checks.
Expand Down
3 changes: 0 additions & 3 deletions Keyboards/KeyboardsBase/KeyboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1487,9 +1487,6 @@ class KeyboardViewController: UIInputViewController {
// Initialize the language database and create the autosuggestions lexicon.
languageDB = openDBQueue()

// Expand the language database with some select words that are needed for Scribe.
expandLanguageDataset()

// Add UILexicon words including unpaired first and last names from Contacts to autocompletions.
let addToAutocompleteLexiconQuery = "INSERT OR IGNORE INTO autocomplete_lexicon (word) VALUES (?)"
requestSupplementaryLexicon { (userLexicon: UILexicon!) in
Expand Down
28 changes: 0 additions & 28 deletions Keyboards/KeyboardsBase/LoadData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,6 @@ func writeDBRow(query: String, args: StatementArguments) {
} catch {}
}

/// Performs a few minor edits to language data to make sure that certain values are included.
func expandLanguageDataset() {
// Make sure that Scribe shows up in auto actions.
let checkScribeQuery = "SELECT * FROM nouns WHERE noun = ?"
let args = ["Scribe"]
let outputCols = ["noun"]
let scribeOrEmptyString = queryDBRow(query: checkScribeQuery, outputCols: outputCols, args: args)[0]

if scribeOrEmptyString == "" {
let addScribeQuery = "INSERT OR IGNORE INTO nouns (noun, plural, form) VALUES (?, ?, ?)"
writeDBRow(query: addScribeQuery, args: ["Scribe", "Scribes", ""])
writeDBRow(query: addScribeQuery, args: ["Scribes", "isPlural", "PL"])
}

// Add German compound prepositions to the prepositions table so they also receive annotations.
if controllerLanguage == "German" {
let prepositionsInsertQuery = "INSERT OR IGNORE INTO prepositions (preposition, form) VALUES (?, ?)"
for (p, f) in contractedGermanPrepositions {
writeDBRow(query: prepositionsInsertQuery, args: [p, f])
}

let autocompletionsInsertQuery = "INSERT OR IGNORE INTO autocomplete_lexicon (word) VALUES (?)"
for (p, _) in contractedGermanPrepositions {
writeDBRow(query: autocompletionsInsertQuery, args: [p])
}
}
}

/// Returns the next three words in the `autocomplete_lexicon` that follow a given word.
///
/// - Parameters
Expand Down
9 changes: 0 additions & 9 deletions Keyboards/LanguageKeyboards/German/DECommandVariables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,6 @@ var deConjugationState: DEConjugationState = .indicativePresent
var deCaseDeclensionState: DECaseDeclensionState = .accusative
var deCaseVariantDeclensionState: DECaseVariantDeclensionState = .disabled

// Contracted versions of German prepositions (ex: an + dem = am).
let contractedGermanPrepositions = [
"am": "Acc/Dat", "ans": "Acc/Dat", "aufs": "Acc/Dat", "beim": "Dat",
"durchs": "Acc", "fürs": "Acc", "hinters": "Acc/Dat", "hinterm": "Acc/Dat",
"ins": "Acc/Dat", "im": "Acc/Dat", "übers": "Acc/Dat", "überm": "Acc/Dat",
"ums": "Acc", "unters": "Acc/Dat", "unterm": "Acc/Dat", "vom": "Dat",
"vors": "Acc/Dat", "vorm": "Acc/Dat", "zum": "Dat", "zur": "Dat",
]

/// Sets the title of the command bar when the keyboard is in conjugate mode.
func deGetConjugationTitle() -> String {
if inputWordIsCapitalized {
Expand Down

0 comments on commit 2b3f291

Please sign in to comment.