mail2task 0.1.1__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mail2task-0.1.1 → mail2task-0.3.0}/PKG-INFO +16 -2
- {mail2task-0.1.1 → mail2task-0.3.0}/README.md +15 -1
- {mail2task-0.1.1 → mail2task-0.3.0}/pyproject.toml +1 -1
- mail2task-0.3.0/src/mail2task/cli.py +52 -0
- {mail2task-0.1.1 → mail2task-0.3.0}/src/mail2task/extractor.py +38 -2
- {mail2task-0.1.1 → mail2task-0.3.0}/src/mail2task.egg-info/PKG-INFO +16 -2
- mail2task-0.1.1/src/mail2task/cli.py +0 -25
- {mail2task-0.1.1 → mail2task-0.3.0}/setup.cfg +0 -0
- {mail2task-0.1.1 → mail2task-0.3.0}/src/mail2task/__init__.py +0 -0
- {mail2task-0.1.1 → mail2task-0.3.0}/src/mail2task/parser.py +0 -0
- {mail2task-0.1.1 → mail2task-0.3.0}/src/mail2task.egg-info/SOURCES.txt +0 -0
- {mail2task-0.1.1 → mail2task-0.3.0}/src/mail2task.egg-info/dependency_links.txt +0 -0
- {mail2task-0.1.1 → mail2task-0.3.0}/src/mail2task.egg-info/entry_points.txt +0 -0
- {mail2task-0.1.1 → mail2task-0.3.0}/src/mail2task.egg-info/requires.txt +0 -0
- {mail2task-0.1.1 → mail2task-0.3.0}/src/mail2task.egg-info/top_level.txt +0 -0
- {mail2task-0.1.1 → mail2task-0.3.0}/tests/test_extractor.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mail2task
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Extract actionable tasks from emails using Python
|
|
5
5
|
Author: Eby J Kavungal
|
|
6
6
|
Project-URL: Homepage, https://github.com/EbyJK/mail2task
|
|
@@ -77,11 +77,25 @@ Output:
|
|
|
77
77
|
{
|
|
78
78
|
"title": "submit the report by Friday.",
|
|
79
79
|
"due_date": "2026-05-29T00:00:00",
|
|
80
|
-
"priority": "normal"
|
|
80
|
+
"priority": "normal",
|
|
81
|
+
"confidence": 0.9
|
|
82
|
+
|
|
81
83
|
}
|
|
82
84
|
]
|
|
83
85
|
```
|
|
84
86
|
|
|
87
|
+
### Pretty Output
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
mail2task sample_email.txt --pretty
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Save Output
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
mail2task sample_email.txt --output tasks.json
|
|
97
|
+
```
|
|
98
|
+
|
|
85
99
|
---
|
|
86
100
|
|
|
87
101
|
## Example Use Cases
|
|
@@ -62,11 +62,25 @@ Output:
|
|
|
62
62
|
{
|
|
63
63
|
"title": "submit the report by Friday.",
|
|
64
64
|
"due_date": "2026-05-29T00:00:00",
|
|
65
|
-
"priority": "normal"
|
|
65
|
+
"priority": "normal",
|
|
66
|
+
"confidence": 0.9
|
|
67
|
+
|
|
66
68
|
}
|
|
67
69
|
]
|
|
68
70
|
```
|
|
69
71
|
|
|
72
|
+
### Pretty Output
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
mail2task sample_email.txt --pretty
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Save Output
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
mail2task sample_email.txt --output tasks.json
|
|
82
|
+
```
|
|
83
|
+
|
|
70
84
|
---
|
|
71
85
|
|
|
72
86
|
## Example Use Cases
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import json
|
|
3
|
+
from .extractor import extract_tasks
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
parser = argparse.ArgumentParser(
|
|
8
|
+
description="Extract actionable tasks from emails"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
parser.add_argument(
|
|
12
|
+
"file",
|
|
13
|
+
help="Path to the email text file"
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
parser.add_argument(
|
|
17
|
+
"--pretty",
|
|
18
|
+
action="store_true",
|
|
19
|
+
help="Pretty print the output"
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
parser.add_argument(
|
|
23
|
+
"--output",
|
|
24
|
+
help="Save output to a JSON file"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
args = parser.parse_args()
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
with open(args.file, "r", encoding="utf-8") as f:
|
|
31
|
+
content = f.read()
|
|
32
|
+
|
|
33
|
+
tasks = extract_tasks(content)
|
|
34
|
+
|
|
35
|
+
if args.pretty:
|
|
36
|
+
result = json.dumps(tasks, indent=2)
|
|
37
|
+
else:
|
|
38
|
+
result = json.dumps(tasks)
|
|
39
|
+
|
|
40
|
+
print(result)
|
|
41
|
+
|
|
42
|
+
if args.output:
|
|
43
|
+
with open(args.output, "w", encoding="utf-8") as out_file:
|
|
44
|
+
out_file.write(result)
|
|
45
|
+
|
|
46
|
+
print(f"\nSaved output to {args.output}")
|
|
47
|
+
|
|
48
|
+
except FileNotFoundError:
|
|
49
|
+
print(f"File not found: {args.file}")
|
|
50
|
+
|
|
51
|
+
except Exception as e:
|
|
52
|
+
print(f"Error: {e}")
|
|
@@ -59,6 +59,32 @@ def is_task_sentence(text: str):
|
|
|
59
59
|
return any(word in text_lower for word in ACTION_WORDS)
|
|
60
60
|
|
|
61
61
|
|
|
62
|
+
def calculate_confidence(text: str, due_date, priority):
|
|
63
|
+
score = 0.4
|
|
64
|
+
|
|
65
|
+
text_lower = text.lower()
|
|
66
|
+
|
|
67
|
+
# Action word boost
|
|
68
|
+
if any(word in text_lower for word in ACTION_WORDS):
|
|
69
|
+
score += 0.25
|
|
70
|
+
|
|
71
|
+
# Due date boost
|
|
72
|
+
if due_date:
|
|
73
|
+
score += 0.2
|
|
74
|
+
|
|
75
|
+
# Priority boost
|
|
76
|
+
if priority != "normal":
|
|
77
|
+
score += 0.1
|
|
78
|
+
|
|
79
|
+
# Sentence length quality
|
|
80
|
+
word_count = len(text.split())
|
|
81
|
+
|
|
82
|
+
if 4 <= word_count <= 20:
|
|
83
|
+
score += 0.05
|
|
84
|
+
|
|
85
|
+
return round(min(score, 0.99), 2)
|
|
86
|
+
|
|
87
|
+
|
|
62
88
|
def extract_tasks(email_text: str):
|
|
63
89
|
lines = email_text.splitlines()
|
|
64
90
|
|
|
@@ -89,10 +115,20 @@ def extract_tasks(email_text: str):
|
|
|
89
115
|
|
|
90
116
|
seen_titles.add(title.lower())
|
|
91
117
|
|
|
118
|
+
due_date = extract_due_date(line)
|
|
119
|
+
priority = detect_priority(line)
|
|
120
|
+
|
|
121
|
+
confidence = calculate_confidence(
|
|
122
|
+
line,
|
|
123
|
+
due_date,
|
|
124
|
+
priority
|
|
125
|
+
)
|
|
126
|
+
|
|
92
127
|
task = {
|
|
93
128
|
"title": title,
|
|
94
|
-
"due_date":
|
|
95
|
-
"priority":
|
|
129
|
+
"due_date": due_date,
|
|
130
|
+
"priority": priority,
|
|
131
|
+
"confidence": confidence
|
|
96
132
|
}
|
|
97
133
|
|
|
98
134
|
tasks.append(task)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mail2task
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Extract actionable tasks from emails using Python
|
|
5
5
|
Author: Eby J Kavungal
|
|
6
6
|
Project-URL: Homepage, https://github.com/EbyJK/mail2task
|
|
@@ -77,11 +77,25 @@ Output:
|
|
|
77
77
|
{
|
|
78
78
|
"title": "submit the report by Friday.",
|
|
79
79
|
"due_date": "2026-05-29T00:00:00",
|
|
80
|
-
"priority": "normal"
|
|
80
|
+
"priority": "normal",
|
|
81
|
+
"confidence": 0.9
|
|
82
|
+
|
|
81
83
|
}
|
|
82
84
|
]
|
|
83
85
|
```
|
|
84
86
|
|
|
87
|
+
### Pretty Output
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
mail2task sample_email.txt --pretty
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Save Output
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
mail2task sample_email.txt --output tasks.json
|
|
97
|
+
```
|
|
98
|
+
|
|
85
99
|
---
|
|
86
100
|
|
|
87
101
|
## Example Use Cases
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import json
|
|
3
|
-
from .extractor import extract_tasks
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def main():
|
|
7
|
-
if len(sys.argv) < 2:
|
|
8
|
-
print("Usage: mail2task <file>")
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
file_path = sys.argv[1]
|
|
12
|
-
|
|
13
|
-
try:
|
|
14
|
-
with open(file_path, "r", encoding="utf-8") as f:
|
|
15
|
-
content = f.read()
|
|
16
|
-
|
|
17
|
-
tasks = extract_tasks(content)
|
|
18
|
-
|
|
19
|
-
print(json.dumps(tasks, indent=2))
|
|
20
|
-
|
|
21
|
-
except FileNotFoundError:
|
|
22
|
-
print(f"File not found: {file_path}")
|
|
23
|
-
|
|
24
|
-
except Exception as e:
|
|
25
|
-
print(f"Error: {e}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|