mail2task 0.2.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mail2task
3
- Version: 0.2.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,7 +77,9 @@ 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
  ```
@@ -62,7 +62,9 @@ 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
  ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mail2task"
7
- version = "0.2.0"
7
+ version = "0.3.0"
8
8
  description = "Extract actionable tasks from emails using Python"
9
9
  authors = [
10
10
  { name="Eby J Kavungal" }
@@ -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": extract_due_date(line),
95
- "priority": detect_priority(line)
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.2.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,7 +77,9 @@ 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
  ```
File without changes