Permalink
Fetching contributors…
Cannot retrieve contributors at this time
96 lines (82 sloc) 2.68 KB
articles(
@key
article_id text,
@searchable
text text).
@source
sentences(
@XXXreferences(relation="articles", column="article_id")
document_id text,
@searchable
sentence text,
words text[],
lemma text[],
pos_tags text[],
dependencies text[],
ner_tags text[],
sentence_offset int,
// TODO @token_ranges
@key
sentence_id text).
@extraction
people_mentions(
@references(relation="sentences", column="sentence_id")
sentence_id text,
@highlight_start()
start_position int,
@highlight_length()
length int,
@searchable
@navigable
text text,
@key
mention_id text).
@extraction
has_spouse_candidates(
@references(relation="people_mentions", column="mention_id", alias="p1")
person1_id text,
@references(relation="people_mentions", column="mention_id", alias="p2")
person2_id text,
@references(relation="sentences", column="sentence_id")
sentence_id text,
@searchable
description text,
@key
relation_id text,
@navigable
is_true boolean).
has_spouse_features(
@references(relation="has_spouse_candidates", column="relation_id")
relation_id text,
@navigable
feature text).
has_spouse?(
@key
@references(relation="has_spouse_candidates", column="relation_id")
relation_id text
).
people_mentions += ext_people(s, ARRAY_TO_STRING(words, "~^~"), ARRAY_TO_STRING(ner_tags, "~^~")) :-
sentences(a, b, words, c, d, e, ner_tags, f, s).
function ext_people over rows like ext_people_input
returns rows like people_mentions
implementation "udf/ext_people.py" handles tsv lines.
has_spouse_candidates += ext_has_spouse(s, p1_id, p1_text, p2_id, p2_text) :-
people_mentions(s, a, b, p1_text, p1_id),
people_mentions(s, c, d, p2_text, p2_id).
function ext_has_spouse over rows like ext_has_spouse_input
returns rows like has_spouse_candidates
implementation "udf/ext_has_spouse.py" handles tsv lines.
has_spouse_features += ext_has_spouse_features(ARRAY_TO_STRING(words, "~^~"), rid, p1idx, p1len, p2idx, p2len) :-
sentences(a, b, words, c, d, e, f, g, s),
has_spouse_candidates(person1_id, person2_id, s, h, rid, x),
people_mentions(s, p1idx, p1len, k, person1_id),
people_mentions(s, p2idx, p2len, l, person2_id).
function ext_has_spouse_features over rows like ext_has_spouse_features_input
returns rows like has_spouse_features
implementation "udf/ext_has_spouse_features.py" handles tsv lines.
@label(l)
has_spouse(rid) :- has_spouse_candidates(a, b, c, d, rid, l).
@weight(f)
has_spouse(rid) :-
has_spouse_candidates(a, b, c, d, rid, l),
has_spouse_features(rid, f).