LMartinezEXEX commited on
Commit
389387c
1 Parent(s): 47c6ffb

Minimal code refractor of connector classes

Browse files
Files changed (1) hide show
  1. modules/module_connection.py +6 -8
modules/module_connection.py CHANGED
@@ -40,11 +40,10 @@ class PhraseBiasExplorerConnector(Connector):
40
  self,
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(
 
40
  self,
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(