Skip to content

Commit

Permalink
consistent defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
cjer committed May 11, 2021
1 parent 8b0bea8 commit 3336d21
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ne_evaluate_mentions.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def read_file_sents(path, comment_prefix='#', field_delim=' ', multi_delim='^',
return sents


def evaluate_files(gold_path, pred_path, fix_multi_tag_pred=True, truncate=None, ignore_cat=False, str_join_char=' ', verbose=False):
def evaluate_files(gold_path, pred_path, fix_multi_tag_pred=True, truncate=None, ignore_cat=False, str_join_char='', verbose=False):
gold_sents = read_file_sents(gold_path)
pred_sents = read_file_sents(pred_path)
gold_mentions = sents_to_mentions(gold_sents, truncate=truncate, ignore_cat=ignore_cat, str_join_char=str_join_char)
Expand Down Expand Up @@ -81,7 +81,7 @@ def evaluate_mentions(true_ments, pred_ments, examples=5, verbose=True, return_t
return prec, recall, f1


def sent_to_mentions_dict(sent, sent_id, truncate=80, ignore_cat=False, str_join_char=' '):
def sent_to_mentions_dict(sent, sent_id, truncate=None, ignore_cat=False, str_join_char=''):
mentions = defaultdict(lambda: 0)
current_mention= None
current_cat = None
Expand Down Expand Up @@ -137,14 +137,14 @@ def get_sents_fixed(sents):
sf = list(zip(list(sents.index), sf))
return sf

def sents_to_mentions(sents, truncate=80, ignore_cat=False, str_join_char=' '):
def sents_to_mentions(sents, truncate=None, ignore_cat=False, str_join_char=''):
sents_fixed = get_sents_fixed(sents)
ments = [sent_to_mentions_dict(sent, sent_id, truncate, ignore_cat=ignore_cat, str_join_char=str_join_char) for sent_id, sent in sents_fixed]
ment_set = get_ment_set(ments)
return ment_set


def get_sents_with_pred_tags(splits, preds, truncate=80):
def get_sents_with_pred_tags(splits, preds, truncate=None):
sents_preds = []
for split, pred in zip(splits, preds):
spl_preds = []
Expand Down

0 comments on commit 3336d21

Please sign in to comment.