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
5e6a4953
Commit
5e6a4953
authored
7 years ago
by
Victor Zimmermann
Browse files
Options
Downloads
Patches
Plain Diff
Formatting.
parent
9af20889
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/absinth.py
+11
-0
11 additions, 0 deletions
src/absinth.py
src/abstinent.py
+11
-0
11 additions, 0 deletions
src/abstinent.py
with
22 additions
and
0 deletions
src/absinth.py
+
11
−
0
View file @
5e6a4953
...
...
@@ -148,6 +148,8 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
node_freq_dict
=
json
.
load
(
node_file
)
edge_freq_dict
=
json
.
load
(
edge_file
)
edge_freq_dict
=
{(
key1
,
key2
):
value2
for
key1
,
value1
in
edge_freq_dict
.
items
()
for
key2
,
value2
in
value1
.
items
()}
continue
if
graph_in_existence
==
False
:
...
...
@@ -157,6 +159,15 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
with
open
(
config
.
graph
+
node_dict_name
,
'
w
'
)
as
node_file
,
open
(
config
.
graph
+
edge_dict_name
,
'
w
'
)
as
edge_file
:
json
.
dump
(
node_freq_dict
,
node_file
)
new_dict
=
dict
()
for
key
,
value
in
edge_freq_dict
.
items
():
if
key
[
0
]
in
new_dict
:
key
[
0
].
add
({
key
[
1
]:
value
})
else
:
key
[
0
]
=
{
key
[
1
]:
value
}
edge_freq_dict
=
new_dict
json
.
dump
(
edge_freq_dict
,
edge_file
)
#builds graph from these dictionaries, also applies multiple filters
...
...
This diff is collapsed.
Click to expand it.
src/abstinent.py
+
11
−
0
View file @
5e6a4953
...
...
@@ -366,6 +366,8 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
node_freq_dict
=
json
.
load
(
node_file
)
edge_freq_dict
=
json
.
load
(
edge_file
)
edge_freq_dict
=
{(
key1
,
key2
):
value2
for
key1
,
value1
in
edge_freq_dict
.
items
()
for
key2
,
value2
in
value1
.
items
()}
continue
if
graph_in_existence
==
False
:
...
...
@@ -375,6 +377,15 @@ def induce(topic_name: str, result_list: list) -> (nx.Graph, list, dict):
with
open
(
config
.
graph
+
node_dict_name
,
'
w
'
)
as
node_file
,
open
(
config
.
graph
+
edge_dict_name
,
'
w
'
)
as
edge_file
:
json
.
dump
(
node_freq_dict
,
node_file
)
new_dict
=
dict
()
for
key
,
value
in
edge_freq_dict
.
items
():
if
key
[
0
]
in
new_dict
:
key
[
0
].
add
({
key
[
1
]:
value
})
else
:
key
[
0
]
=
{
key
[
1
]:
value
}
edge_freq_dict
=
new_dict
json
.
dump
(
edge_freq_dict
,
edge_file
)
#builds graph from these dictionaries, also applies multiple filters
...
...
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