Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Absinth - A Small World of Semantic Similarity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Victor Zimmermann
Absinth - A Small World of Semantic Similarity
Commits
b3e24faf
Commit
b3e24faf
authored
7 years ago
by
Victor Zimmermann
Browse files
Options
Downloads
Patches
Plain Diff
More graph saving.
parent
733e32e1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/abstinent.py
+28
-2
28 additions, 2 deletions
src/abstinent.py
with
28 additions
and
2 deletions
src/abstinent.py
+
28
−
2
View file @
b3e24faf
...
@@ -347,8 +347,34 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
...
@@ -347,8 +347,34 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
stat_dict
[
'
target
'
]
=
topic_name
stat_dict
[
'
target
'
]
=
topic_name
print
(
'
[a]
'
,
'
Counting nodes and edges.
\t
(
'
+
topic_name
+
'
)
'
)
print
(
'
[a]
'
,
'
Counting nodes and edges.
\t
(
'
+
topic_name
+
'
)
'
)
node_freq_dict
,
edge_freq_dict
=
frequencies
(
topic_name
,
result_list
)
#Check if frequencies were already counted before.
node_dict_name
=
topic_name
+
'
_node.json
'
edge_dict_name
=
topic_name
+
'
_edge.json
'
graph_in_existence
=
False
for
graph_name
in
os
.
listdir
(
config
.
graph
):
if
topic_name
in
graph_name
:
graph_in_existence
=
True
with
open
(
config
.
graph
+
node_dict_name
,
'
r
'
)
as
node_file
,
open
(
config
.
graph
+
edge_dict_name
,
'
r
'
)
as
edge_file
:
node_freq_dict
=
json
.
load
(
node_file
)
edge_freq_dict
=
json
.
load
(
edge_file
)
continue
if
graph_in_existence
==
False
:
node_freq_dict
,
edge_freq_dict
=
frequencies
(
target_string
,
result_list
)
with
open
(
config
.
graph
+
node_dict_name
,
'
w
'
)
as
node_file
,
open
(
config
.
graph
+
edge_dict_name
,
'
w
'
)
as
edge_file
:
node_file
.
write
(
json
.
dumps
(
node_freq_dict
))
edge_file
.
write
(
json
.
dumps
(
edge_freq_dict
))
#builds graph from these dictionaries, also applies multiple filters
#builds graph from these dictionaries, also applies multiple filters
print
(
'
[a]
'
,
'
Building graph.
\t
(
'
+
topic_name
+
'
)
'
)
print
(
'
[a]
'
,
'
Building graph.
\t
(
'
+
topic_name
+
'
)
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment