Update app.py
Browse files
app.py
CHANGED
@@ -110,7 +110,7 @@ SENSE = re.compile(r'^(?P<item>\d+)#(?P<sense>\d+)$')
|
|
110 |
|
111 |
|
112 |
# noinspection PyPep8Naming
|
113 |
-
def visualize(G: nx.Graph, seed: int = 0) -> Figure:
|
114 |
pos = nx.spring_layout(G, seed=seed)
|
115 |
|
116 |
fig = plt.figure(dpi=240)
|
@@ -122,8 +122,8 @@ def visualize(G: nx.Graph, seed: int = 0) -> Figure:
|
|
122 |
|
123 |
|
124 |
# noinspection PyPep8Naming
|
125 |
-
def watset(G: nx.Graph[str], algorithm: str, seed: int = 0,
|
126 |
-
jar: str = 'watset.jar', timeout: int = 10) -> tuple[pd.DataFrame, Optional[nx.Graph[str]]]:
|
127 |
with (NamedTemporaryFile() as graph,
|
128 |
NamedTemporaryFile(mode='rb') as clusters,
|
129 |
NamedTemporaryFile(mode='rb') as senses):
|
@@ -178,7 +178,7 @@ def handler(file: BinaryIO, algorithm: str, seed: int) -> tuple[pd.DataFrame, Fi
|
|
178 |
except csv.Error:
|
179 |
delimiter = ','
|
180 |
|
181 |
-
G: nx.Graph[str] = nx.read_edgelist(file.name, delimiter=delimiter, comments='\n', data=[('weight', float)])
|
182 |
|
183 |
mapping: dict[str, int] = {}
|
184 |
reverse: dict[int, str] = {}
|
|
|
110 |
|
111 |
|
112 |
# noinspection PyPep8Naming
|
113 |
+
def visualize(G: 'nx.Graph[str]', seed: int = 0) -> Figure:
|
114 |
pos = nx.spring_layout(G, seed=seed)
|
115 |
|
116 |
fig = plt.figure(dpi=240)
|
|
|
122 |
|
123 |
|
124 |
# noinspection PyPep8Naming
|
125 |
+
def watset(G: 'nx.Graph[str]', algorithm: str, seed: int = 0,
|
126 |
+
jar: str = 'watset.jar', timeout: int = 10) -> tuple[pd.DataFrame, Optional['nx.Graph[str]']]:
|
127 |
with (NamedTemporaryFile() as graph,
|
128 |
NamedTemporaryFile(mode='rb') as clusters,
|
129 |
NamedTemporaryFile(mode='rb') as senses):
|
|
|
178 |
except csv.Error:
|
179 |
delimiter = ','
|
180 |
|
181 |
+
G: 'nx.Graph[str]' = nx.read_edgelist(file.name, delimiter=delimiter, comments='\n', data=[('weight', float)])
|
182 |
|
183 |
mapping: dict[str, int] = {}
|
184 |
reverse: dict[int, str] = {}
|