diff --git a/README.md b/README.md index 80a54dd..bc36633 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ ilo ni li musi taso. ona li ken pali e nimi sin, e kon pi nimi sin ni. kin la, ona li pali e toki ni: ona li kepeken nimi ni. +mi pali e ni tan ni: mi wile kama sona pi ilo Rust. ni li pali musi li pali pona tawa wile ni. + sina lukin e ijo ike pi ilo ni la, o toki e ni tawa mi! sina ken toki tawa mi kepeken ilo Matrix lon @rawtess@matrix.kittycat.homes kepeken ilo Siko lon oωo 󱥢󱦐󱥾󱤊󱥦󱤀󱦑#5356 o pona diff --git a/nimi b/nimi index 98c5a8a..63cd46c 100644 --- a/nimi +++ b/nimi @@ -205,7 +205,6 @@ used to form a yes-no question; to hunt, forage, seek; to try to, attempt; to continue to, to keep; -between multiple subjects; coordinates modifiers in a pi-phrase or objects of a preposition; thing, phenomenon, object, matter; internal organ, stomach; @@ -221,10 +220,8 @@ hard object, metal, rock, stone; hidden reality, unseen agent; of or relating to the LGBT+ community; pay attention to, obey; -between the context phrase and the main sentence; blue, green; cover, layer of privacy; -between any subject except mi alone or sina alone and its verb; to introduce a new verb for the same subject; long and flexible thing; flat object; @@ -271,3 +268,115 @@ to utter a characteristic note or cry; to speak to or attempt to reach someone by means of a call; to make a demand in card games; to make a brief visit; +one who barters; +a rigid typically rectangular container; +a small space, compartment or enclosure; +a cubical building; +the limitations of conventionality; +to enclose in a box; +to fight with the fists; +a punch or a slap especially on the ear; +lacking life, spirit, or zest; +a quantity or aggregate of matter; +a large body of persons in a group; +the great body of the people as contrasted with the elite; +to form or collect into a mass; +relating to the mass of the people, being at one with the mass; +viewed as a whole; +to move forward, progress, or act with haste or eagerness or without preparation; +to push on forward with speed, impetuosity, or violence; +to urge to an unnatural or extreme speed; +to run toward or against in attack; +to lavish attention on; +a violent forward motion; +a surging of emotion; +a burst of activity, productivity, or speed; +a surge in energy following the intake of sugar or caffeine; +a sudden feeling of instense pleasure or ecitement; +requiring or marked by special speed or urgency; +to extend in a reclining position; +to reach out; +to become extended without breaking; +to go beyond what is strictly warranted in making a claim or confession; +to take a walk in order to relieve stiffness caused by prolonged sitting; +an exercise of something beyond ordinary or normal limits; +the extent to which something may be stretched; +a term of imprisonment; +longer than the standard size; +society; +to live in a society; +companionship or association with one's fellows; +an organized group working together or periodically meeting because of common interests, beliefs, or profession; +an enduring and cooperating social group whose members have developed organized patterns of relationships through interaction with one another; +a natural group of plants usually of a single species or habit within an association; +on, onto, or within a vehicle; +in or into a group, association, or organization; +of, resembling, or befitting hell; +resulting from or characterized by whim or caprice; +subject to erratic behaviour or unpredictable change; +full of, actuated by, or exhibiting whims; +to prove or show to be just, right or reasonable; +to judge, regard, or treat as righteous and worthy of salvation; +to space lines of text so that the lines come out even at the margin; +to show a sufficient lawful reason for an act; +extremely startling, distressing, or offensive; +full of or showing a disposition to challenge, resist, or fight; +full of or showing defiance; +affected with or expressive of grief or unhappiness; +causing or associated with grief or unhappiness; +a somber colour; +to become destroyed or ruined, to cease to exist; +to cause to die; +of, relating to, or resembling cloud; +darkened by gloom or anxiety; +overcast with clouds; +obscure in meaning; +uneven in color or texture; +obscure in meaning; +strongly inclined to do, use, or indulge in something repeatedly; +pleasing to the mind or feelings; +generalized term of approval; +marked by gentle good humour or kindliness; +delicately pleasing to the ear or eye; +sweet to the taste; +the pleasant taste sensation typically produced by sugars; +a pleasant or gratifying experience, possession, or state; +marked by stealth, furtiveness, or shiftiness; +violently hostile or aggressive in temperament; +marked by unrestrained zeal or vehemence; +furiously active or determined; +wild or menacing in appearance; +having bold confidence or style; +distinguishable to the eye or mind as being discrete or not the same; +presenting a clear unmistakable impression; +notably decorated; +garden vegetable with succulent leaves; +something trivial; +a position of responsibility or some degree of executive authority; +a prescribed form or service of worship; +a ceremonial observance; +a place where a particular kind of business is transacted or a service is supplied; +the place in which a professional person conducts business; +seeking to avenge; +serving to gain vengeance; +general interjection, context-dependent; +indirect insult or disrespect; +eliciting or stimulating a positive sensory experience; +acknowledgement or acceptance; +to speak a non-Toki Pona language in an environment where Toki Pona is more appropriate; +to agree with laughter; +(word reserved for future use by Sonja Lang) +neither one not the other, neither fully is nor isn't; +a squishy animal; +indicates thinking, pondering, recognition, agreement, or humming; +transparent material, lack of privacy; +to remove obstructions; +to block the way, to interrupt; +effective, useful, give good results; +something that can be compressed and will try to go back to its original shape; +wanting to create new words; +on a higher tier/plane, to an exceedingly great extent; +amaze people by being on the top of the leaderboard; +something that appears to break the rules but doesn't; +leave and come back, be temporarily absent with the expectation of returning; +to revise your old creative works and actually make them worse; diff --git a/src/main.rs b/src/main.rs index bf5b2af..13c581e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,13 +5,20 @@ mod nimi_sin; fn main() { let nimi_sin = nimi_sin::pali(4); println!("{}", nimi_sin); //o pali e nimi sin - markov(); // o pali e kon pi nimi sin ni + println!("{}", markov(1));// o pali e kon pi nimi sin ni println!("{}", toki::pali(&nimi_sin)); } -fn markov() { // pali e nimi sin kepeken ilo Mako. +fn markov(nanpa: u8) -> String { // pali e nimi sin kepeken ilo Mako. let mut mako = Chain::new(); + let mut x = 0; + let mut kon = String::new(); mako.feed_file("nimi").expect("lipu li lon ala a"); - println!("{}", mako.generate_str()); + while x < nanpa { + kon.push_str(mako.generate_str().as_str()); + kon.push_str(" "); + x += 1; + } + kon } diff --git a/src/toki.rs b/src/toki.rs index e45622e..91bfb08 100644 --- a/src/toki.rs +++ b/src/toki.rs @@ -1,54 +1,69 @@ use rand::Rng; pub fn pali(nimi_sin: &str) -> String { - let nimi = ["akesi", "ala", "alasa", "ale", "anpa", "ante", "awen", "esun", "ijo", "ike", "ilo", "insa", "jaki", "jan", "jelo", "jo", "kala", "kalama", "kama", "kasi", "ken", "kepeken", "kili", "kiwen", "ko", "kon", "kule", "kulupu", "kute", "lape", "laso", "lawa", "len", "lete", "lili", "linja", "lipu", "loje", "lon", "luka", "lukin", "lupa", "ma", "mama", "mani", "mi", "moku", "moli", "monsi", "mu", "mun", "musi", "mute", "nanpa", "nasa", "nasin", "nena", "ni", "nimi", "noka", "olin", "ona", "open", "pakala", "pali", "palisa", "pan", "pilin", "pimeja", "pini", "pipi", "poka", "poki", "pona", "pu", "sama", "seli", "selo", "seme", "sewi", "sike", "sin", "sina", "sinpin", "sona", "sitelen", "soweli", "suli", "suno", "supa", "suwi", "tan", "taso", "tawa", "telo", "tenpo", "toki", "tomo", "tu", "unpa", "uta", "utala", "walo", "wan", "waso", "wawa", "weka", "wile", "tonsi", "ku", "epiku", "jasima", "kijetesantakalu", "kin", "kipisi", "kokosila", "lanpan", "leko", "meso", "misikeke", "monsuta", "monsuta", "namako", "oko", "soko"]; //nimi pi ku suli - let nimi_ante = ["kepeken", "sama", "tan", "tawa", "lon"]; - let mut x = 1; - let suli = rand::thread_rng().gen_range(0_u8..5); - let mut nimi_suli = String::new(); - let mut mi_anu_sina = false; - let mut nimi_sin_li_lon = false; - loop { - if x == 2 { - if rand::thread_rng().gen_range(0_u8..10) == 0 { - nimi_suli.push_str("o "); - } else if !mi_anu_sina{ - nimi_suli.push_str("li "); - } - } - if x == 3 { - nimi_suli.push_str("e "); - } - if x == 4 { - nimi_suli.push_str(nimi_ante[rand::thread_rng() - .gen_range(0..nimi_ante.len())]); - nimi_suli.push_str(" "); - } - let mut y = 0; - let suli_kipisi = rand::thread_rng().gen_range(1_u8..4); - while y < suli_kipisi { - let nimi_ni = nimi[rand::thread_rng().gen_range(0..nimi.len())]; - if (nimi_ni == "mi" || nimi_ni == "sina") && suli_kipisi == 1 { - mi_anu_sina = true; - } - if (rand::thread_rng().gen_range(0..4) == 0 || (x+1 == suli && y == suli_kipisi-1)) && !nimi_sin_li_lon { - nimi_suli.push_str(nimi_sin); - nimi_sin_li_lon = true; - } else { - nimi_suli.push_str(nimi[rand::thread_rng() - .gen_range(0..nimi.len())]); - } - nimi_suli.push_str(" "); - y += 1; - if suli_kipisi-y > 1 && rand::random() { - nimi_suli.push_str("pi "); - } - } - - - x += 1; - if x > suli { break; } - } - nimi_suli + let mut toki = String::new(); + toki = pali_lili(toki, nimi_sin, true, false); //ilo li pali e toki la nimi "la" li ken lon la nimi sin li lon ala + toki //ilo li pana e toki } + +fn pali_lili(toki: String, nimi_sin: &str, la_li_ken: bool, nimi_sin_li_lon_a: bool) -> String { + let kulupu_nimi = ["akesi", "ala", "alasa", "ale", "anpa", "ante", "awen", "esun", "ijo", "ike", "ilo", "insa", "jaki", "jan", "jelo", "jo", "kala", "kalama", "kama", "kasi", "ken", "kepeken", "kili", "kiwen", "ko", "kon", "kule", "kulupu", "kute", "lape", "laso", "lawa", "len", "lete", "lili", "linja", "lipu", "loje", "lon", "luka", "lukin", "lupa", "ma", "mama", "mani", "mi", "moku", "moli", "monsi", "mu", "mun", "musi", "mute", "nanpa", "nasa", "nasin", "nena", "ni", "nimi", "noka", "olin", "ona", "open", "pakala", "pali", "palisa", "pan", "pilin", "pimeja", "pini", "pipi", "poka", "poki", "pona", "pu", "sama", "seli", "selo", "seme", "sewi", "sike", "sin", "sina", "sinpin", "sona", "sitelen", "soweli", "suli", "suno", "supa", "suwi", "tan", "taso", "tawa", "telo", "tenpo", "toki", "tomo", "tu", "unpa", "uta", "utala", "walo", "wan", "waso", "wawa", "weka", "wile", "tonsi", "ku", "epiku", "jasima", "kijetesantakalu", "kin", "kipisi", "kokosila", "lanpan", "leko", "meso", "misikeke", "monsuta", "monsuta", "namako", "oko", "soko"]; //nimi pi ku suli + let kulupu_nimi_ante = ["kepeken", "sama", "tan", "tawa", "lon"]; //kepeken li nimi ni li sama ala kepeken pi nimi ante. + let mut toki_sin = String::clone(&toki); + let mut mi_anu_sina = false; + let mut la_anu_seme = rand::thread_rng().gen_range(0_u8..10) == 0; + if la_li_ken == false { + la_anu_seme = false; + } + let mut nimi_sin_li_lon = nimi_sin_li_lon_a; + let mut x = 0; + let suli = rand::thread_rng().gen_range(1_u8..4); // toki la, kipisi tu tu li ken lon. + while x < suli { + if x == 1 { + if rand::thread_rng().gen_range(0_u8..10) == 0 { + toki_sin.push_str("o "); //o li ken lon + } else if !mi_anu_sina { + toki_sin.push_str("li "); //nimi "mi" anu nimi "sina" li lon ala la nimi "li" li ken lon + } + } + if x == 2 { + toki_sin.push_str("e "); //nimi "e" + } + if x == 3 { + toki_sin.push_str(kulupu_nimi_ante[rand::thread_rng().gen_range(0..kulupu_nimi_ante.len())]); //nimi sama nimi "kepeken" + toki_sin.push_str(" "); + } + let mut y = 0; + let suli_kipisi; + if suli == 1 { suli_kipisi = rand::thread_rng().gen_range(2_u8..4); + } else { + suli_kipisi = rand::thread_rng().gen_range(1_u8..4); //kipisi la nimi tu tu li ken lon + } + while y < suli_kipisi { + let nimi_ni = kulupu_nimi[rand::thread_rng().gen_range(0..kulupu_nimi.len())]; + if (nimi_ni == "mi" || nimi_ni == "sina") && suli_kipisi == 1 { + mi_anu_sina = true; //nimi li nimi "mi" taso anu nimi "sina" taso + } + if (rand::thread_rng().gen_range(0_u8..6) == 0 || (x == suli-1 && y == suli_kipisi-1)) && !nimi_sin_li_lon { + toki_sin.push_str(nimi_sin); //ilo li pana e nimi sin. + nimi_sin_li_lon = true; //ni la, nimi sin li lon! + } else { + toki_sin.push_str(kulupu_nimi[rand::thread_rng(). + gen_range(0..kulupu_nimi.len())]); //ilo li pana e nimi pi ku suli + } + toki_sin.push_str(" "); + y += 1; + if suli_kipisi-y > 1 && rand::random() { //nimi "pi" li ken lon la, ona li ken lon! + toki_sin.push_str("pi "); + } + } + x += 1; + } + if la_anu_seme { + toki_sin.push_str("la "); + toki_sin.push_str(pali_lili(String::new(), nimi_sin, false, nimi_sin_li_lon).as_str()); //nimi "la" li lon la, ilo li pali e toki sin li pana e toki ni + } + toki_sin //ilo li pana e toki +} +