pszemraj commited on
Commit
32939cb
1 Parent(s): c9456c2

output naming cleanup

Browse files

Signed-off-by: peter szemraj <peterszemraj@gmail.com>

Files changed (2) hide show
  1. app.py +0 -1
  2. utils.py +3 -2
app.py CHANGED
@@ -40,7 +40,6 @@ from utils import load_example_filenames, saves_summary, truncate_word_count
40
 
41
  _here = Path(__file__).parent
42
 
43
- # os.environ["NLTK_DATA"] = str(_here / "nltk_data")
44
  nltk.download("punkt", force=True, quiet=True)
45
  nltk.download("popular", force=True, quiet=True)
46
 
 
40
 
41
  _here = Path(__file__).parent
42
 
 
43
  nltk.download("punkt", force=True, quiet=True)
44
  nltk.download("popular", force=True, quiet=True)
45
 
utils.py CHANGED
@@ -172,7 +172,7 @@ def saves_summary(
172
  kwargs: additional keyword arguments to include in the output file
173
  """
174
  logger = logging.getLogger(__name__)
175
- sum_text = [f"\t{s['summary'][0]}\n" for s in summarize_output]
176
  sum_scores = [f"\n - {round(s['summary_score'],4)}" for s in summarize_output]
177
  scores_text = "\n".join(sum_scores)
178
  full_summary = "\n".join(sum_text)
@@ -180,7 +180,7 @@ def saves_summary(
180
  keywords = "_".join(extract_keywords(full_summary, kw_max_len=4))
181
  logger.debug(f"kw:\t{keywords}")
182
  outpath = (
183
- Path.cwd() / f"DocSummary_{keywords}_{get_timestamp()}.txt"
184
  if outpath is None
185
  else Path(outpath)
186
  )
@@ -199,6 +199,7 @@ def saves_summary(
199
  with open(
200
  outpath,
201
  "a",
 
202
  ) as fo:
203
  fo.write("\n")
204
  fo.write(f"## Section Scores:\n\n")
 
172
  kwargs: additional keyword arguments to include in the output file
173
  """
174
  logger = logging.getLogger(__name__)
175
+ sum_text = [f"{s['summary'][0]}\n" for s in summarize_output]
176
  sum_scores = [f"\n - {round(s['summary_score'],4)}" for s in summarize_output]
177
  scores_text = "\n".join(sum_scores)
178
  full_summary = "\n".join(sum_text)
 
180
  keywords = "_".join(extract_keywords(full_summary, kw_max_len=4))
181
  logger.debug(f"kw:\t{keywords}")
182
  outpath = (
183
+ Path.cwd() / f"DocSumm_{keywords}_{get_timestamp()}.txt"
184
  if outpath is None
185
  else Path(outpath)
186
  )
 
199
  with open(
200
  outpath,
201
  "a",
202
+ encoding="utf-8",
203
  ) as fo:
204
  fo.write("\n")
205
  fo.write(f"## Section Scores:\n\n")