acuity-framework 2.0.2__tar.gz → 2.0.3__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.
Files changed (37) hide show
  1. {acuity_framework-2.0.2/acuity_framework.egg-info → acuity_framework-2.0.3}/PKG-INFO +255 -255
  2. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/extraction/rules.py +5 -5
  3. {acuity_framework-2.0.2 → acuity_framework-2.0.3/acuity_framework.egg-info}/PKG-INFO +255 -255
  4. acuity_framework-2.0.3/acuity_framework.egg-info/top_level.txt +1 -0
  5. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/pyproject.toml +1 -1
  6. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/setup.cfg +4 -4
  7. acuity_framework-2.0.3/setup.py +100 -0
  8. acuity_framework-2.0.2/acuity_framework.egg-info/top_level.txt +0 -2
  9. acuity_framework-2.0.2/setup.py +0 -116
  10. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/LICENSE +0 -0
  11. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/README.md +0 -0
  12. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/__init__.py +0 -0
  13. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/config.py +0 -0
  14. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/extraction/__init__.py +0 -0
  15. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/extraction/ner_crf.py +0 -0
  16. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/extraction/ner_transformer.py +0 -0
  17. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/extraction/pipeline.py +0 -0
  18. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/extraction/postprocessing.py +0 -0
  19. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/extraction/preprocessing.py +0 -0
  20. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/recommendation/__init__.py +0 -0
  21. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/recommendation/engine.py +0 -0
  22. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/recommendation/proximity.py +0 -0
  23. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/recommendation/ranker.py +0 -0
  24. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/recommendation/similarity.py +0 -0
  25. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/recommendation/vectorizer.py +0 -0
  26. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/scraper/__init__.py +0 -0
  27. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/scraper/scraper.py +0 -0
  28. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/scraper/utils.py +0 -0
  29. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/utils.py +0 -0
  30. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/verification/__init__.py +0 -0
  31. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity/verification/bplo.py +0 -0
  32. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity_framework.egg-info/SOURCES.txt +0 -0
  33. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity_framework.egg-info/dependency_links.txt +0 -0
  34. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/acuity_framework.egg-info/requires.txt +0 -0
  35. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/tests/test_extraction.py +0 -0
  36. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/tests/test_recommendation.py +0 -0
  37. {acuity_framework-2.0.2 → acuity_framework-2.0.3}/tests/test_verification.py +0 -0
