Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BA Timeline Summarization
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
kaiser
BA Timeline Summarization
Commits
92689087
Commit
92689087
authored
3 years ago
by
vvye
Browse files
Options
Downloads
Patches
Plain Diff
Rename sentence summarization to sentence shortening for clarity
parent
32ad8ed1
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
sentence_shortening.py
+4
-4
4 additions, 4 deletions
sentence_shortening.py
with
4 additions
and
4 deletions
sentence_shortening.py
+
4
−
4
View file @
92689087
...
...
@@ -3,17 +3,17 @@ from Bio import pairwise2
import
pickle
import
string
s
ummariz
ed_sentences
=
pickle
.
load
(
open
(
'
data/in/summarized_sentences.pkl
'
,
'
rb
'
))
s
horten
ed_sentences
=
pickle
.
load
(
open
(
'
data/in/summarized_sentences.pkl
'
,
'
rb
'
))
with
open
(
'
data/in/sentence_summarization_vocab.txt
'
,
encoding
=
'
utf-8
'
)
as
f
:
vocab
=
[
line
.
strip
()
for
line
in
f
.
readlines
()
if
line
.
strip
()]
def
shorten
(
sentence
,
num_tokens
,
do_resolve_unks
=
True
):
try
:
s
ummariz
ed_sentence
=
s
ummariz
ed_sentences
[
sentence
.
lower
()][
num_tokens
]
s
horten
ed_sentence
=
s
horten
ed_sentences
[
sentence
.
lower
()][
num_tokens
]
if
do_resolve_unks
:
s
ummariz
ed_sentence
=
resolve_unks
(
sentence
,
s
ummariz
ed_sentence
)
return
s
ummariz
ed_sentence
s
horten
ed_sentence
=
resolve_unks
(
sentence
,
s
horten
ed_sentence
)
return
s
horten
ed_sentence
except
KeyError
:
print
(
sentence
)
with
open
(
'
missing-sentences_
'
+
str
(
num_tokens
)
+
'
.txt
'
,
'
a
'
,
encoding
=
'
utf-8
'
)
as
f
:
...
...
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