@source articles( @key @distributed_by id text, @searchable content text ). #articles( # @key # id text, # content text #). # #function articles over( # doc_id text, # content text #) returns rows like articles # implementation "udf/articles.py" handles tsv lines. # #articles += articles(doc_id,content):- # articles(doc_id,content). @source sentences( @key @distributed_by doc_id text, @key sentence_index int, @searchable sentence_text text, tokens text[], lemmas text[], pos_tags text[], ner_tags text[], doc_offsets int[], dep_types text[], dep_tokens int[] ). function nlp_markup over ( doc_id text, content text ) returns rows like sentences implementation "udf/nlp_markup_with_foolnltk.py" handles tsv lines. sentences += nlp_markup(doc_id, content) :- articles(doc_id, content). entity_mention( entity_id text, entity_text text, entity_type text, doc_id text, sentence_index int, begin_index int, end_index int ). function map_entity_mention over( doc_id text, sentence_index int, tokens text[], ner_tags text[] )returns rows like entity_mention implementation "udf/map_entity_mention.py" handles tsv lines. entity_mention += map_entity_mention( doc_id,sentence_index,tokens,ner_tags):- sentences(doc_id,sentence_index,_,tokens,_,_,ner_tags,_,_,_). relation( @key @distributed_by id text, name text, step_host int, type_host text, step_guest int, type_guest text ). @source feature_window( @key size int ). label_guest_BiddingAgency( entity_id text, label int, rule_id text ). function supervise_guest_BiddingAgency over( entity_id text,entity_begin int,entity_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], pos_tags text[], ner_tags text[] )returns rows like label_guest_BiddingAgency implementation "/udf/supervise_guest_BiddingAgency.py" handles tsv lines. label_guest_BiddingAgency += supervise_guest_BiddingAgency( entity_id,entity_begin,entity_end,doc_id,sentence_index,sentence_text,tokens,pos_tags,ner_tags ):- entity_mention(entity_id,_,guest_type,doc_id,sentence_index,entity_begin,entity_end), relation(id,_,_,_,_,guest_type), id = "BiddingAgency", sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_). label_guest_Tenderer( entity_id text, label int, rule_id text ). function supervice_guest_Tenderer over( entity_id text,entity_begin int,entity_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], pos_tags text[], ner_tags text[] )returns rows like label_guest_Tenderer implementation "udf/supervise_guest_Tenderer.py" handles tsv lines. label_guest_Tenderer+= supervice_guest_Tenderer( entity_id,entity_begin,entity_end, doc_id, sentence_index, sentence_text, tokens, pos_tags, ner_tags ):- sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_), entity_mention(entity_id,_,guest_type,doc_id,sentence_index,entity_begin,entity_end), relation(id,_,_,_,_,guest_type), id="Tenderer". label_guest_SignUpStart( entity_id text, label int, rule_id text ). function supervice_guest_SignUpStart over( entity_id text,entity_begin int,entity_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], pos_tags text[], ner_tags text[] )returns rows like label_guest_SignUpStart implementation "udf/supervise_guest_SignUpStart.py" handles tsv lines. label_guest_SignUpStart+= supervice_guest_SignUpStart( entity_id,entity_begin,entity_end, doc_id, sentence_index, sentence_text, tokens, pos_tags, ner_tags ):- sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_), entity_mention(entity_id,_,guest_type,doc_id,sentence_index,entity_begin,entity_end), relation(id,_,_,_,_,guest_type), id="SignUpStart". label_guest_BiddingOT( entity_id text, label int, rule_id text ). function supervice_guest_BiddingOT over( entity_id text,entity_begin int,entity_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], pos_tags text[], ner_tags text[] )returns rows like label_guest_BiddingOT implementation "udf/supervise_guest_BiddingOT.py" handles tsv lines. label_guest_BiddingOT+= supervice_guest_BiddingOT( entity_id,entity_begin,entity_end, doc_id, sentence_index, sentence_text, tokens, pos_tags, ner_tags ):- sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_), entity_mention(entity_id,_,guest_type,doc_id,sentence_index,entity_begin,entity_end), relation(id,_,_,_,_,guest_type), id="BiddingOT". label_guest_SignUpEnd( entity_id text, label int, rule_id text ). function supervice_guest_SignUpEnd over( entity_id text,entity_begin int,entity_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], pos_tags text[], ner_tags text[] )returns rows like label_guest_SignUpEnd implementation "udf/supervise_guest_SignUpEnd.py" handles tsv lines. label_guest_SignUpEnd+= supervice_guest_SignUpEnd( entity_id,entity_begin,entity_end, doc_id, sentence_index, sentence_text, tokens, pos_tags, ner_tags ):- sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_), entity_mention(entity_id,_,guest_type,doc_id,sentence_index,entity_begin,entity_end), relation(id,_,_,_,_,guest_type), id="SignUpEnd". label_guest_WinnerOfBidding( entity_id text, label int, rule_id text ). function supervice_guest_WinnerOfBidding over( entity_id text,entity_begin int,entity_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], pos_tags text[], ner_tags text[] )returns rows like label_guest_WinnerOfBidding implementation "udf/supervise_guest_WinnerOfBidding.py" handles tsv lines. label_guest_WinnerOfBidding += supervice_guest_WinnerOfBidding( entity_id,entity_begin,entity_end, doc_id, sentence_index, sentence_text, tokens, pos_tags, ner_tags ):- sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_), entity_mention(entity_id,_,guest_type,doc_id,sentence_index,entity_begin,entity_end), relation(id,_,_,_,_,guest_type), id="WinnerOfBidding". label_guest_FirstCandidate( entity_id text, label int, rule_id text ). function supervice_guest_FirstCandidate over( entity_id text,entity_begin int,entity_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], pos_tags text[], ner_tags text[] )returns rows like label_guest_FirstCandidate implementation "udf/supervise_guest_FirstCandidate.py" handles tsv lines. label_guest_FirstCandidate += supervice_guest_FirstCandidate( entity_id,entity_begin,entity_end, doc_id, sentence_index, sentence_text, tokens, pos_tags, ner_tags ):- sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_), entity_mention(entity_id,_,guest_type,doc_id,sentence_index,entity_begin,entity_end), relation(id,_,_,_,_,guest_type), id="FirstCandidate". label_guest_SecondCandidate( entity_id text, label int, rule_id text ). function supervice_guest_SecondCandidate over( entity_id text,entity_begin int,entity_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], pos_tags text[], ner_tags text[] )returns rows like label_guest_SecondCandidate implementation "udf/supervise_guest_SecondCandidate.py" handles tsv lines. label_guest_SecondCandidate += supervice_guest_SecondCandidate( entity_id,entity_begin,entity_end, doc_id, sentence_index, sentence_text, tokens, pos_tags, ner_tags ):- sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_), entity_mention(entity_id,_,guest_type,doc_id,sentence_index,entity_begin,entity_end), relation(id,_,_,_,_,guest_type), id="SecondCandidate". label_guest_ThirdCandidate( entity_id text, label int, rule_id text ). function supervice_guest_ThirdCandidate over( entity_id text,entity_begin int,entity_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], pos_tags text[], ner_tags text[] )returns rows like label_guest_ThirdCandidate implementation "udf/supervise_guest_ThirdCandidate.py" handles tsv lines. label_guest_ThirdCandidate += supervice_guest_ThirdCandidate( entity_id,entity_begin,entity_end, doc_id, sentence_index, sentence_text, tokens, pos_tags, ner_tags ):- sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_), entity_mention(entity_id,_,guest_type,doc_id,sentence_index,entity_begin,entity_end), relation(id,_,_,_,_,guest_type), id="ThirdCandidate". feature_entity( @key @references(relation="isBiddingAgency",column="entity_id",alias="isBiddingAgency") entity_id text, feature text, window_size int ). function feature_entity over( entity_id text, entity_begin int, entity_end int, doc_id text, sentence_index int, tokens text[], pos_tags text[], ner_tags text[], window_size int )returns rows like feature_guest_BiddingAgency implementation "/udf/feature_entity.py" handles tsv lines. feature_entity += feature_entity( entity_id,entity_begin,entity_end,doc_id,sentence_index,tokens,pos_tags,ner_tags,window_size ):- entity_mention(entity_id,entity_text,_,doc_id,sentence_index,entity_begin,entity_end), sentences(doc_id,sentence_index,sentence_text,tokens,_,pos_tags,ner_tags,_,_,_), feature_window(window_size). @extraction is_biddingagency?( @key @references(relation="entity_mention",column="entity_id",alias="entity_mention") entity_id text ). is_biddingagency(entity_id) = if label>0 then TRUE else if label<0 then FALSE else NULL end:- label_guest_BiddingAgency(entity_id,label,_). @weight(f_BiddingAgency) is_biddingagency(entity_id):- feature_entity(entity_id,f_BiddingAgency,window), label_guest_BiddingAgency(entity_id,_,_), window=10. @extraction is_winnerofbidding?( @key @references(relation="entity_mention",column="entity_id",alias="entity_mention") entity_id text ). is_winnerofbidding(entity_id) = if label>0 then TRUE else if label<0 then FALSE else NULL end:- label_guest_WinnerOfBidding(entity_id,label,_). @weight(f_WinnerOfBidding) is_winnerofbidding(entity_id):- feature_entity(entity_id,f_WinnerOfBidding,window), label_guest_WinnerOfBidding(entity_id,_,_), window=10. candidate_entity_pair( p1_id text, p1_name text, p2_id text, p2_name text ). num_entity(doc_id,sentence_index,COUNT(p)):- entity_mention(p,_,_,doc_id,sentence_index,_,_). function map_candidate_entity_pair over( entity1_id text, entity1_name text, entity2_id text, entity2_name text )returns rows like candidate_entity_pair implementation "udf/map_candidate_entity_pair.py" handles tsv lines. candidate_entity_pair += map_candidate_entity_pair(entity1,entity1_name,entity2,entity2_name):- num_entity(same_doc,same_sentence,num_p), entity_mention(entity1,entity1_name,_,same_doc,same_sentence,entity1_begin,_), entity_mention(entity2,entity2_name,_,same_doc,same_sentence,entity2_begin,_), num_p<5, entity1!=entity2, entity1_name!=entity2_name, entity1_begin!=entity2_begin. feature_entity_pair( @key @references(relation="has_entrust",column="entity1_id",alias="has_entrust") entity1_id text, @key @references(relation="has_entrust",column="entity2_id",alias="has_entrust") entity2_id text, feature text, window_size int ). function feature_entity_pair over( entity1_id text, entity2_id text, entity1_begin_index text, entity1_end_index text, entity2_begin_index text, entity2_end_index text, doc_id text, sentence_index int, tokens text[], lemmas text[], pos_tags text[], ner_tags text[], dep_types text[], dep_tokens text[], window_size int )returns rows like feature_entity_pair implementation "udf/feature_entity_pair.py" handles tsv lines. feature_entity_pair += feature_entity_pair( entity1_id,entity2_id,entity1_begin_index,entity1_end_index,entity2_begin_index,entity2_end_index, doc_id,sentence_index,tokens,lemmas,pos_tags,ner_tags,dep_types,dep_tokens,window_size):- sentences(doc_id,sentence_index,_,tokens,lemmas,pos_tags,ner_tags,_,dep_types,dep_tokens), entity_mention(entity1_id,_,_,doc_id,sentence_index,entity1_begin_index,entity1_end_index), entity_mention(entity2_id,_,_,doc_id,sentence_index,entity2_begin_index,entity2_end_index), entity1_id!=entity2_id, feature_window(window_size), window_size=10. @extraction label_entrust( @key @references(relation="has_entrust",column="entity1_id",alias="has_entrust") entity1_id text, @key @references(relation="has_entrust",column="entity2_id",alias="has_entrust") entity2_id text, @navigable label int, @navigable rule_id text ). label_entrust(entity1_id,entity2_id,0,NULL):-candidate_entity_pair(entity1_id,_,entity2_id,_). function supervise_entrust over( entity1_id text, entity1_begin int, entity1_end int, entity2_id text, entity2_begin int, entity2_end int, doc_id text, sentence_index int, sentence_text text, tokens text[], lemmas text[], pos_tags text[], ner_tags text[], dep_types text[], dep_tokens int[] )returns( entity1_id text,entity2_id text,label int,rult_id text ) implementation "udf/supervise_entrust.py" handles tsv lines. label_entrust += supervise_entrust( entity1_id,entity1_begin,entity1_end, entity2_id,entity2_begin,entity2_end, doc_id,sentence_index,sentence_text, tokens,lemmas,pos_tags,ner_tags,dep_types,dep_tokens ):- candidate_entity_pair(entity1_id,_,entity2_id,_), entity_mention(entity1_id,entity1_name,_,doc_id,sentence_index,entity1_begin,entity1_end), entity_mention(entity2_id,entity2_name,_,_,_,entity2_begin,entity2_end), sentences( doc_id,sentence_index,sentence_text, tokens,lemmas,pos_tags,ner_tags,_,dep_types,dep_tokens ). label_entrust_resolved(entity1_id,entity2_id,SUM(vote)):-label_entrust(entity1_id,entity2_id,vote,rule_id). @extraction has_entrust?( @key @references(relation="entity_mention", column="entity_id", alias="entity_mention") entity1_id text, @key @references(relation="entity_mention", column="entity_id", alias="entity_mention") entity2_id text ). has_entrust(entity1_id,entity2_id) = if label>0 then TRUE else if label<0 then FALSE else NULL end :- label_entrust_resolved(entity1_id,entity2_id,label). @weight(f) has_entrust(entity1_id,entity2_id):- feature_entity_pair(entity1_id,entity2_id,f,window), window=10.