diff --git a/Toki Trainer.xcodeproj/project.pbxproj b/Toki Trainer.xcodeproj/project.pbxproj index ad19b53..9eb81f4 100644 --- a/Toki Trainer.xcodeproj/project.pbxproj +++ b/Toki Trainer.xcodeproj/project.pbxproj @@ -7,6 +7,12 @@ objects = { /* Begin PBXBuildFile section */ + 7E2811172733027F0063DC78 /* TokiDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E2811142733027F0063DC78 /* TokiDictionary.swift */; }; + 7E2811182733027F0063DC78 /* TokiJSONLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E2811152733027F0063DC78 /* TokiJSONLoader.swift */; }; + 7E2811192733027F0063DC78 /* TokiPartOfSpeech.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E2811162733027F0063DC78 /* TokiPartOfSpeech.swift */; }; + 7E28111C273302860063DC78 /* toki-partsofspeech.json in Resources */ = {isa = PBXBuildFile; fileRef = 7E28111A273302860063DC78 /* toki-partsofspeech.json */; }; + 7E28111D273302860063DC78 /* toki-dictionary.json in Resources */ = {isa = PBXBuildFile; fileRef = 7E28111B273302860063DC78 /* toki-dictionary.json */; }; + 7E281120273303220063DC78 /* TokiPartsOfSpeechProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E28111F273303220063DC78 /* TokiPartsOfSpeechProvider.swift */; }; 7E943A21273211C200E7DDF4 /* Toki_TrainerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E943A20273211C200E7DDF4 /* Toki_TrainerApp.swift */; }; 7E943A23273211C200E7DDF4 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E943A22273211C200E7DDF4 /* ContentView.swift */; }; 7E943A25273211C300E7DDF4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7E943A24273211C300E7DDF4 /* Assets.xcassets */; }; @@ -16,6 +22,12 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 7E2811142733027F0063DC78 /* TokiDictionary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokiDictionary.swift; sourceTree = ""; }; + 7E2811152733027F0063DC78 /* TokiJSONLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokiJSONLoader.swift; sourceTree = ""; }; + 7E2811162733027F0063DC78 /* TokiPartOfSpeech.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokiPartOfSpeech.swift; sourceTree = ""; }; + 7E28111A273302860063DC78 /* toki-partsofspeech.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "toki-partsofspeech.json"; sourceTree = ""; }; + 7E28111B273302860063DC78 /* toki-dictionary.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "toki-dictionary.json"; sourceTree = ""; }; + 7E28111F273303220063DC78 /* TokiPartsOfSpeechProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokiPartsOfSpeechProvider.swift; sourceTree = ""; }; 7E943A1D273211C200E7DDF4 /* Toki Trainer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Toki Trainer.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 7E943A20273211C200E7DDF4 /* Toki_TrainerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toki_TrainerApp.swift; sourceTree = ""; }; 7E943A22273211C200E7DDF4 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -36,6 +48,42 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 7E281111273302420063DC78 /* Models */ = { + isa = PBXGroup; + children = ( + 7E2811142733027F0063DC78 /* TokiDictionary.swift */, + 7E2811152733027F0063DC78 /* TokiJSONLoader.swift */, + 7E2811162733027F0063DC78 /* TokiPartOfSpeech.swift */, + ); + path = Models; + sourceTree = ""; + }; + 7E2811122733024F0063DC78 /* Views */ = { + isa = PBXGroup; + children = ( + 7E943A20273211C200E7DDF4 /* Toki_TrainerApp.swift */, + 7E943A22273211C200E7DDF4 /* ContentView.swift */, + ); + path = Views; + sourceTree = ""; + }; + 7E281113273302530063DC78 /* States */ = { + isa = PBXGroup; + children = ( + 7E28111F273303220063DC78 /* TokiPartsOfSpeechProvider.swift */, + ); + path = States; + sourceTree = ""; + }; + 7E28111E273302890063DC78 /* JSON Data */ = { + isa = PBXGroup; + children = ( + 7E28111B273302860063DC78 /* toki-dictionary.json */, + 7E28111A273302860063DC78 /* toki-partsofspeech.json */, + ); + path = "JSON Data"; + sourceTree = ""; + }; 7E943A14273211C200E7DDF4 = { isa = PBXGroup; children = ( @@ -55,8 +103,10 @@ 7E943A1F273211C200E7DDF4 /* Toki Trainer */ = { isa = PBXGroup; children = ( - 7E943A20273211C200E7DDF4 /* Toki_TrainerApp.swift */, - 7E943A22273211C200E7DDF4 /* ContentView.swift */, + 7E28111E273302890063DC78 /* JSON Data */, + 7E281113273302530063DC78 /* States */, + 7E2811122733024F0063DC78 /* Views */, + 7E281111273302420063DC78 /* Models */, 7E943A24273211C300E7DDF4 /* Assets.xcassets */, 7E943A29273211C300E7DDF4 /* Persistence.swift */, 7E943A2B273211C300E7DDF4 /* Toki_Trainer.xcdatamodeld */, @@ -133,6 +183,8 @@ files = ( 7E943A28273211C300E7DDF4 /* Preview Assets.xcassets in Resources */, 7E943A25273211C300E7DDF4 /* Assets.xcassets in Resources */, + 7E28111D273302860063DC78 /* toki-dictionary.json in Resources */, + 7E28111C273302860063DC78 /* toki-partsofspeech.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -145,8 +197,12 @@ files = ( 7E943A2D273211C300E7DDF4 /* Toki_Trainer.xcdatamodeld in Sources */, 7E943A2A273211C300E7DDF4 /* Persistence.swift in Sources */, + 7E2811192733027F0063DC78 /* TokiPartOfSpeech.swift in Sources */, + 7E281120273303220063DC78 /* TokiPartsOfSpeechProvider.swift in Sources */, 7E943A23273211C200E7DDF4 /* ContentView.swift in Sources */, + 7E2811172733027F0063DC78 /* TokiDictionary.swift in Sources */, 7E943A21273211C200E7DDF4 /* Toki_TrainerApp.swift in Sources */, + 7E2811182733027F0063DC78 /* TokiJSONLoader.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Toki Trainer/ContentView.swift b/Toki Trainer/ContentView.swift deleted file mode 100644 index 1d8ff33..0000000 --- a/Toki Trainer/ContentView.swift +++ /dev/null @@ -1,88 +0,0 @@ -// -// ContentView.swift -// Toki Trainer -// -// Created by Avery Ada Pace on 11/2/21. -// - -import SwiftUI -import CoreData - -struct ContentView: View { - @Environment(\.managedObjectContext) private var viewContext - - @FetchRequest( - sortDescriptors: [NSSortDescriptor(keyPath: \Item.timestamp, ascending: true)], - animation: .default) - private var items: FetchedResults - - var body: some View { - NavigationView { - List { - ForEach(items) { item in - NavigationLink { - Text("Item at \(item.timestamp!, formatter: itemFormatter)") - } label: { - Text(item.timestamp!, formatter: itemFormatter) - } - } - .onDelete(perform: deleteItems) - } - .toolbar { - ToolbarItem(placement: .navigationBarTrailing) { - EditButton() - } - ToolbarItem { - Button(action: addItem) { - Label("Add Item", systemImage: "plus") - } - } - } - Text("Select an item") - } - } - - private func addItem() { - withAnimation { - let newItem = Item(context: viewContext) - newItem.timestamp = Date() - - do { - try viewContext.save() - } catch { - // Replace this implementation with code to handle the error appropriately. - // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. - let nsError = error as NSError - fatalError("Unresolved error \(nsError), \(nsError.userInfo)") - } - } - } - - private func deleteItems(offsets: IndexSet) { - withAnimation { - offsets.map { items[$0] }.forEach(viewContext.delete) - - do { - try viewContext.save() - } catch { - // Replace this implementation with code to handle the error appropriately. - // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. - let nsError = error as NSError - fatalError("Unresolved error \(nsError), \(nsError.userInfo)") - } - } - } -} - -private let itemFormatter: DateFormatter = { - let formatter = DateFormatter() - formatter.dateStyle = .short - formatter.timeStyle = .medium - return formatter -}() - -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView().environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) - } -} diff --git a/Toki Trainer/JSON Data/toki-dictionary.json b/Toki Trainer/JSON Data/toki-dictionary.json new file mode 100644 index 0000000..d793001 --- /dev/null +++ b/Toki Trainer/JSON Data/toki-dictionary.json @@ -0,0 +1,1751 @@ +[ + { + "word": "a", + "definitions": [ + { + "pos": "interj", + "definition": "ah, ha, uh, oh, ooh, aw, well (emotion word)" + } + ] + }, + { + "word": "akesi", + "definitions": [ + { + "pos": "n", + "definition": "non-cute animal, reptile, amphibian" + } + ] + }, + { + "word": "ala", + "definitions": [ + { + "pos": "mod", + "definition": "no, not, none, un-" + }, + { + "pos": "n", + "definition": "nothing, negation, zero" + }, + { + "pos": "interj", + "definition": "no!" + } + ] + }, + { + "word": "alasa", + "definitions": [ + { + "pos": "vt", + "definition": "gather, hunt" + } + ] + }, + { + "word": "ale", + "definitions": [ + { + "pos": "n", + "definition": "everything, anything, life, the universe" + }, + { + "pos": "mod", + "definition": "all, every, complete, whole" + } + ] + }, + { + "word": "ali", + "definitions": [ + { + "pos": "n", + "definition": "everything, anything, life, the universe" + }, + { + "pos": "mod", + "definition": "all, every, complete, whole" + } + ] + }, + { + "word": "anpa", + "definitions": [ + { + "pos": "n", + "definition": "bottom, lower part, under, below, floor, beneath" + }, + { + "pos": "mod", + "definition": "low, lower, bottom, down" + } + ] + }, + { + "word": "ante", + "definitions": [ + { + "pos": "n", + "definition": "difference" + }, + { + "pos": "mod", + "definition": "different" + }, + { + "pos": "conj", + "definition": "otherwise, or else" + }, + { + "pos": "vt", + "definition": "change, alter, modify" + } + ] + }, + { + "word": "anu", + "definitions": [ + { + "pos": "conj", + "definition": "or" + } + ] + }, + { + "word": "awen", + "definitions": [ + { + "pos": "vi", + "definition": "stay, wait, remain" + }, + { + "pos": "vt", + "definition": "keep" + }, + { + "pos": "mod", + "definition": "remaining, stationary, permanent, sedentary" + } + ] + }, + { + "word": "e", + "definitions": [ + { + "pos": "sep", + "definition": "(introduces a direct object)" + } + ] + }, + { + "word": "en", + "definitions": [ + { + "pos": "conj", + "definition": "and (used to coordinate head nouns)" + } + ] + }, + { + "word": "esun", + "definitions": [ + { + "pos": "n", + "definition": "market, shop" + } + ] + }, + { + "word": "ijo", + "definitions": [ + { + "pos": "n", + "definition": "thing, something, stuff, anything, object" + }, + { + "pos": "mod", + "definition": "of something" + }, + { + "pos": "vt", + "definition": "objectify" + } + ] + }, + { + "word": "ike", + "definitions": [ + { + "pos": "mod", + "definition": "bad, negative, wrong, evil, overly complex, (figuratively) unhealthy" + }, + { + "pos": "interj", + "definition": "oh dear! woe! alas!" + }, + { + "pos": "n", + "definition": "negativity, badness, evil" + }, + { + "pos": "vt", + "definition": "to make bad, to worsen, to have a negative effect upon" + }, + { + "pos": "vi", + "definition": "to be bad, to suck" + }, + { + "pos": "extra", + "definition": "[sounds like icky]" + } + ] + }, + { + "word": "ilo", + "definitions": [ + { + "pos": "n", + "definition": "tool, device, machine, thing used for a specific purpose" + } + ] + }, + { + "word": "insa", + "definitions": [ + { + "pos": "n", + "definition": "inside, inner world, centre, stomach" + }, + { + "pos": "mod", + "definition": "inner, internal" + }, + { + "pos": "extra", + "definition": "[inside]" + } + ] + }, + { + "word": "jaki", + "definitions": [ + { + "pos": "mod", + "definition": "dirty, gross, filthy" + }, + { + "pos": "n", + "definition": "dirt, pollution, garbage, filth" + }, + { + "pos": "vt", + "definition": "pollute, dirty" + }, + { + "pos": "interj", + "definition": "ew! yuck!" + }, + { + "pos": "extra", + "definition": "[yucky]" + } + ] + }, + { + "word": "jan", + "definitions": [ + { + "pos": "n", + "definition": "person, people, human, being, somebody, anybody" + }, + { + "pos": "mod", + "definition": "human, somebody's, personal, of people" + }, + { + "pos": "vt", + "definition": "personify, humanize, personalize" + } + ] + }, + { + "word": "jelo", + "definitions": [ + { + "pos": "mod", + "definition": "yellow, light green" + }, + { + "pos": "extra", + "definition": "[yellow]" + } + ] + }, + { + "word": "jo", + "definitions": [ + { + "pos": "vt", + "definition": "have, contain" + }, + { + "pos": "n", + "definition": "having" + }, + { + "pos": "kama", + "definition": "receive, get, take, obtain" + } + ] + }, + { + "word": "kala", + "definitions": [ + { + "pos": "n", + "definition": "fish, sea creature" + } + ] + }, + { + "word": "kalama", + "definitions": [ + { + "pos": "n", + "definition": "sound, noise, voice" + }, + { + "pos": "vi", + "definition": "make noise" + }, + { + "pos": "vt", + "definition": "sound, ring, play (an instrument)" + } + ] + }, + { + "word": "kama", + "definitions": [ + { + "pos": "vi", + "definition": "come, become, arrive, happen, pursue actions to arrive to (a certain state), manage to, start to" + }, + { + "pos": "n", + "definition": "event, happening, chance, arrival, beginning" + }, + { + "pos": "mod", + "definition": "coming, future" + }, + { + "pos": "vt", + "definition": "bring about, summon" + }, + { + "pos": "extra", + "definition": "[come up]" + } + ] + }, + { + "word": "kasi", + "definitions": [ + { + "pos": "n", + "definition": "plant, leaf, herb, tree, wood" + } + ] + }, + { + "word": "ken", + "definitions": [ + { + "pos": "vi", + "definition": "can, is able to, is allowed to, may, is possible" + }, + { + "pos": "n", + "definition": "possibility, ability, power to do things, permission" + }, + { + "pos": "vt", + "definition": "make possible, enable, allow, permit" + }, + { + "pos": "cont", + "definition": "it is possible that" + } + ] + }, + { + "word": "kepeken", + "definitions": [ + { + "pos": "vt", + "definition": "use" + }, + { + "pos": "prep", + "definition": "with" + } + ] + }, + { + "word": "kili", + "definitions": [ + { + "pos": "n", + "definition": "fruit, pulpy vegetable, mushroom" + } + ] + }, + { + "word": "kin", + "definitions": [ + { + "pos": "mod", + "definition": "also, too, even, indeed (emphasizes the word(s) before it)" + } + ] + }, + { + "word": "kipisi", + "definitions": [ + { + "pos": "extra", + "definition": "(yet undefined entry in the official word list)" + } + ] + }, + { + "word": "kiwen", + "definitions": [ + { + "pos": "mod", + "definition": "hard, solid, stone-like, made of stone or metal" + }, + { + "pos": "n", + "definition": "hard thing, rock, stone, metal, mineral, clay" + } + ] + }, + { + "word": "ko", + "definitions": [ + { + "pos": "n", + "definition": "semi-solid or squishy substance, e.g. paste, powder, gum" + } + ] + }, + { + "word": "kon", + "definitions": [ + { + "pos": "n", + "definition": "air, wind, smell, soul" + }, + { + "pos": "mod", + "definition": "air-like, ethereal, gaseous" + } + ] + }, + { + "word": "kule", + "definitions": [ + { + "pos": "n", + "definition": "colour, paint" + }, + { + "pos": "mod", + "definition": "colourful" + }, + { + "pos": "vt", + "definition": "colour, paint" + } + ] + }, + { + "word": "kulupu", + "definitions": [ + { + "pos": "n", + "definition": "group, community, society, company, people" + }, + { + "pos": "mod", + "definition": "communal, shared, public, of the society" + } + ] + }, + { + "word": "kute", + "definitions": [ + { + "pos": "vt", + "definition": "listen, hear" + }, + { + "pos": "mod", + "definition": "auditory, hearing" + } + ] + }, + { + "word": "la", + "definitions": [ + { + "pos": "sep", + "definition": "(between adverb or phrase of context and sentence)" + } + ] + }, + { + "word": "lape", + "definitions": [ + { + "pos": "n", + "definition": "n, vi sleep, rest" + }, + { + "pos": "mod", + "definition": "sleeping, of sleep" + } + ] + }, + { + "word": "laso", + "definitions": [ + { + "pos": "mod", + "definition": "blue, blue-green" + } + ] + }, + { + "word": "lawa", + "definitions": [ + { + "pos": "n", + "definition": "head, mind" + }, + { + "pos": "mod", + "definition": "main, leading, in charge" + }, + { + "pos": "vt", + "definition": "lead, control, rule, steer" + } + ] + }, + { + "word": "len", + "definitions": [ + { + "pos": "n", + "definition": "clothing, cloth, fabric" + } + ] + }, + { + "word": "lete", + "definitions": [ + { + "pos": "n", + "definition": "cold" + }, + { + "pos": "mod", + "definition": "cold, uncooked" + }, + { + "pos": "vt", + "definition": "cool down, chill" + } + ] + }, + { + "word": "li", + "definitions": [ + { + "pos": "sep", + "definition": "\\\"(between any subject except mi and sina and its verb\": null, \" also used to introduce a new verb for the same subject)\\\"" + } + ] + }, + { + "word": "lili", + "definitions": [ + { + "pos": "mod", + "definition": "small, little, young, a bit, short, few, less" + }, + { + "pos": "vt", + "definition": "reduce, shorten, shrink, lessen" + } + ] + }, + { + "word": "linja", + "definitions": [ + { + "pos": "n", + "definition": "long, very thin, floppy thing, e.g. string, rope, hair, thread, cord, chain" + } + ] + }, + { + "word": "lipu", + "definitions": [ + { + "pos": "n", + "definition": "flat and bendable thing, e.g. paper, card, ticket" + } + ] + }, + { + "word": "loje", + "definitions": [ + { + "pos": "mod", + "definition": "red" + } + ] + }, + { + "word": "lon", + "definitions": [ + { + "pos": "prep", + "definition": "be (located) in/at/on" + }, + { + "pos": "vi", + "definition": "be there, be present, be real/true, exist, be awake" + } + ] + }, + { + "word": "luka", + "definitions": [ + { + "pos": "n", + "definition": "hand, arm" + } + ] + }, + { + "word": "lukin", + "definitions": [ + { + "pos": "vt", + "definition": "see, look at, watch, read" + }, + { + "pos": "vi", + "definition": "look, watch out, pay attention" + }, + { + "pos": "mod", + "definition": "visual(ly)" + }, + { + "pos": "extra", + "definition": "[looking]" + } + ] + }, + { + "word": "lupa", + "definitions": [ + { + "pos": "n", + "definition": "hole, orifice, window, door" + }, + { + "pos": "extra", + "definition": "[sounds like loop]" + } + ] + }, + { + "word": "ma", + "definitions": [ + { + "pos": "n", + "definition": "land, earth, country, (outdoor) area" + } + ] + }, + { + "word": "mama", + "definitions": [ + { + "pos": "n", + "definition": "parent, mother, father" + }, + { + "pos": "mod", + "definition": "of the parent, parental, maternal, fatherly" + }, + { + "pos": "extra", + "definition": "[sounds like momma]" + } + ] + }, + { + "word": "mani", + "definitions": [ + { + "pos": "n", + "definition": "money, material wealth, currency, dollar, capital" + }, + { + "pos": "extra", + "definition": "[money]" + } + ] + }, + { + "word": "meli", + "definitions": [ + { + "pos": "n", + "definition": "woman, female, girl, wife, girlfriend" + }, + { + "pos": "mod", + "definition": "female, feminine, womanly" + }, + { + "pos": "extra", + "definition": "[Mary]" + } + ] + }, + { + "word": "mi", + "definitions": [ + { + "pos": "n", + "definition": "I, we" + }, + { + "pos": "mod", + "definition": "my, our" + }, + { + "pos": "extra", + "definition": "[me]" + } + ] + }, + { + "word": "mije", + "definitions": [ + { + "pos": "n", + "definition": "man, male, boy, husband, boyfriend" + }, + { + "pos": "mod", + "definition": "male, masculine, manly" + } + ] + }, + { + "word": "moku", + "definitions": [ + { + "pos": "n", + "definition": "food, meal" + }, + { + "pos": "vt", + "definition": "eat, drink, swallow, ingest, consume" + } + ] + }, + { + "word": "moli", + "definitions": [ + { + "pos": "n", + "definition": "death" + }, + { + "pos": "vi", + "definition": "die, be dead" + }, + { + "pos": "vt", + "definition": "kill" + }, + { + "pos": "mod", + "definition": "dead, deadly, fatal" + } + ] + }, + { + "word": "monsi", + "definitions": [ + { + "pos": "n", + "definition": "back, rear end, butt, behind" + }, + { + "pos": "mod", + "definition": "back, rear" + } + ] + }, + { + "word": "mu", + "definitions": [ + { + "pos": "interj", + "definition": "woof! meow! moo! etc. (cute animal noise)" + }, + { + "pos": "extra", + "definition": "[moo]" + } + ] + }, + { + "word": "mun", + "definitions": [ + { + "pos": "n", + "definition": "moon" + }, + { + "pos": "mod", + "definition": "lunar" + }, + { + "pos": "extra", + "definition": "[moon]" + } + ] + }, + { + "word": "musi", + "definitions": [ + { + "pos": "n", + "definition": "fun, playing, game, recreation, art, entertainment" + }, + { + "pos": "mod", + "definition": "artful, fun, recreational" + }, + { + "pos": "vi", + "definition": "play, have fun" + }, + { + "pos": "vt", + "definition": "amuse, entertain" + } + ] + }, + { + "word": "mute", + "definitions": [ + { + "pos": "mod", + "definition": "many, very, much, several, a lot, abundant, numerous, more" + }, + { + "pos": "n", + "definition": "amount, quantity" + }, + { + "pos": "vt", + "definition": "make many or much" + }, + { + "pos": "extra", + "definition": "[multi]" + } + ] + }, + { + "word": "namako", + "definitions": [ + { + "pos": "n", + "definition": "food additive, accessory, something extra" + }, + { + "pos": "vt", + "definition": "season, embellish, stimulate" + } + ] + }, + { + "word": "nanpa", + "definitions": [ + { + "pos": "n", + "definition": "number" + }, + { + "pos": "oth", + "definition": "-th (ordinal numbers)" + }, + { + "pos": "extra", + "definition": "[number]" + } + ] + }, + { + "word": "nasa", + "definitions": [ + { + "pos": "mod", + "definition": "silly, crazy, foolish, drunk, strange, stupid, weird" + }, + { + "pos": "vt", + "definition": "drive crazy, make weird" + } + ] + }, + { + "word": "nasin", + "definitions": [ + { + "pos": "n", + "definition": "way, manner, custom, road, path, doctrine, system, method" + } + ] + }, + { + "word": "nena", + "definitions": [ + { + "pos": "n", + "definition": "bump, nose, hill, mountain, button" + } + ] + }, + { + "word": "ni", + "definitions": [ + { + "pos": "mod", + "definition": "this, that" + } + ] + }, + { + "word": "nimi", + "definitions": [ + { + "pos": "n", + "definition": "word, name" + } + ] + }, + { + "word": "noka", + "definitions": [ + { + "pos": "n", + "definition": "leg, foot" + } + ] + }, + { + "word": "o", + "definitions": [ + { + "pos": "sep", + "definition": "O (vocative or imperative)" + }, + { + "pos": "interj", + "definition": "hey! (calling somebody's attention)" + } + ] + }, + { + "word": "oko", + "definitions": [ + { + "pos": "n", + "definition": "eye" + }, + { + "pos": "extra", + "definition": "[similar to oculist]" + } + ] + }, + { + "word": "olin", + "definitions": [ + { + "pos": "n", + "definition": "love" + }, + { + "pos": "mod", + "definition": "love" + }, + { + "pos": "vt", + "definition": "to love (a person)" + } + ] + }, + { + "word": "ona", + "definitions": [ + { + "pos": "n", + "definition": "she, he, it, they" + }, + { + "pos": "mod", + "definition": "her, his, its, their" + } + ] + }, + { + "word": "open", + "definitions": [ + { + "pos": "vt", + "definition": "open, turn on" + } + ] + }, + { + "word": "pakala", + "definitions": [ + { + "pos": "n", + "definition": "blunder, accident, mistake, destruction, damage, breaking" + }, + { + "pos": "vt", + "definition": "screw up, fuck up, botch, ruin, break, hurt, injure, damage, spoil, ruin" + }, + { + "pos": "vi", + "definition": "screw up, fall apart, break" + }, + { + "pos": "interj", + "definition": "damn! fuck!" + } + ] + }, + { + "word": "pali", + "definitions": [ + { + "pos": "n", + "definition": "activity, work, deed, project" + }, + { + "pos": "mod", + "definition": "active, work-related, operating, working" + }, + { + "pos": "vt", + "definition": "do, make, build, create" + }, + { + "pos": "vi", + "definition": "act, work, function" + } + ] + }, + { + "word": "palisa", + "definitions": [ + { + "pos": "n", + "definition": "long, mostly hard object, e.g. rod, stick, branch" + } + ] + }, + { + "word": "pan", + "definitions": [ + { + "pos": "n", + "definition": "grain, cereal" + } + ] + }, + { + "word": "pana", + "definitions": [ + { + "pos": "vt", + "definition": "give, put, send, place, release, emit, cause" + }, + { + "pos": "n", + "definition": "giving, transfer, exchange" + } + ] + }, + { + "word": "pi", + "definitions": [ + { + "pos": "sep", + "definition": "of, belonging to" + } + ] + }, + { + "word": "pilin", + "definitions": [ + { + "pos": "n", + "definition": "feelings, emotion, heart" + }, + { + "pos": "vi", + "definition": "feel" + }, + { + "pos": "vt", + "definition": "feel, think, sense, touch" + }, + { + "pos": "extra", + "definition": "[feeling]" + } + ] + }, + { + "word": "pimeja", + "definitions": [ + { + "pos": "mod", + "definition": "black, dark" + }, + { + "pos": "n", + "definition": "darkness, shadows" + }, + { + "pos": "vt", + "definition": "darken" + } + ] + }, + { + "word": "pini", + "definitions": [ + { + "pos": "n", + "definition": "end, tip" + }, + { + "pos": "mod", + "definition": "completed, finished, past, done, ago" + }, + { + "pos": "vt", + "definition": "finish, close, end, turn off" + } + ] + }, + { + "word": "pipi", + "definitions": [ + { + "pos": "n", + "definition": "bug, insect, spider" + } + ] + }, + { + "word": "poka", + "definitions": [ + { + "pos": "n", + "definition": "side, hip, next to" + }, + { + "pos": "prep", + "definition": "in the accompaniment of, with" + }, + { + "pos": "mod", + "definition": "neighbouring" + } + ] + }, + { + "word": "poki", + "definitions": [ + { + "pos": "n", + "definition": "container, box, bowl, cup, glass" + }, + { + "pos": "extra", + "definition": "[box]" + } + ] + }, + { + "word": "pona", + "definitions": [ + { + "pos": "n", + "definition": "good, simplicity, positivity" + }, + { + "pos": "mod", + "definition": "good, simple, positive, nice, correct, right" + }, + { + "pos": "interj", + "definition": "great! good! thanks! OK! cool! yay!" + }, + { + "pos": "vt", + "definition": "improve, fix, repair, make good" + }, + { + "pos": "extra", + "definition": "[bonam]" + } + ] + }, + { + "word": "pu", + "definitions": [ + { + "pos": "extra", + "definition": "(yet undefined entry in the official word list)" + } + ] + }, + { + "word": "sama", + "definitions": [ + { + "pos": "mod", + "definition": "same, similar, equal, of equal status or position" + }, + { + "pos": "prep", + "definition": "preplike, as, seem" + } + ] + }, + { + "word": "seli", + "definitions": [ + { + "pos": "n", + "definition": "fire, warmth, heat" + }, + { + "pos": "mod", + "definition": "hot, warm, cooked" + }, + { + "pos": "vt", + "definition": "heat, warm up, cook" + } + ] + }, + { + "word": "selo", + "definitions": [ + { + "pos": "n", + "definition": "outside, surface, skin, shell, bark, shape, peel" + } + ] + }, + { + "word": "seme", + "definitions": [ + { + "pos": "oth", + "definition": "what, which, wh- (question word)" + } + ] + }, + { + "word": "sewi", + "definitions": [ + { + "pos": "n", + "definition": "high, up, above, top, over, on" + }, + { + "pos": "mod", + "definition": "superior, elevated, religious, formal" + } + ] + }, + { + "word": "sijelo", + "definitions": [ + { + "pos": "n", + "definition": "body, physical state" + } + ] + }, + { + "word": "sike", + "definitions": [ + { + "pos": "n", + "definition": "circle, wheel, sphere, ball, cycle" + }, + { + "pos": "mod", + "definition": "round, cyclical" + } + ] + }, + { + "word": "sin", + "definitions": [ + { + "pos": "mod", + "definition": "new, fresh, another, more" + }, + { + "pos": "vt", + "definition": "renew, renovate, freshen" + } + ] + }, + { + "word": "sina", + "definitions": [ + { + "pos": "n", + "definition": "you" + }, + { + "pos": "mod", + "definition": "your" + } + ] + }, + { + "word": "sinpin", + "definitions": [ + { + "pos": "n", + "definition": "front, chest, torso, face, wall" + } + ] + }, + { + "word": "sitelen", + "definitions": [ + { + "pos": "n", + "definition": "picture, image" + }, + { + "pos": "vt", + "definition": "draw, write" + } + ] + }, + { + "word": "sona", + "definitions": [ + { + "pos": "n", + "definition": "knowledge, wisdom, intelligence, understanding" + }, + { + "pos": "vt", + "definition": "know, understand, know how to" + }, + { + "pos": "vi", + "definition": "know, understand" + }, + { + "pos": "kama", + "definition": "learn, study" + } + ] + }, + { + "word": "soweli", + "definitions": [ + { + "pos": "n", + "definition": "animal, especially land mammal, lovable animal" + } + ] + }, + { + "word": "suli", + "definitions": [ + { + "pos": "mod", + "definition": "big, tall, long, adult, important" + }, + { + "pos": "vt", + "definition": "enlarge, lengthen" + }, + { + "pos": "n", + "definition": "size" + } + ] + }, + { + "word": "suno", + "definitions": [ + { + "pos": "n", + "definition": "sun, light" + } + ] + }, + { + "word": "supa", + "definitions": [ + { + "pos": "n", + "definition": "horizontal surface, e.g furniture, table, chair, pillow, floor" + } + ] + }, + { + "word": "suwi", + "definitions": [ + { + "pos": "n", + "definition": "candy, sweet food" + }, + { + "pos": "mod", + "definition": "sweet, cute" + }, + { + "pos": "vt", + "definition": "sweeten" + }, + { + "pos": "extra", + "definition": "[sweet]" + } + ] + }, + { + "word": "tan", + "definitions": [ + { + "pos": "prep", + "definition": "from, by, because of, since" + }, + { + "pos": "n", + "definition": "origin, cause" + } + ] + }, + { + "word": "taso", + "definitions": [ + { + "pos": "mod", + "definition": "only, sole" + }, + { + "pos": "conj", + "definition": "but" + }, + { + "pos": "extra", + "definition": "[that's all]" + } + ] + }, + { + "word": "tawa", + "definitions": [ + { + "pos": "prep", + "definition": "to, in order to, towards, for, until" + }, + { + "pos": "vi", + "definition": "go to, walk, travel, move, leave" + }, + { + "pos": "n", + "definition": "movement, transportation" + }, + { + "pos": "mod", + "definition": "moving, mobile" + }, + { + "pos": "vt", + "definition": "move, displace" + }, + { + "pos": "extra", + "definition": "[towards]" + } + ] + }, + { + "word": "telo", + "definitions": [ + { + "pos": "n", + "definition": "water, liquid, juice, sauce" + }, + { + "pos": "vt", + "definition": "water, wash with water" + } + ] + }, + { + "word": "tenpo", + "definitions": [ + { + "pos": "n", + "definition": "time, period of time, moment, duration, situation" + } + ] + }, + { + "word": "toki", + "definitions": [ + { + "pos": "n", + "definition": "language, talking, speech, communication" + }, + { + "pos": "mod", + "definition": "talking, verbal" + }, + { + "pos": "vt", + "definition": "say" + }, + { + "pos": "vi", + "definition": "talk, chat, communicate" + }, + { + "pos": "interj", + "definition": "hello! hi!" + } + ] + }, + { + "word": "tomo", + "definitions": [ + { + "pos": "n", + "definition": "indoor constructed space, e.g. house, home, room, building" + }, + { + "pos": "mod", + "definition": "urban, domestic, household" + } + ] + }, + { + "word": "tu", + "definitions": [ + { + "pos": "mod", + "definition": "two" + }, + { + "pos": "n", + "definition": "duo, pair" + }, + { + "pos": "vt", + "definition": "double, separate/cut/divide in two" + }, + { + "pos": "extra", + "definition": "[two]" + } + ] + }, + { + "word": "unpa", + "definitions": [ + { + "pos": "n", + "definition": "sex, sexuality" + }, + { + "pos": "mod", + "definition": "erotic, sexual" + }, + { + "pos": "vt", + "definition": "have sex with, sleep with, fuck" + }, + { + "pos": "vi", + "definition": "have sex" + } + ] + }, + { + "word": "uta", + "definitions": [ + { + "pos": "n", + "definition": "mouth" + }, + { + "pos": "mod", + "definition": "oral" + } + ] + }, + { + "word": "utala", + "definitions": [ + { + "pos": "n", + "definition": "conflict, disharmony, competition, fight, war, battle, attack, blow, argument, physical or verbal violence" + }, + { + "pos": "vt", + "definition": "hit, strike, attack, compete against" + } + ] + }, + { + "word": "walo", + "definitions": [ + { + "pos": "mod", + "definition": "white, light (colour)" + }, + { + "pos": "n", + "definition": "white thing or part, whiteness, lightness" + }, + { + "pos": "extra", + "definition": "[sounds like wall, which is often white]" + } + ] + }, + { + "word": "wan", + "definitions": [ + { + "pos": "mod", + "definition": "one, a" + }, + { + "pos": "n", + "definition": "unit, element, particle, part, piece" + }, + { + "pos": "vt", + "definition": "unite, make one" + }, + { + "pos": "extra", + "definition": "[one]" + } + ] + }, + { + "word": "waso", + "definitions": [ + { + "pos": "n", + "definition": "bird, winged animal" + } + ] + }, + { + "word": "wawa", + "definitions": [ + { + "pos": "n", + "definition": "energy, strength, power" + }, + { + "pos": "mod", + "definition": "energetic, strong, fierce, intense, sure, confident" + }, + { + "pos": "vt", + "definition": "strengthen, energize, empower" + } + ] + }, + { + "word": "weka", + "definitions": [ + { + "pos": "mod", + "definition": "away, absent, missing" + }, + { + "pos": "n", + "definition": "absence" + }, + { + "pos": "vt", + "definition": "throw away, remove, get rid of" + } + ] + }, + { + "word": "wile", + "definitions": [ + { + "pos": "vt", + "definition": "to want, need, wish, have to, must, will, should" + }, + { + "pos": "n", + "definition": "desire, need, will" + }, + { + "pos": "mod", + "definition": "necessary" + } + ] + } +] \ No newline at end of file diff --git a/Toki Trainer/JSON Data/toki-partsofspeech.json b/Toki Trainer/JSON Data/toki-partsofspeech.json new file mode 100644 index 0000000..bdf0f76 --- /dev/null +++ b/Toki Trainer/JSON Data/toki-partsofspeech.json @@ -0,0 +1,46 @@ +[ + { + "pos": "n", + "definition": "head noun" + }, + { + "pos": "mod", + "definition": "modifier (adjective or adverb)" + }, + { + "pos": "sep", + "definition": "separator" + }, + { + "pos": "vt", + "definition": "verb, transitive (normally used with e)" + }, + { + "pos": "vi", + "definition": "verb, intransitive" + }, + { + "pos": "interj", + "definition": "interjection" + }, + { + "pos": "prep", + "definition": "quasi-preposition" + }, + { + "pos": "conj", + "definition": "conjunction" + }, + { + "pos": "kama", + "definition": "compound verb preceded by kama" + }, + { + "pos": "cont", + "definition": "context word used before la" + }, + { + "pos": "oth", + "definition": "special, other word" + } +] \ No newline at end of file diff --git a/Toki Trainer/Models/TokiDictionary.swift b/Toki Trainer/Models/TokiDictionary.swift new file mode 100644 index 0000000..e8872a8 --- /dev/null +++ b/Toki Trainer/Models/TokiDictionary.swift @@ -0,0 +1,19 @@ +// +// TokiDictionary.swift +// TokiDictionary +// +// Created by Avery Ada Pace on 10/1/21. +// + +import Foundation + +struct TokiDictEntry: Decodable { + var word: String + var definitions: [TokiDictDefinition] +} + +struct TokiDictDefinition: Decodable { + var pos: String + var definition: String +} + diff --git a/Toki Trainer/Models/TokiJSONLoader.swift b/Toki Trainer/Models/TokiJSONLoader.swift new file mode 100644 index 0000000..3013d1b --- /dev/null +++ b/Toki Trainer/Models/TokiJSONLoader.swift @@ -0,0 +1,46 @@ +// +// TokiJSONLoader.swift +// TokiJSONLoader +// +// Created by Avery Ada Pace on 10/1/21. +// + +import Foundation + +class TokiJSONLoader: ObservableObject { + @Published var dictionary: [TokiDictEntry] = [] + @Published var partsOfSpeech: [TokiPartOfSpeech] = [] + + func loadDictionary() { + let jsonData = loadJSON("toki-dictionary") + do { + let decodedData = try JSONDecoder().decode([TokiDictEntry].self, from: jsonData!) + dictionary = decodedData + } catch { + print("Decode error: \(error)") + return + } + } + + func loadPOS() { + let jsonData = loadJSON("toki-partsofspeech") + do { + let decodedData = try JSONDecoder().decode([TokiPartOfSpeech].self, from: jsonData!) + partsOfSpeech = decodedData + } catch { + print("Decode error: \(error)") + return + } + } + + func loadJSON(_ resource: String) -> Data? { + do { + if let bundlePath = Bundle.main.path(forResource: resource, ofType: "json"), let jsonData = try String(contentsOfFile: bundlePath).data(using: .utf8) { + return jsonData + } + } catch { + print(error) + } + return nil + } +} diff --git a/Toki Trainer/Models/TokiPartOfSpeech.swift b/Toki Trainer/Models/TokiPartOfSpeech.swift new file mode 100644 index 0000000..3d2f2c3 --- /dev/null +++ b/Toki Trainer/Models/TokiPartOfSpeech.swift @@ -0,0 +1,13 @@ +// +// TokiPartsOfSpeech.swift +// Toki Trainer +// +// Created by Avery Ada Pace on 11/2/21. +// + +import Foundation + +struct TokiPartOfSpeech: Decodable { + var pos: String + var definition: String +} diff --git a/Toki Trainer/States/TokiPartsOfSpeechProvider.swift b/Toki Trainer/States/TokiPartsOfSpeechProvider.swift new file mode 100644 index 0000000..b80c043 --- /dev/null +++ b/Toki Trainer/States/TokiPartsOfSpeechProvider.swift @@ -0,0 +1,8 @@ +// +// TokiPartsOfSpeechProvider.swift +// Toki Trainer +// +// Created by Avery Ada Pace on 11/3/21. +// + +import Foundation diff --git a/Toki Trainer/Views/ContentView.swift b/Toki Trainer/Views/ContentView.swift new file mode 100644 index 0000000..6f584db --- /dev/null +++ b/Toki Trainer/Views/ContentView.swift @@ -0,0 +1,39 @@ +// +// ContentView.swift +// Toki Trainer +// +// Created by Avery Ada Pace on 11/2/21. +// + +import SwiftUI +import CoreData + +struct ContentView: View { + + @ObservedObject var jsonLoader = TokiJSONLoader() + + var body: some View { + List(jsonLoader.dictionary, id: \.word) { entry in + VStack(alignment: .leading) { + Text(entry.word) + .font(.title) + ForEach(entry.definitions, id: \.pos) { definition in + HStack(alignment: .top) { + Text(definition.pos) + Text(definition.definition) + } + }} + + } + .onAppear { + self.jsonLoader.loadDictionary() + } + } +} + + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/Toki Trainer/Toki_TrainerApp.swift b/Toki Trainer/Views/Toki_TrainerApp.swift similarity index 100% rename from Toki Trainer/Toki_TrainerApp.swift rename to Toki Trainer/Views/Toki_TrainerApp.swift