Skip to content

Commit

Permalink
fixed training for annotated examples where fields are annotated but …
Browse files Browse the repository at this point in the history
…form type is not
  • Loading branch information
kmike committed Feb 1, 2016
1 parent 167878d commit 5b5086c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions formasaurus/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def fields_annotated(self):
for v in self.fields.values()
)

@property
def form_annotated(self):
return self.type != self.form_schema.na_value

@property
def fields_partially_annotated(self):
"""
Expand Down
5 changes: 4 additions & 1 deletion formasaurus/fieldtype_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ def log(msg):
if verbose:
print(msg)

annotations = [a for a in annotations if a.fields_annotated]
annotations = [
a for a in annotations
if a.fields_annotated and (a.form_annotated or not use_precise_form_types)
]
log("Training on {} forms".format(len(annotations)))

if use_precise_form_types:
Expand Down

0 comments on commit 5b5086c

Please sign in to comment.