use super::super::cooccurrence::base;
use super::{PhraseRule, Slot};
pub(super) const PHRASE_FILLERS: &[&str] = &[
"had",
"has",
"have",
"was",
"were",
"is",
"are",
"did",
"does",
"do",
"didn't",
"doesn't",
"don't",
"hadn't",
"hasn't",
"wasn't",
"weren't",
"isn't",
"not",
"never",
"also",
"still",
"now",
"soon",
"later",
"finally",
"always",
"just",
"once",
"already",
"eventually",
"then",
"first",
"even",
"really",
"quickly",
"quietly",
"slowly",
"briefly",
"secretly",
"later",
"recently",
"formerly",
"previously",
"originally",
"later",
"briefly",
"long",
"ago",
];
pub(super) const PHRASE_TRAILERS: &[&str] =
&["the", "a", "an", "his", "her", "their", "its", "our"];
const fn rule(
phrases: &'static [&'static str],
relation: &'static str,
rule: &'static str,
base: f32,
subject: Slot,
object: Slot,
) -> PhraseRule {
PhraseRule {
phrases,
relation,
rule,
base,
subject,
object,
passive: false,
}
}
const fn passive(
phrases: &'static [&'static str],
relation: &'static str,
rule: &'static str,
base: f32,
subject: Slot,
object: Slot,
) -> PhraseRule {
PhraseRule {
phrases,
relation,
rule,
base,
subject,
object,
passive: true,
}
}
use Slot::{Any, Person, Place, Venue};
pub(super) static PHRASE_RULES: &[PhraseRule] = &[
rule(
&[
"married",
"marries",
"marry",
"is married to",
"was married to",
"got married to",
"gets married to",
"wed",
"weds",
"wedded",
],
"spouse_of",
"phrase-marry",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&["divorced", "divorces", "divorce"],
"divorced",
"phrase-divorce",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&[
"engaged to",
"got engaged to",
"gets engaged to",
"is engaged to",
"was engaged to",
],
"engaged_to",
"phrase-engaged",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&[
"dated",
"dates",
"date",
"dating",
"started dating",
"began dating",
"stopped dating",
],
"dating",
"phrase-dating",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&["proposed to", "proposes to", "propose to"],
"proposed_to",
"phrase-propose",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&[
"broke up with",
"breaks up with",
"split up with",
"splits up with",
],
"broke_up_with",
"phrase-breakup",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&[
"loves",
"loved",
"love",
"fell in love with",
"falls in love with",
"in love with",
"adores",
"adored",
],
"loves",
"phrase-love",
base::PHRASE_STANCE,
Person,
Person,
),
rule(
&[
"hates", "hated", "hate", "despises", "despised", "loathes", "loathed", "resents",
"resented",
],
"hates",
"phrase-hate",
base::PHRASE_STANCE,
Person,
Person,
),
rule(
&["kissed", "kisses", "kiss"],
"kissed",
"phrase-kiss",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&[
"befriended",
"befriends",
"befriend",
"friends with",
"became friends with",
"becomes friends with",
"made friends with",
"makes friends with",
],
"friend_of",
"phrase-friend",
base::PHRASE_STANCE,
Person,
Person,
),
rule(
&["knows", "knew", "know", "known"],
"knows",
"phrase-know",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["met", "meets", "meet", "met with", "meets with"],
"meets",
"phrase-meet",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&[
"argued with",
"argues with",
"fought with",
"fights with",
"quarreled with",
"quarrelled with",
"feuded with",
"feuds with",
],
"argues_with",
"phrase-argue",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["betrayed", "betrays", "betray"],
"betrayed",
"phrase-betray",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["killed", "kills", "murdered", "murders"],
"killed",
"phrase-kill",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["rescued", "rescues", "protects", "protected"],
"protects",
"phrase-protect",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["trusts", "trusted", "trust"],
"trusts",
"phrase-trust",
base::PHRASE_STANCE,
Person,
Person,
),
rule(
&[
"telephones",
"telephoned",
"phones",
"phoned",
"texts",
"texted",
"emails",
"emailed",
],
"contacts",
"phrase-contact",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&[
"hugged",
"hugs",
"embraced",
"embraces",
"comforted",
"comforts",
],
"comforts",
"phrase-comfort",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["thanked", "thanks", "greeted", "greets"],
"greets",
"phrase-greet",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["helped", "helps", "help"],
"helps",
"phrase-help",
base::PHRASE_EVENT,
Person,
Person,
),
passive(
&["killed by"],
"killed",
"phrase-kill-by",
base::PHRASE_EVENT,
Person,
Person,
),
passive(
&["betrayed by"],
"betrayed",
"phrase-betray-by",
base::PHRASE_EVENT,
Person,
Person,
),
passive(
&["raised by"],
"raised",
"phrase-raise-by",
base::PHRASE_EVENT,
Person,
Person,
),
passive(
&["adopted by"],
"adopted",
"phrase-adopt-by",
base::PHRASE_EVENT,
Person,
Person,
),
passive(
&["taught by"],
"teacher_of",
"phrase-teach-by",
base::PHRASE_EVENT,
Person,
Person,
),
passive(
&["protected by", "rescued by"],
"protects",
"phrase-protect-by",
base::PHRASE_EVENT,
Person,
Person,
),
passive(
&["trained by", "coached by"],
"mentors",
"phrase-coach-by",
base::PHRASE_EVENT,
Person,
Person,
),
passive(
&["loved by"],
"loves",
"phrase-love-by",
base::PHRASE_EVENT,
Person,
Person,
),
passive(
&["hated by"],
"hates",
"phrase-hate-by",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["raised", "raises", "raise"],
"raised",
"phrase-raise",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["adopted", "adopts", "adopt"],
"adopted",
"phrase-adopt",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&["gave birth to", "gives birth to"],
"mother_of",
"phrase-birth",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&["fathered", "fathers"],
"father_of",
"phrase-father",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&["taught", "teaches", "teach", "tutored", "tutors"],
"teacher_of",
"phrase-teach",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&["coached", "coaches", "trained", "trains"],
"mentors",
"phrase-coach",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&[
"works for",
"worked for",
"work for",
"reports to",
"reported to",
],
"works_for",
"phrase-works-for",
base::PHRASE_FACTUAL,
Person,
Any,
),
rule(
&["works with", "worked with", "work with"],
"works_with",
"phrase-works-with",
base::PHRASE_EVENT,
Person,
Person,
),
rule(
&[
"works in",
"worked in",
"teaches at",
"taught at",
"interned at",
"volunteers at",
"volunteered at",
],
"works_at",
"phrase-works-at",
base::PHRASE_FACTUAL,
Person,
Place,
),
rule(
&["hired", "hires", "hire", "employs", "employed"],
"employs",
"phrase-employ",
base::PHRASE_FACTUAL,
Person,
Person,
),
passive(
&["employed by", "hired by"],
"employs",
"phrase-employed-by",
base::PHRASE_FACTUAL,
Person,
Any,
),
rule(
&[
"studied at",
"studies at",
"graduated from",
"graduates from",
"enrolled at",
"enrolled in",
],
"attends",
"phrase-studies-at",
base::PHRASE_FACTUAL,
Person,
Place,
),
rule(
&["attended", "attends", "attend"],
"attends",
"phrase-attend",
base::PHRASE_EVENT,
Person,
Venue,
),
rule(
&[
"lives in",
"lived in",
"live in",
"living in",
"lives at",
"lived at",
"lives on",
"lived on",
"resides in",
"resided in",
"moved to",
"moves to",
"moved into",
"moves into",
"relocated to",
"settled in",
"settles in",
"grew up in",
"grows up in",
],
"lives_in",
"phrase-lives-in",
base::PHRASE_FACTUAL,
Person,
Place,
),
rule(
&["born in", "was born in", "is born in"],
"born_in",
"phrase-born-in",
base::PHRASE_FACTUAL,
Person,
Place,
),
rule(
&["died in", "dies in"],
"died_in",
"phrase-died-in",
base::PHRASE_FACTUAL,
Person,
Place,
),
rule(
&[
"lives with",
"lived with",
"live with",
"living with",
"moved in with",
"moves in with",
],
"lives_with",
"phrase-lives-with",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&[
"lives next to",
"lived next to",
"lives next door to",
"lived next door to",
],
"neighbor_of",
"phrase-next-door",
base::PHRASE_FACTUAL,
Person,
Person,
),
rule(
&[
"is in",
"was in",
"is located in",
"was located in",
"is situated in",
"stands in",
"sits in",
"lies in",
],
"located_in",
"phrase-located-in",
base::PHRASE_FACTUAL,
Venue,
Place,
),
rule(
&[
"joined",
"joins",
"join",
"is a member of",
"was a member of",
"belongs to",
"belonged to",
],
"member_of",
"phrase-member",
base::PHRASE_FACTUAL,
Person,
Venue,
),
rule(
&[
"leads",
"led",
"heads",
"headed",
"chairs",
"chaired",
"captained",
],
"leads",
"phrase-lead",
base::PHRASE_EVENT,
Person,
Venue,
),
rule(
&[
"owns",
"owned",
"own",
"bought",
"buys",
"purchased",
"inherited",
"inherits",
],
"owns",
"phrase-own",
base::PHRASE_FACTUAL,
Person,
Venue,
),
rule(
&["founded", "founds", "cofounded"],
"founded",
"phrase-found",
base::PHRASE_FACTUAL,
Person,
Venue,
),
rule(
&["runs", "ran", "run", "manages", "managed"],
"runs",
"phrase-run",
base::PHRASE_FACTUAL,
Person,
Venue,
),
];