mail2task 0.4.0__tar.gz → 0.5.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.4.0 → mail2task-0.5.0}/PKG-INFO +8 -1
- {mail2task-0.4.0 → mail2task-0.5.0}/README.md +7 -0
- {mail2task-0.4.0 → mail2task-0.5.0}/pyproject.toml +1 -1
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task/extractor.py +46 -16
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task.egg-info/PKG-INFO +8 -1
- {mail2task-0.4.0 → mail2task-0.5.0}/setup.cfg +0 -0
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task/__init__.py +0 -0
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task/cli.py +0 -0
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task/parser.py +0 -0
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task.egg-info/SOURCES.txt +0 -0
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task.egg-info/dependency_links.txt +0 -0
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task.egg-info/entry_points.txt +0 -0
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task.egg-info/requires.txt +0 -0
- {mail2task-0.4.0 → mail2task-0.5.0}/src/mail2task.egg-info/top_level.txt +0 -0
- {mail2task-0.4.0 → mail2task-0.5.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.5.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
|
|
@@ -126,6 +126,13 @@ mail2task sample_email.txt --format markdown
|
|
|
126
126
|
- Task management systems
|
|
127
127
|
|
|
128
128
|
---
|
|
129
|
+
## NLP Features
|
|
130
|
+
|
|
131
|
+
- Sentence splitting
|
|
132
|
+
- Greeting/signature filtering
|
|
133
|
+
- Due date extraction
|
|
134
|
+
- Priority detection
|
|
135
|
+
- Confidence scoring
|
|
129
136
|
|
|
130
137
|
## Project Structure
|
|
131
138
|
|
|
@@ -111,6 +111,13 @@ mail2task sample_email.txt --format markdown
|
|
|
111
111
|
- Task management systems
|
|
112
112
|
|
|
113
113
|
---
|
|
114
|
+
## NLP Features
|
|
115
|
+
|
|
116
|
+
- Sentence splitting
|
|
117
|
+
- Greeting/signature filtering
|
|
118
|
+
- Due date extraction
|
|
119
|
+
- Priority detection
|
|
120
|
+
- Confidence scoring
|
|
114
121
|
|
|
115
122
|
## Project Structure
|
|
116
123
|
|
|
@@ -15,7 +15,10 @@ ACTION_WORDS = [
|
|
|
15
15
|
"email",
|
|
16
16
|
"organize",
|
|
17
17
|
"create",
|
|
18
|
-
"fix"
|
|
18
|
+
"fix",
|
|
19
|
+
"approve",
|
|
20
|
+
"confirm",
|
|
21
|
+
"deliver"
|
|
19
22
|
]
|
|
20
23
|
|
|
21
24
|
|
|
@@ -26,8 +29,30 @@ PRIORITY_KEYWORDS = {
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
|
|
32
|
+
IGNORE_PATTERNS = [
|
|
33
|
+
r"^hi\b",
|
|
34
|
+
r"^hello\b",
|
|
35
|
+
r"^thanks\b",
|
|
36
|
+
r"^thank you\b",
|
|
37
|
+
r"^regards\b",
|
|
38
|
+
r"^best\b",
|
|
39
|
+
r"^sincerely\b"
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
|
|
29
43
|
def clean_text(text: str):
|
|
30
|
-
|
|
44
|
+
text = re.sub(r"\s+", " ", text)
|
|
45
|
+
return text.strip()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def should_ignore(text: str):
|
|
49
|
+
text_lower = text.lower()
|
|
50
|
+
|
|
51
|
+
for pattern in IGNORE_PATTERNS:
|
|
52
|
+
if re.search(pattern, text_lower):
|
|
53
|
+
return True
|
|
54
|
+
|
|
55
|
+
return False
|
|
31
56
|
|
|
32
57
|
|
|
33
58
|
def detect_priority(text: str):
|
|
@@ -64,19 +89,15 @@ def calculate_confidence(text: str, due_date, priority):
|
|
|
64
89
|
|
|
65
90
|
text_lower = text.lower()
|
|
66
91
|
|
|
67
|
-
# Action word boost
|
|
68
92
|
if any(word in text_lower for word in ACTION_WORDS):
|
|
69
93
|
score += 0.25
|
|
70
94
|
|
|
71
|
-
# Due date boost
|
|
72
95
|
if due_date:
|
|
73
96
|
score += 0.2
|
|
74
97
|
|
|
75
|
-
# Priority boost
|
|
76
98
|
if priority != "normal":
|
|
77
99
|
score += 0.1
|
|
78
100
|
|
|
79
|
-
# Sentence length quality
|
|
80
101
|
word_count = len(text.split())
|
|
81
102
|
|
|
82
103
|
if 4 <= word_count <= 20:
|
|
@@ -85,28 +106,37 @@ def calculate_confidence(text: str, due_date, priority):
|
|
|
85
106
|
return round(min(score, 0.99), 2)
|
|
86
107
|
|
|
87
108
|
|
|
109
|
+
def split_sentences(email_text: str):
|
|
110
|
+
sentences = re.split(r"[.\n]+", email_text)
|
|
111
|
+
|
|
112
|
+
return [
|
|
113
|
+
clean_text(sentence)
|
|
114
|
+
for sentence in sentences
|
|
115
|
+
if clean_text(sentence)
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
|
|
88
119
|
def extract_tasks(email_text: str):
|
|
89
|
-
|
|
120
|
+
sentences = split_sentences(email_text)
|
|
90
121
|
|
|
91
122
|
tasks = []
|
|
92
123
|
seen_titles = set()
|
|
93
124
|
|
|
94
|
-
for
|
|
95
|
-
line = clean_text(line)
|
|
125
|
+
for sentence in sentences:
|
|
96
126
|
|
|
97
|
-
if
|
|
127
|
+
if should_ignore(sentence):
|
|
98
128
|
continue
|
|
99
129
|
|
|
100
|
-
if len(
|
|
130
|
+
if len(sentence.split()) < 3:
|
|
101
131
|
continue
|
|
102
132
|
|
|
103
|
-
if not is_task_sentence(
|
|
133
|
+
if not is_task_sentence(sentence):
|
|
104
134
|
continue
|
|
105
135
|
|
|
106
136
|
title = re.sub(
|
|
107
137
|
r"\b(please|kindly)\b",
|
|
108
138
|
"",
|
|
109
|
-
|
|
139
|
+
sentence,
|
|
110
140
|
flags=re.IGNORECASE
|
|
111
141
|
).strip()
|
|
112
142
|
|
|
@@ -115,11 +145,11 @@ def extract_tasks(email_text: str):
|
|
|
115
145
|
|
|
116
146
|
seen_titles.add(title.lower())
|
|
117
147
|
|
|
118
|
-
due_date = extract_due_date(
|
|
119
|
-
priority = detect_priority(
|
|
148
|
+
due_date = extract_due_date(sentence)
|
|
149
|
+
priority = detect_priority(sentence)
|
|
120
150
|
|
|
121
151
|
confidence = calculate_confidence(
|
|
122
|
-
|
|
152
|
+
sentence,
|
|
123
153
|
due_date,
|
|
124
154
|
priority
|
|
125
155
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mail2task
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.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
|
|
@@ -126,6 +126,13 @@ mail2task sample_email.txt --format markdown
|
|
|
126
126
|
- Task management systems
|
|
127
127
|
|
|
128
128
|
---
|
|
129
|
+
## NLP Features
|
|
130
|
+
|
|
131
|
+
- Sentence splitting
|
|
132
|
+
- Greeting/signature filtering
|
|
133
|
+
- Due date extraction
|
|
134
|
+
- Priority detection
|
|
135
|
+
- Confidence scoring
|
|
129
136
|
|
|
130
137
|
## Project Structure
|
|
131
138
|
|
|
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
|
|
File without changes
|