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
5273a7b0
Commit
5273a7b0
authored
7 years ago
by
Victor Zimmermann
Browse files
Options
Downloads
Patches
Plain Diff
More minor edits.
parent
32cac421
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
code/absinth_nx.py
+10
-7
10 additions, 7 deletions
code/absinth_nx.py
with
10 additions
and
7 deletions
code/absinth_nx.py
+
10
−
7
View file @
5273a7b0
...
...
@@ -84,7 +84,8 @@ def frequencies(corpus_path, target, stop_words=[], allowed_tags=['NN','NNS','JJ
#print('Failed to decode:', f)
i
+=
1
print
(
'
100%
\t
Nodes: {}
\t
Edges: {}.
'
.
format
(
len
(
node_freq
),
len
(
edge_freq
)))
return
node_freq
,
edge_freq
...
...
@@ -227,7 +228,7 @@ if __name__ == '__main__':
corpus_path
=
'
/proj/absinth/wikipedia.txt.dump.20140615-en.SZTAKI/
'
results_path
=
'
/home/students/zimmermann/Courses/ws17/fsem/absinth/clustering/
'
stop
=
set
(
stopwords
.
words
(
'
english
'
)
+
[
'
utc
'
,
'
new
'
,
'
other
'
])
stop
=
set
(
stopwords
.
words
(
'
english
'
)
+
[
'
utc
'
,
'
new
'
,
'
other
'
,
'
talk
'
,
'
wikipedia
'
,
'
article
'
,
'
topic
'
,
'
page
'
,
'
editors
'
,
'
encyclopedia
'
,
'
free
'
])
results
=
dict
()
...
...
@@ -258,10 +259,12 @@ if __name__ == '__main__':
for
key
,
value
in
topics
.
items
():
target
=
value
.
strip
()
print
(
"
[A] Processing
'"
+
target
+
"'
.
\n
"
)
if
target
[:
4
]
==
'
the_
'
and
target
.
count
(
'
_
'
)
>=
2
:
#hard coded 'the'-protection
target
=
target
[
4
:]
o_target
=
value
.
strip
()
#original target
print
(
"
[A] Processing
'"
+
o_target
+
"'
.
\n
"
)
if
o_target
[:
4
]
==
'
the_
'
and
o_target
.
count
(
'
_
'
)
>=
2
:
#hard coded 'the'-protection
target
=
o_target
[
4
:]
else
:
target
=
o_target
f
=
open
(
results_path
+
target
+
'
.absinth
'
,
'
w
'
)
f
.
write
(
'
subTopicID
\t
resultID
\n
'
)
...
...
@@ -285,7 +288,7 @@ if __name__ == '__main__':
D
=
disambiguate
(
T
,
H
,
results
[
key
])
print
(
'
Mapping:
'
,
D
,
'
\n
'
)
print
(
'
[A] Writing to file
'
+
target
+
'
.absinth.
\n\n
'
)
print
(
'
[A] Writing to file
'
+
o_
target
+
'
.absinth.
\n\n
'
)
for
d
in
D
:
f
.
write
(
key
+
'
.
'
+
str
(
d
[
0
])
+
'
\t
'
+
key
+
'
.
'
+
str
(
d
[
1
])
+
'
\n
'
)
...
...
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