Skip to content

Commit

Permalink
update parse to run with inouthandler class
Browse files Browse the repository at this point in the history
  • Loading branch information
iulusoy committed Sep 20, 2024
1 parent 70e96f3 commit 1b8ec76
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mailcom/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import spacy as sp
from transformers import pipeline
from pathlib import Path
from mailcom import inout
from mailcom.inout import InoutHandler

# please modify this section depending on your setup
# input language - either "es" or "fr"
Expand Down Expand Up @@ -116,13 +116,16 @@ def make_dir(path: str):
print("Generating output directory/ies.")
make_dir(path_output)
# process the text
io = inout.InoutHandler()
eml_files = io.list_of_files(path_input)
io = InoutHandler(path_input)
io.list_of_files()

Check warning on line 120 in mailcom/parse.py

View check run for this annotation

Codecov / codecov/patch

mailcom/parse.py#L119-L120

Added lines #L119 - L120 were not covered by tests
# html_files = list_of_files(path_input, "html")
for file in eml_files:
for file in io.email_list:
text = io.get_text(file)
text = io.get_html_text(text)

Check warning on line 124 in mailcom/parse.py

View check run for this annotation

Codecov / codecov/patch

mailcom/parse.py#L122-L124

Added lines #L122 - L124 were not covered by tests
print(text)
print(io.email_content["date"])
print(io.email_content["attachment"])
print(io.email_content["attachement type"])

Check warning on line 128 in mailcom/parse.py

View check run for this annotation

Codecov / codecov/patch

mailcom/parse.py#L126-L128

Added lines #L126 - L128 were not covered by tests
# skip this text if email could not be parsed
if not text:
continue
Expand Down

0 comments on commit 1b8ec76

Please sign in to comment.