Skip to content

Commit

Permalink
replace config['has_feature'] with config.get('has_feature', False)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pasquale Minervini committed Oct 25, 2017
1 parent d7093dc commit c8b6665
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jack/readers/multiple_choice/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, shared_resources):

@property
def input_ports(self) -> List[TensorPort]:
if self.shared_resources.config["vocab_from_embeddings"]:
if self.shared_resources.config.get("vocab_from_embeddings", False):
return [Ports.Input.embedded_support, Ports.Input.embedded_question,
Ports.Input.support_length, Ports.Input.question_length]
else:
Expand Down Expand Up @@ -131,7 +131,7 @@ def create_batch(self, annotations: List[Mapping[str, any]],
is_eval: bool, with_answers: bool) -> Mapping[TensorPort, np.ndarray]:
q_lengths = [a["question_lengths"] for a in annotations]
s_lengths = [a["support_lengths"] for a in annotations]
if self.shared_resources.config["vocab_from_embeddings"]:
if self.shared_resources.config.get("vocab_from_embeddings", False):
emb_support = np.zeros([len(annotations), max(s_lengths), self.emb_matrix.shape[1]])
emb_question = np.zeros([len(annotations), max(q_lengths), self.emb_matrix.shape[1]])
for i, a in enumerate(annotations):
Expand Down

0 comments on commit c8b6665

Please sign in to comment.