use super::cooccurrence::base;
mod names;
mod phrases;
pub struct VerbRule {
pub marker: &'static str,
pub also: Option<&'static str>,
pub passive_marker: Option<&'static str>,
pub relation: &'static str,
pub rule: &'static str,
pub base: f32,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Slot {
Person,
Place,
Venue,
Any,
}
pub struct PhraseRule {
pub phrases: &'static [&'static str],
pub relation: &'static str,
pub rule: &'static str,
pub base: f32,
pub subject: Slot,
pub object: Slot,
pub passive: bool,
}
pub struct LanguagePack {
pub sentence_openers: &'static [&'static str],
pub name_particles: &'static [&'static str],
pub honorifics: &'static [&'static str],
pub honorific_qualifiers: &'static [&'static str],
pub pronouns: &'static [&'static str],
pub masculine_pronouns: &'static [&'static str],
pub feminine_pronouns: &'static [&'static str],
pub neuter_pronouns: &'static [&'static str],
pub plural_pronouns: &'static [&'static str],
pub masculine_titles: &'static [&'static str],
pub feminine_titles: &'static [&'static str],
pub determiners: &'static [&'static str],
pub deictic_pronouns: &'static [&'static str],
pub speech_verbs: &'static [&'static str],
pub resuming_verbs: &'static [&'static str],
pub subject_pronouns: &'static [&'static str],
pub locative_prepositions: &'static [&'static str],
pub temporal_names: &'static [&'static str],
pub abbreviations: &'static [&'static str],
pub possessive_nouns: &'static [(&'static str, &'static str, f32)],
pub possessive_copulas: &'static [&'static str],
pub appositive_modifiers: &'static [&'static str],
pub suspending_words: &'static [&'static str],
pub negators: &'static [&'static str],
pub single_filler_relations: &'static [&'static str],
pub negation_clitic: &'static str,
pub infinitive_marker: &'static str,
pub possessive_clitic: &'static str,
pub genitive_link: &'static str,
pub phrase_conjunction: &'static str,
pub relative_opener: &'static str,
pub verb_rules: &'static [VerbRule],
pub relative_rules: &'static [VerbRule],
pub phrase_rules: &'static [PhraseRule],
pub phrase_fillers: &'static [&'static str],
pub phrase_trailers: &'static [&'static str],
pub place_heads: &'static [&'static str],
pub org_heads: &'static [&'static str],
pub place_leads: &'static [&'static str],
pub place_names: &'static [&'static str],
pub thing_names: &'static [&'static str],
pub possessive_pronouns: &'static [&'static str],
pub first_person_pronouns: &'static [&'static str],
pub plural_nouns: &'static [(&'static str, &'static str, f32)],
pub plural_copulas: &'static [&'static str],
pub plural_modifiers: &'static [&'static str],
pub object_followers: &'static [&'static str],
pub possessive_tails: &'static [&'static str],
}
pub static ENGLISH: LanguagePack = LanguagePack {
sentence_openers: SENTENCE_OPENERS,
name_particles: NAME_PARTICLES,
honorifics: HONORIFICS,
honorific_qualifiers: HONORIFIC_QUALIFIERS,
pronouns: PRONOUNS,
masculine_pronouns: &["he", "him", "his"],
feminine_pronouns: &["she", "her"],
neuter_pronouns: &["it", "its"],
plural_pronouns: &["they", "them", "their"],
masculine_titles: &["mr", "mister", "sir", "lord"],
feminine_titles: &["mrs", "ms", "miss", "dame", "lady"],
determiners: &["the", "a", "an"],
deictic_pronouns: &[
"i",
"me",
"my",
"mine",
"myself",
"you",
"your",
"yours",
"yourself",
"we",
"us",
"our",
"ours",
"ourselves",
],
resuming_verbs: &["continued", "resumed", "pursued", "persisted"],
speech_verbs: &[
"said",
"says",
"asked",
"asks",
"cried",
"cries",
"replied",
"replies",
"answered",
"answers",
"exclaimed",
"exclaims",
"shouted",
"shouts",
"called",
"calls",
"whispered",
"whispers",
"continued",
"continues",
"interrupted",
"interrupts",
"inquired",
"inquires",
"demanded",
"demands",
"returned",
"rejoined",
"added",
"adds",
"repeated",
"pronounced",
"hallooed",
"screamed",
"muttered",
"murmured",
"observed",
"remarked",
"retorted",
"sobbed",
"snapped",
"growled",
"laughed",
"began",
"pleaded",
"urged",
"insisted",
"declared",
"resumed",
],
subject_pronouns: &["he", "she", "it", "they"],
locative_prepositions: &[
"at", "in", "near", "into", "within", "upon", "beyond", "outside", "inside", "across",
],
temporal_names: &[
"january",
"february",
"march",
"april",
"june",
"july",
"august",
"september",
"october",
"november",
"december",
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday",
"christmas",
"easter",
"michaelmas",
"lady day",
"midsummer",
],
abbreviations: ABBREVIATIONS,
possessive_nouns: POSSESSIVE_NOUNS,
possessive_copulas: POSSESSIVE_COPULAS,
appositive_modifiers: APPOSITIVE_MODIFIERS,
suspending_words: SUSPENDING_WORDS,
negators: NEGATORS,
single_filler_relations: SINGLE_FILLER_RELATIONS,
negation_clitic: "n't",
infinitive_marker: "to",
possessive_clitic: "'s",
genitive_link: "of",
phrase_conjunction: " and ",
relative_opener: ", who ",
verb_rules: VERB_RULES,
relative_rules: RELATIVE_RULES,
phrase_rules: phrases::PHRASE_RULES,
phrase_fillers: phrases::PHRASE_FILLERS,
phrase_trailers: phrases::PHRASE_TRAILERS,
place_heads: names::PLACE_HEADS,
org_heads: names::ORG_HEADS,
place_leads: names::PLACE_LEADS,
place_names: names::PLACE_NAMES,
thing_names: names::THING_NAMES,
possessive_pronouns: &["his", "her", "my", "our"],
first_person_pronouns: &["i", "me", "my", "mine", "myself", "our"],
plural_nouns: PLURAL_NOUNS,
plural_copulas: &["are", "were"],
plural_modifiers: &[
"close", "longtime", "lifelong", "very", "great", "real", "true",
],
object_followers: &[
"at",
"in",
"on",
"to",
"with",
"for",
"from",
"and",
"but",
"as",
"when",
"after",
"before",
"while",
"again",
"once",
"too",
"there",
"here",
"today",
"later",
"that",
"because",
"until",
"by",
"outside",
"inside",
"yesterday",
"tonight",
],
possessive_tails: &[
"for", "since", "during", "until", "when", "while", "before", "after", "at", "in", "from",
"once", "then", "now", "there", "here", "too", "again", "as", "by", "that", "who",
],
};
#[rustfmt::skip]
const SENTENCE_OPENERS: &[&str] = &[
"a", "after", "again", "all", "although", "an", "and", "another", "any", "are", "as", "at",
"because", "before", "both", "but", "by", "did", "do", "does", "each", "either", "even",
"every", "for", "from", "had", "has", "have", "he", "her", "here", "him", "his", "how",
"however", "if",
"in", "indeed", "instead", "well", "oh", "ah", "yes", "aye", "nay", "hush", "thanks", "hello", "alas", "pray", "dear", "is", "its", "just", "later", "maybe", "meanwhile", "my", "neither",
"never", "no", "nor", "not", "now", "of", "often", "on", "once", "only", "or", "our",
"perhaps", "since", "so", "some", "sometimes", "soon", "still", "suddenly", "that", "the",
"she", "their", "them", "then", "there", "these", "they", "this", "those", "though", "to",
"today", "tomorrow",
"tonight", "was", "were", "what", "when", "where", "which", "while", "who", "whom", "whose",
"why", "with", "yesterday", "yet", "your",
];
const NAME_PARTICLES: &[&str] = &[
"de", "del", "della", "der", "des", "di", "du", "la", "le", "van", "von", "af", "ter", "bin",
"ibn", "al", "da", "dos", "das", "y",
];
#[rustfmt::skip]
const HONORIFICS: &[&str] = &[
"mr", "mrs", "ms", "miss", "mister", "dr", "doctor", "sir", "dame", "lady", "lord",
"captain", "capt", "colonel", "col", "reverend", "rev", "professor", "prof",
"sergeant", "sgt", "lieutenant", "admiral", "bishop", "cardinal",
"judge", "dean", "officer", "detective", "inspector", "senator", "governor", "mayor",
"coach", "pastor", "principal", "nurse", "deputy",
"hon", "honourable", "honorable",
];
const HONORIFIC_QUALIFIERS: &[&str] = &["right", "most", "very"];
const PRONOUNS: &[&str] = &[
"he", "she", "they", "him", "her", "them", "his", "their", "it",
];
const ABBREVIATIONS: &[&str] = &[
"mr", "mrs", "ms", "dr", "prof", "rev", "fr", "sr", "jr", "st", "hon", "msgr",
"lt", "capt", "col", "gen", "sgt", "maj", "adm", "cmdr", "gov", "sen", "rep", "det", "insp",
"supt", "etc", "vs", "viz", "cf", "al", "ibid", "approx", "est", "min", "max",
"inc", "ltd", "co", "corp", "dept", "univ", "mt", "ft", "ave", "blvd", "no", "vol", "ed", "pp",
"fig",
];
const POSSESSIVE_NOUNS: &[(&str, &str, f32)] = &[
(
"mother-in-law",
"mother_in_law_of",
base::POSSESSIVE_FACTUAL,
),
(
"father-in-law",
"father_in_law_of",
base::POSSESSIVE_FACTUAL,
),
(
"sister-in-law",
"sister_in_law_of",
base::POSSESSIVE_FACTUAL,
),
(
"brother-in-law",
"brother_in_law_of",
base::POSSESSIVE_FACTUAL,
),
("ex-wife", "ex_wife_of", base::POSSESSIVE_FACTUAL),
("ex-husband", "ex_husband_of", base::POSSESSIVE_FACTUAL),
("sister", "sister_of", base::POSSESSIVE_FACTUAL),
("brother", "brother_of", base::POSSESSIVE_FACTUAL),
("mother", "mother_of", base::POSSESSIVE_FACTUAL),
("father", "father_of", base::POSSESSIVE_FACTUAL),
("grandmother", "grandmother_of", base::POSSESSIVE_FACTUAL),
("grandfather", "grandfather_of", base::POSSESSIVE_FACTUAL),
("daughter", "daughter_of", base::POSSESSIVE_FACTUAL),
("son", "son_of", base::POSSESSIVE_FACTUAL),
("wife", "wife_of", base::POSSESSIVE_FACTUAL),
("husband", "husband_of", base::POSSESSIVE_FACTUAL),
("cousin", "cousin_of", base::POSSESSIVE_FACTUAL),
("aunt", "aunt_of", base::POSSESSIVE_FACTUAL),
("uncle", "uncle_of", base::POSSESSIVE_FACTUAL),
("niece", "niece_of", base::POSSESSIVE_FACTUAL),
("nephew", "nephew_of", base::POSSESSIVE_FACTUAL),
("widow", "widow_of", base::POSSESSIVE_FACTUAL),
("stepmother", "stepmother_of", base::POSSESSIVE_FACTUAL),
("stepfather", "stepfather_of", base::POSSESSIVE_FACTUAL),
("stepdaughter", "stepdaughter_of", base::POSSESSIVE_FACTUAL),
("stepson", "stepson_of", base::POSSESSIVE_FACTUAL),
("stepsister", "stepsister_of", base::POSSESSIVE_FACTUAL),
("stepbrother", "stepbrother_of", base::POSSESSIVE_FACTUAL),
(
"granddaughter",
"granddaughter_of",
base::POSSESSIVE_FACTUAL,
),
("grandson", "grandson_of", base::POSSESSIVE_FACTUAL),
("godmother", "godmother_of", base::POSSESSIVE_FACTUAL),
("godfather", "godfather_of", base::POSSESSIVE_FACTUAL),
("godson", "godson_of", base::POSSESSIVE_FACTUAL),
("goddaughter", "goddaughter_of", base::POSSESSIVE_FACTUAL),
("twin", "twin_of", base::POSSESSIVE_FACTUAL),
("fiance", "fiance_of", base::POSSESSIVE_FACTUAL),
("fiancee", "fiance_of", base::POSSESSIVE_FACTUAL),
("girlfriend", "girlfriend_of", base::POSSESSIVE_FACTUAL),
("boyfriend", "boyfriend_of", base::POSSESSIVE_FACTUAL),
("partner", "partner_of", base::POSSESSIVE_STANCE),
("boss", "boss_of", base::POSSESSIVE_FACTUAL),
("colleague", "colleague_of", base::POSSESSIVE_STANCE),
("coworker", "coworker_of", base::POSSESSIVE_STANCE),
("roommate", "roommate_of", base::POSSESSIVE_STANCE),
("classmate", "classmate_of", base::POSSESSIVE_STANCE),
("neighbor", "neighbor_of", base::POSSESSIVE_STANCE),
("neighbour", "neighbor_of", base::POSSESSIVE_STANCE),
("landlord", "landlord_of", base::POSSESSIVE_FACTUAL),
("tenant", "tenant_of", base::POSSESSIVE_FACTUAL),
("patient", "patient_of", base::POSSESSIVE_FACTUAL),
("doctor", "doctor_of", base::POSSESSIVE_FACTUAL),
("therapist", "therapist_of", base::POSSESSIVE_FACTUAL),
("lawyer", "lawyer_of", base::POSSESSIVE_FACTUAL),
("client", "client_of", base::POSSESSIVE_FACTUAL),
("assistant", "assistant_of", base::POSSESSIVE_FACTUAL),
("sponsor", "sponsor_of", base::POSSESSIVE_FACTUAL),
("ex", "ex_of", base::POSSESSIVE_FACTUAL),
("guardian", "guardian_of", base::POSSESSIVE_FACTUAL),
("employer", "employer_of", base::POSSESSIVE_FACTUAL),
("servant", "servant_of", base::POSSESSIVE_FACTUAL),
("master", "master_of", base::POSSESSIVE_FACTUAL),
("teacher", "teacher_of", base::POSSESSIVE_FACTUAL),
("student", "student_of", base::POSSESSIVE_FACTUAL),
("pupil", "pupil_of", base::POSSESSIVE_FACTUAL),
("apprentice", "apprentice_of", base::POSSESSIVE_FACTUAL),
("mentor", "mentors", base::POSSESSIVE_FACTUAL),
("friend", "friend_of", base::POSSESSIVE_STANCE),
("enemy", "enemy_of", base::POSSESSIVE_STANCE),
("rival", "rival_of", base::POSSESSIVE_STANCE),
("lover", "lover_of", base::POSSESSIVE_STANCE),
("companion", "companion_of", base::POSSESSIVE_STANCE),
("ally", "ally_of", base::POSSESSIVE_STANCE),
("acquaintance", "acquaintance_of", base::POSSESSIVE_STANCE),
];
const PLURAL_NOUNS: &[(&str, &str, f32)] = &[
("sisters", "sister_of", base::POSSESSIVE_FACTUAL),
("brothers", "brother_of", base::POSSESSIVE_FACTUAL),
("siblings", "sibling_of", base::POSSESSIVE_FACTUAL),
("cousins", "cousin_of", base::POSSESSIVE_FACTUAL),
("twins", "twin_of", base::POSSESSIVE_FACTUAL),
("married", "spouse_of", base::POSSESSIVE_FACTUAL),
("friends", "friend_of", base::POSSESSIVE_STANCE),
("lovers", "lover_of", base::POSSESSIVE_STANCE),
("partners", "partner_of", base::POSSESSIVE_STANCE),
("colleagues", "colleague_of", base::POSSESSIVE_STANCE),
("coworkers", "coworker_of", base::POSSESSIVE_STANCE),
("roommates", "roommate_of", base::POSSESSIVE_STANCE),
("neighbors", "neighbor_of", base::POSSESSIVE_STANCE),
("neighbours", "neighbor_of", base::POSSESSIVE_STANCE),
("classmates", "classmate_of", base::POSSESSIVE_STANCE),
("rivals", "rival_of", base::POSSESSIVE_STANCE),
("enemies", "enemy_of", base::POSSESSIVE_STANCE),
("allies", "ally_of", base::POSSESSIVE_STANCE),
];
const POSSESSIVE_COPULAS: &[&str] = &["is", "was"];
#[rustfmt::skip]
const APPOSITIVE_MODIFIERS: &[&str] = &[
"the", "a", "an", "this", "that",
"his", "her", "their", "its", "my", "our", "your",
"old", "young", "little", "poor", "dear", "late", "good",
"younger", "older", "elder", "eldest", "youngest", "oldest", "best", "closest", "only",
"twin", "adopted", "biological", "favorite", "own", "new",
];
const SUSPENDING_WORDS: &[&str] = &[
"if", "unless", "whether", "could", "would", "might", "may", "should",
];
const NEGATORS: &[&str] = &["not", "never", "no", "nor", "neither"];
const SINGLE_FILLER_RELATIONS: &[&str] = &["mother_of", "father_of"];
const VERB_RULES: &[VerbRule] = &[
VerbRule {
marker: " mentor",
also: None,
passive_marker: Some(" by"),
relation: "mentors",
rule: "verb-mentor-pattern",
base: base::VERB,
},
VerbRule {
marker: " work",
also: Some(" at"),
passive_marker: None,
relation: "works_at",
rule: "verb-works-at-pattern",
base: base::VERB,
},
];
const RELATIVE_RULES: &[VerbRule] = &[
VerbRule {
marker: "work",
also: Some("at"),
passive_marker: None,
relation: "works_at",
rule: "relative-works-at-pattern",
base: base::RELATIVE_CLAUSE,
},
VerbRule {
marker: "mentor",
also: None,
passive_marker: None,
relation: "mentors",
rule: "relative-mentor-pattern",
base: base::RELATIVE_CLAUSE,
},
];