@@ -1,255 +1,255 @@
1
- Metadata-Version: 2.4
2
- Name: acuity-framework
3
- Version: 2.0.2
4
- Summary: ACUITY — A machine learning framework for extracting, verifying, and recommending local micro-enterprise profiles from unstructured community posts.
5
- Author: ACUITY Research Team
6
- License: MIT
7
- Project-URL: Repository, https://github.com/acuity-framework/acuity-framework
8
- Project-URL: Documentation, https://github.com/acuity-framework/acuity-framework#readme
9
- Keywords: nlp,ner,recommendation-engine,tfidf,cosine-similarity,business-extraction,community-posts,micro-enterprise
10
- Classifier: Development Status :: 4 - Beta
11
- Classifier: Intended Audience :: Developers
12
- Classifier: Intended Audience :: Science/Research
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
- Classifier: Topic :: Text Processing :: Linguistic
20
- Requires-Python: >=3.10
21
- Description-Content-Type: text/markdown
22
- License-File: LICENSE
23
- Provides-Extra: nlp
24
- Requires-Dist: nltk>=3.8.1; extra == "nlp"
25
- Provides-Extra: transformers
26
- Requires-Dist: transformers>=4.35.0; extra == "transformers"
27
- Requires-Dist: torch>=2.1.0; extra == "transformers"
28
- Requires-Dist: nltk>=3.8.1; extra == "transformers"
29
- Provides-Extra: scraper
30
- Requires-Dist: undetected-chromedriver>=3.5.0; extra == "scraper"
31
- Requires-Dist: selenium>=4.15.0; extra == "scraper"
32
- Requires-Dist: python-dotenv>=1.0.0; extra == "scraper"
33
- Provides-Extra: all
34
- Requires-Dist: nltk>=3.8.1; extra == "all"
35
- Requires-Dist: transformers>=4.35.0; extra == "all"
36
- Requires-Dist: torch>=2.1.0; extra == "all"
37
- Requires-Dist: undetected-chromedriver>=3.5.0; extra == "all"
38
- Requires-Dist: selenium>=4.15.0; extra == "all"
39
- Requires-Dist: python-dotenv>=1.0.0; extra == "all"
40
- Provides-Extra: dev
41
- Requires-Dist: pytest>=7.4.0; extra == "dev"
42
- Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
43
- Dynamic: license-file
44
-
45
- # ACUITY Framework
46
-
47
- **A**utomated **C**ommunity **U**nstructured **I**nformation to **T**argeted visibilit**Y**
48
-
49
- A Python machine learning framework for extracting, verifying, and recommending local micro-enterprise profiles from unstructured community posts (e.g., Facebook groups, forums).
50
-
51
- ---
52
-
53
- ## 🚀 Installation
54
-
55
- ```bash
56
- # Core framework (no heavy dependencies)
57
- pip install acuity-framework
58
-
59
- # With NLP support (nltk for CRF-based NER)
60
- pip install acuity-framework[nlp]
61
-
62
- # With Transformer NER (requires PyTorch)
63
- pip install acuity-framework[transformers]
64
-
65
- # With Facebook scraper
66
- pip install acuity-framework[scraper]
67
-
68
- # Everything
69
- pip install acuity-framework[all]
70
- ```
71
-
72
- ### Local Development Install
73
-
74
- ```bash
75
- git clone https://github.com/acuity-framework/acuity-framework.git
76
- cd acuity-framework
77
- pip install -e ".[dev]"
78
- ```
79
-
80
- ---
81
-
82
- ## 📦 Modules
83
-
84
- | Module | Description |
85
- |--------|-------------|
86
- | `acuity.extraction` | NLP pipeline: preprocessing → NER → rule-based extraction → profile construction |
87
- | `acuity.recommendation` | TF-IDF + cosine similarity + Haversine proximity ranking |
88
- | `acuity.verification` | Business legitimacy verification via fuzzy matching (Levenshtein) |
89
- | `acuity.scraper` | Facebook community group post scraper (optional) |
90
-
91
- ---
92
-
93
- ## 🔧 Quick Start
94
-
95
- ### 1. Extract Business Profiles from Text
96
-
97
- ```python
98
- from acuity.extraction import ExtractionPipeline
99
-
100
- pipeline = ExtractionPipeline()
101
- profiles = pipeline.extract_from_texts([
102
- "Mang Juan's Bakery sa Mamatid, open 8am-5pm, 0917-123-4567, pandesal ₱5",
103
- "JC Auto Repair, vulcanizing, Brgy Banay-Banay, 0918-987-6543",
104
- ])
105
-
106
- for p in profiles:
107
- print(f"{p['business_name']}: {p['phones']}, {p['hours']}")
108
- ```
109
-
110
- ### 2. Verify Against a Government Registry
111
-
112
- ```python
113
- from acuity.verification import BPLOVerifier
114
-
115
- verifier = BPLOVerifier()
116
- verifier.load_registry_from_list([
117
- {"name": "Juan's Bakeshop", "address": "Mamatid"},
118
- {"name": "JC Automotive Repair", "address": "Banay-Banay"},
119
- ])
120
-
121
- result = verifier.verify("Mang Juan's Bakery")
122
- print(f"Status: {result['status']}, Score: {result['score']}")
123
- # Output: Status: Pending Verification, Score: 0.65
124
- ```
125
-
126
- ### 3. Recommend Businesses
127
-
128
- ```python
129
- from acuity.recommendation import RecommendationEngine
130
-
131
- engine = RecommendationEngine()
132
- engine.set_profiles([
133
- {"name": "Juan's Bakery", "description": "Fresh bread daily", "latitude": 14.27, "longitude": 121.12},
134
- {"name": "Auto Repair", "description": "Vulcanizing and oil change", "latitude": 14.26, "longitude": 121.11},
135
- ])
136
-
137
- results = engine.recommend("bakery bread", user_lat=14.27, user_lon=121.12)
138
- for r in results:
139
- print(f"{r['name']}: score={r['final_score']}, dist={r['distance_km']}km")
140
- ```
141
-
142
- ---
143
-
144
- ## ⚙️ Configuration
145
-
146
- All settings are controlled via the `AcuityConfig` dataclass:
147
-
148
- ```python
149
- from acuity.config import AcuityConfig
150
-
151
- config = AcuityConfig(
152
- # NER settings
153
- ner_backend="crf", # "crf" or "transformer"
154
- ner_model_path="./models/crf.pkl", # Path to your trained model
155
-
156
- # Recommendation weights
157
- relevance_weight=0.6,
158
- proximity_weight=0.4,
159
- default_top_k=10,
160
-
161
- # Verification thresholds
162
- fuzzy_match_threshold_verified=0.8,
163
- fuzzy_match_threshold_pending=0.6,
164
- )
165
- ```
166
-
167
- ---
168
-
169
- ## 🌐 Integrating with Your Web Application
170
-
171
- ACUITY is framework-agnostic. Here's how to use it with Flask:
172
-
173
- ```python
174
- from flask import Flask, request, jsonify
175
- from acuity.recommendation import RecommendationEngine
176
-
177
- app = Flask(__name__)
178
- engine = RecommendationEngine()
179
-
180
- @app.route("/api/recommend")
181
- def recommend():
182
- query = request.args.get("q", "")
183
- results = engine.recommend(query)
184
- return jsonify(results)
185
- ```
186
-
187
- See [`examples/flask_integration.py`](examples/flask_integration.py) for a complete working example.
188
-
189
- ---
190
-
191
- ## 🧪 Running Tests
192
-
193
- ```bash
194
- pip install -e ".[dev]"
195
- pytest tests/ -v
196
- ```
197
-
198
- ---
199
-
200
- ## 📁 Project Structure
201
-
202
- ```
203
- acuity-framework/
204
- ├── pyproject.toml # Package configuration
205
- ├── README.md
206
- ├── LICENSE
207
- ├── acuity/
208
- │ ├── __init__.py # Public API
209
- │ ├── config.py # AcuityConfig dataclass
210
- │ ├── utils.py # Levenshtein similarity utilities
211
- │ ├── extraction/ # NLP extraction pipeline
212
- │ │ ├── pipeline.py # ExtractionPipeline class
213
- │ │ ├── preprocessing.py
214
- │ │ ├── ner_crf.py
215
- │ │ ├── ner_transformer.py
216
- │ │ ├── rules.py
217
- │ │ └── postprocessing.py
218
- │ ├── recommendation/ # Recommendation engine
219
- │ │ ├── engine.py # RecommendationEngine class
220
- │ │ ├── vectorizer.py # TF-IDF vectorizer
221
- │ │ ├── similarity.py # Cosine similarity
222
- │ │ ├── proximity.py # Haversine distance
223
- │ │ └── ranker.py # Combined ranking
224
- │ ├── verification/ # Business verification
225
- │ │ └── bplo.py # BPLOVerifier class
226
- │ └── scraper/ # Facebook scraper (optional)
227
- │ ├── scraper.py # FacebookScraper class
228
- │ └── utils.py
229
- ├── examples/
230
- │ ├── basic_extraction.py
231
- │ ├── basic_recommendation.py
232
- │ └── flask_integration.py
233
- └── tests/
234
- ├── test_extraction.py
235
- ├── test_recommendation.py
236
- └── test_verification.py
237
- ```
238
-
239
- ---
240
-
241
- ## 📄 License
242
-
243
- MIT License — see [LICENSE](LICENSE) for details.
244
-
245
- ---
246
-
247
- ## 🎓 Academic Reference
248
-
249
- This framework was developed as part of an academic thesis at the College of Computing Studies. The core algorithms implement:
250
-
251
- - **TF-IDF Vectorization** with log-normalised term frequency and inverse document frequency
252
- - **Cosine Similarity** for textual relevance scoring
253
- - **Haversine Formula** for geographic proximity computation
254
- - **CRF (Conditional Random Field)** for Named Entity Recognition with BIO tagging
255
- - **Levenshtein Distance** for fuzzy string matching in business verification
1
+ Metadata-Version: 2.4
2
+ Name: acuity-framework
3
+ Version: 2.0.3
4
+ Summary: ACUITY — A machine learning framework for extracting, verifying, and recommending local micro-enterprise profiles from unstructured community posts.
5
+ Author: ACUITY Research Team
6
+ License: MIT
7
+ Project-URL: Repository, https://github.com/acuity-framework/acuity-framework
8
+ Project-URL: Documentation, https://github.com/acuity-framework/acuity-framework#readme
9
+ Keywords: nlp,ner,recommendation-engine,tfidf,cosine-similarity,business-extraction,community-posts,micro-enterprise
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Text Processing :: Linguistic
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Provides-Extra: nlp
24
+ Requires-Dist: nltk>=3.8.1; extra == "nlp"
25
+ Provides-Extra: transformers
26
+ Requires-Dist: transformers>=4.35.0; extra == "transformers"
27
+ Requires-Dist: torch>=2.1.0; extra == "transformers"
28
+ Requires-Dist: nltk>=3.8.1; extra == "transformers"
29
+ Provides-Extra: scraper
30
+ Requires-Dist: undetected-chromedriver>=3.5.0; extra == "scraper"
31
+ Requires-Dist: selenium>=4.15.0; extra == "scraper"
32
+ Requires-Dist: python-dotenv>=1.0.0; extra == "scraper"
33
+ Provides-Extra: all
34
+ Requires-Dist: nltk>=3.8.1; extra == "all"
35
+ Requires-Dist: transformers>=4.35.0; extra == "all"
36
+ Requires-Dist: torch>=2.1.0; extra == "all"
37
+ Requires-Dist: undetected-chromedriver>=3.5.0; extra == "all"
38
+ Requires-Dist: selenium>=4.15.0; extra == "all"
39
+ Requires-Dist: python-dotenv>=1.0.0; extra == "all"
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
42
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
43
+ Dynamic: license-file
44
+
45
+ # ACUITY Framework
46
+
47
+ **A**utomated **C**ommunity **U**nstructured **I**nformation to **T**argeted visibilit**Y**
48
+
49
+ A Python machine learning framework for extracting, verifying, and recommending local micro-enterprise profiles from unstructured community posts (e.g., Facebook groups, forums).
50
+
51
+ ---
52
+
53
+ ## 🚀 Installation
54
+
55
+ ```bash
56
+ # Core framework (no heavy dependencies)
57
+ pip install acuity-framework
58
+
59
+ # With NLP support (nltk for CRF-based NER)
60
+ pip install acuity-framework[nlp]
61
+
62
+ # With Transformer NER (requires PyTorch)
63
+ pip install acuity-framework[transformers]
64
+
65
+ # With Facebook scraper
66
+ pip install acuity-framework[scraper]
67
+
68
+ # Everything
69
+ pip install acuity-framework[all]
70
+ ```
71
+
72
+ ### Local Development Install
73
+
74
+ ```bash
75
+ git clone https://github.com/acuity-framework/acuity-framework.git
76
+ cd acuity-framework
77
+ pip install -e ".[dev]"
78
+ ```
79
+
80
+ ---
81
+
82
+ ## 📦 Modules
83
+
84
+ | Module | Description |
85
+ |--------|-------------|
86
+ | `acuity.extraction` | NLP pipeline: preprocessing → NER → rule-based extraction → profile construction |
87
+ | `acuity.recommendation` | TF-IDF + cosine similarity + Haversine proximity ranking |
88
+ | `acuity.verification` | Business legitimacy verification via fuzzy matching (Levenshtein) |
89
+ | `acuity.scraper` | Facebook community group post scraper (optional) |
90
+
91
+ ---
92
+
93
+ ## 🔧 Quick Start
94
+
95
+ ### 1. Extract Business Profiles from Text
96
+
97
+ ```python
98
+ from acuity.extraction import ExtractionPipeline
99
+
100
+ pipeline = ExtractionPipeline()
101
+ profiles = pipeline.extract_from_texts([
102
+ "Mang Juan's Bakery sa Mamatid, open 8am-5pm, 0917-123-4567, pandesal ₱5",
103
+ "JC Auto Repair, vulcanizing, Brgy Banay-Banay, 0918-987-6543",
104
+ ])
105
+
106
+ for p in profiles:
107
+ print(f"{p['business_name']}: {p['phones']}, {p['hours']}")
108
+ ```
109
+
110
+ ### 2. Verify Against a Government Registry
111
+
112
+ ```python
113
+ from acuity.verification import BPLOVerifier
114
+
115
+ verifier = BPLOVerifier()
116
+ verifier.load_registry_from_list([
117
+ {"name": "Juan's Bakeshop", "address": "Mamatid"},
118
+ {"name": "JC Automotive Repair", "address": "Banay-Banay"},
119
+ ])
120
+
121
+ result = verifier.verify("Mang Juan's Bakery")
122
+ print(f"Status: {result['status']}, Score: {result['score']}")
123
+ # Output: Status: Pending Verification, Score: 0.65
124
+ ```
125
+
126
+ ### 3. Recommend Businesses
127
+
128
+ ```python
129
+ from acuity.recommendation import RecommendationEngine
130
+
131
+ engine = RecommendationEngine()
132
+ engine.set_profiles([
133
+ {"name": "Juan's Bakery", "description": "Fresh bread daily", "latitude": 14.27, "longitude": 121.12},
134
+ {"name": "Auto Repair", "description": "Vulcanizing and oil change", "latitude": 14.26, "longitude": 121.11},
135
+ ])
136
+
137
+ results = engine.recommend("bakery bread", user_lat=14.27, user_lon=121.12)
138
+ for r in results:
139
+ print(f"{r['name']}: score={r['final_score']}, dist={r['distance_km']}km")
140
+ ```
141
+
142
+ ---
143
+
144
+ ## ⚙️ Configuration
145
+
146
+ All settings are controlled via the `AcuityConfig` dataclass:
147
+
148
+ ```python
149
+ from acuity.config import AcuityConfig
150
+
151
+ config = AcuityConfig(
152
+ # NER settings
153
+ ner_backend="crf", # "crf" or "transformer"
154
+ ner_model_path="./models/crf.pkl", # Path to your trained model
155
+
156
+ # Recommendation weights
157
+ relevance_weight=0.6,
158
+ proximity_weight=0.4,
159
+ default_top_k=10,
160
+
161
+ # Verification thresholds
162
+ fuzzy_match_threshold_verified=0.8,
163
+ fuzzy_match_threshold_pending=0.6,
164
+ )
165
+ ```
166
+
167
+ ---
168
+
169
+ ## 🌐 Integrating with Your Web Application
170
+
171
+ ACUITY is framework-agnostic. Here's how to use it with Flask:
172
+
173
+ ```python
174
+ from flask import Flask, request, jsonify
175
+ from acuity.recommendation import RecommendationEngine
176
+
177
+ app = Flask(__name__)
178
+ engine = RecommendationEngine()
179
+
180
+ @app.route("/api/recommend")
181
+ def recommend():
182
+ query = request.args.get("q", "")
183
+ results = engine.recommend(query)
184
+ return jsonify(results)
185
+ ```
186
+
187
+ See [`examples/flask_integration.py`](examples/flask_integration.py) for a complete working example.
188
+
189
+ ---
190
+
191
+ ## 🧪 Running Tests
192
+
193
+ ```bash
194
+ pip install -e ".[dev]"
195
+ pytest tests/ -v
196
+ ```
197
+
198
+ ---
199
+
200
+ ## 📁 Project Structure
201
+
202
+ ```
203
+ acuity-framework/
204
+ ├── pyproject.toml # Package configuration
205
+ ├── README.md
206
+ ├── LICENSE
207
+ ├── acuity/
208
+ │ ├── __init__.py # Public API
209
+ │ ├── config.py # AcuityConfig dataclass
210
+ │ ├── utils.py # Levenshtein similarity utilities
211
+ │ ├── extraction/ # NLP extraction pipeline
212
+ │ │ ├── pipeline.py # ExtractionPipeline class
213
+ │ │ ├── preprocessing.py
214
+ │ │ ├── ner_crf.py
215
+ │ │ ├── ner_transformer.py
216
+ │ │ ├── rules.py
217
+ │ │ └── postprocessing.py
218
+ │ ├── recommendation/ # Recommendation engine
219
+ │ │ ├── engine.py # RecommendationEngine class
220
+ │ │ ├── vectorizer.py # TF-IDF vectorizer
221
+ │ │ ├── similarity.py # Cosine similarity
222
+ │ │ ├── proximity.py # Haversine distance
223
+ │ │ └── ranker.py # Combined ranking
224
+ │ ├── verification/ # Business verification
225
+ │ │ └── bplo.py # BPLOVerifier class
226
+ │ └── scraper/ # Facebook scraper (optional)
227
+ │ ├── scraper.py # FacebookScraper class
228
+ │ └── utils.py
229
+ ├── examples/
230
+ │ ├── basic_extraction.py
231
+ │ ├── basic_recommendation.py
232
+ │ └── flask_integration.py
233
+ └── tests/
234
+ ├── test_extraction.py
235
+ ├── test_recommendation.py
236
+ └── test_verification.py
237
+ ```
238
+
239
+ ---
240
+
241
+ ## 📄 License
242
+
243
+ MIT License — see [LICENSE](LICENSE) for details.
244
+
245
+ ---
246
+
247
+ ## 🎓 Academic Reference
248
+
249
+ This framework was developed as part of an academic thesis at the College of Computing Studies. The core algorithms implement:
250
+
251
+ - **TF-IDF Vectorization** with log-normalised term frequency and inverse document frequency
252
+ - **Cosine Similarity** for textual relevance scoring
253
+ - **Haversine Formula** for geographic proximity computation
254
+ - **CRF (Conditional Random Field)** for Named Entity Recognition with BIO tagging
255
+ - **Levenshtein Distance** for fuzzy string matching in business verification
@@ -25,9 +25,9 @@ PRICE_PATTERN = re.compile(
25
25
  r"(?:[₱Pp](?:HP)?)\s?\d[\d,]*(?:\.\d{2})?"
26
26
  )
