dustalov commited on
Commit
d34b927
·
verified ·
1 Parent(s): a15ff6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -71,15 +71,15 @@ class Algorithm:
71
 
72
 
73
  if 'MCL_BIN' in os.environ and os.path.isfile(os.environ['MCL_BIN']) and os.access(os.environ['MCL_BIN'], os.X_OK):
74
- mcl: Optional[str] = os.environ['MCL_BIN']
75
  else:
76
- mcl = None
77
 
78
  ALGORITHMS: Dict[str, Algorithm] = {
79
  'CW_top': Algorithm('cw', 'top'),
80
  'CW_lin': Algorithm('cw', 'lin'),
81
  'CW_log': Algorithm('cw', 'log'),
82
- 'MaxMax': Algorithm('maxmax')
83
  'Watset[CW_top, CW_top]': Algorithm('watset', None, 'cw', 'mode=top', 'cw', 'mode=top'),
84
  'Watset[CW_lin, CW_top]': Algorithm('watset', None, 'cw', 'mode=lin', 'cw', 'mode=top'),
85
  'Watset[CW_log, CW_top]': Algorithm('watset', None, 'cw', 'mode=log', 'cw', 'mode=top'),
@@ -94,18 +94,19 @@ ALGORITHMS: Dict[str, Algorithm] = {
94
  'Watset[MCL, CW_log]': Algorithm('watset', None, 'mcl', None, 'cw', 'mode=log'),
95
  }
96
 
97
- if mcl:
98
  ALGORITHMS.update({
99
- 'Watset[CW_top, MCL]': Algorithm('watset', None, 'cw', 'mode=top', 'mcl', 'mcl-bin=' + mcl),
100
- 'Watset[CW_lin, MCL]': Algorithm('watset', None, 'cw', 'mode=lin', 'mcl', 'mcl-bin=' + mcl),
101
- 'Watset[CW_log, MCL]': Algorithm('watset', None, 'cw', 'mode=log', 'mcl', 'mcl-bin=' + mcl),
102
- 'Watset[MCL, MCL]': Algorithm('watset', None, 'mcl', None, 'mcl', 'mcl-bin=' + mcl),
103
- 'MCL': Algorithm('mcl', bin=mcl)
104
  })
105
 
106
  SENSE = re.compile(r'^(?P<item>\d+)#(?P<sense>\d+)$')
107
 
108
 
 
109
  def visualize(G: nx.Graph, seed: int = 0) -> plt.Figure:
110
  pos = nx.spring_layout(G, seed=seed)
111
 
@@ -233,7 +234,9 @@ def main() -> None:
233
  ],
234
  examples=[
235
  ['java.tsv', 'Watset[MCL, CW_lin]', 0],
236
- ['java.tsv', 'MaxMax', 0]
 
 
237
  ],
238
  title='Structure Discovery with Watset',
239
  description='''
 
71
 
72
 
73
  if 'MCL_BIN' in os.environ and os.path.isfile(os.environ['MCL_BIN']) and os.access(os.environ['MCL_BIN'], os.X_OK):
74
+ MCL: Optional[str] = os.environ['MCL_BIN']
75
  else:
76
+ MCL = None
77
 
78
  ALGORITHMS: Dict[str, Algorithm] = {
79
  'CW_top': Algorithm('cw', 'top'),
80
  'CW_lin': Algorithm('cw', 'lin'),
81
  'CW_log': Algorithm('cw', 'log'),
82
+ 'MaxMax': Algorithm('maxmax'),
83
  'Watset[CW_top, CW_top]': Algorithm('watset', None, 'cw', 'mode=top', 'cw', 'mode=top'),
84
  'Watset[CW_lin, CW_top]': Algorithm('watset', None, 'cw', 'mode=lin', 'cw', 'mode=top'),
85
  'Watset[CW_log, CW_top]': Algorithm('watset', None, 'cw', 'mode=log', 'cw', 'mode=top'),
 
94
  'Watset[MCL, CW_log]': Algorithm('watset', None, 'mcl', None, 'cw', 'mode=log'),
95
  }
96
 
97
+ if MCL:
98
  ALGORITHMS.update({
99
+ 'Watset[CW_top, MCL]': Algorithm('watset', None, 'cw', 'mode=top', 'mcl', 'mcl-bin=' + MCL),
100
+ 'Watset[CW_lin, MCL]': Algorithm('watset', None, 'cw', 'mode=lin', 'mcl', 'mcl-bin=' + MCL),
101
+ 'Watset[CW_log, MCL]': Algorithm('watset', None, 'cw', 'mode=log', 'mcl', 'mcl-bin=' + MCL),
102
+ 'Watset[MCL, MCL]': Algorithm('watset', None, 'mcl', None, 'mcl', 'mcl-bin=' + MCL),
103
+ 'MCL': Algorithm('mcl', bin=MCL)
104
  })
105
 
106
  SENSE = re.compile(r'^(?P<item>\d+)#(?P<sense>\d+)$')
107
 
108
 
109
+ # noinspection PyPep8Naming
110
  def visualize(G: nx.Graph, seed: int = 0) -> plt.Figure:
111
  pos = nx.spring_layout(G, seed=seed)
112
 
 
234
  ],
235
  examples=[
236
  ['java.tsv', 'Watset[MCL, CW_lin]', 0],
237
+ ['java.tsv', 'MaxMax', 0],
238
+ ['bank.tsv', 'Watset[MCL, MCL]', 0],
239
+ ['bank.tsv', 'MCL', 0],
240
  ],
241
  title='Structure Discovery with Watset',
242
  description='''