LMartinezEXEX commited on
Commit
524b9ae
1 Parent(s): ce7ab31

Minimal code refractor of connector classes

Browse files
Files changed (1) hide show
  1. modules/module_connection.py +5 -7
modules/module_connection.py CHANGED
@@ -41,10 +41,9 @@ class PhraseBiasExplorerConnector(Connector):
41
  **kwargs
42
  ) -> None:
43
 
44
- if 'language_model' in kwargs and 'lang' in kwargs:
45
- language_model = kwargs.get('language_model')
46
- lang = kwargs.get('lang')
47
- else:
48
  raise KeyError
49
 
50
  self.phrase_bias_explorer = RankSents(
@@ -89,9 +88,8 @@ class CrowsPairsExplorerConnector(Connector):
89
  **kwargs
90
  ) -> None:
91
 
92
- if 'language_model' in kwargs:
93
- language_model = kwargs.get('language_model')
94
- else:
95
  raise KeyError
96
 
97
  self.crows_pairs_explorer = CrowsPairs(
 
41
  **kwargs
42
  ) -> None:
43
 
44
+ language_model = kwargs.get('language_model', None)
45
+ lang = kwargs.get('lang', None)
46
+ if language_model is None or lang is None:
 
47
  raise KeyError
48
 
49
  self.phrase_bias_explorer = RankSents(
 
88
  **kwargs
89
  ) -> None:
90
 
91
+ language_model = kwargs.get('language_model', None)
92
+ if language_model is None:
 
93
  raise KeyError
94
 
95
  self.crows_pairs_explorer = CrowsPairs(