27
27
 
28
- # Operating hours heuristic (e.g. "open 8am-5pm", "available 24/7")
28
+ # Operating hours specific pattern (e.g. 7AM - 7PM, 7:00 am to 5:00 pm)
29
29
  HOURS_PATTERN = re.compile(
30
- r"\b(?:open|available|hours?)\b.*?\d{1,2}\s?(?:am|pm|AM|PM)",
30
+ r"\b\d{1,2}(?::\d{2})?(?:\s?[ap]\.?m\.?)?\s*(?:to|-)\s*\d{1,2}(?::\d{2})?\s?[ap]\.?m\.?\b",
31
31
  re.IGNORECASE,
32
32
  )
33
33
 
@@ -43,7 +43,7 @@ def extract_structured_fields(text: str) -> dict:
43
43
  Each value is a list of matched strings.
44
44
  """
45
45
  return {
46
- "phones": PHONE_PATTERN.findall(text),
47
- "prices": PRICE_PATTERN.findall(text),
48
- "hours": HOURS_PATTERN.findall(text),
46
+ "phones": list(dict.fromkeys(PHONE_PATTERN.findall(text))),
47
+ "prices": list(dict.fromkeys(PRICE_PATTERN.findall(text))),
48
+ "hours": list(dict.fromkeys(HOURS_PATTERN.findall(text))),
49
49
  }