acuity-framework 1.0.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.
Files changed (34) hide show
  1. acuity_framework-1.0.0/LICENSE +21 -0
  2. acuity_framework-1.0.0/PKG-INFO +255 -0
  3. acuity_framework-1.0.0/README.md +211 -0
  4. acuity_framework-1.0.0/acuity/__init__.py +27 -0
  5. acuity_framework-1.0.0/acuity/config.py +47 -0
  6. acuity_framework-1.0.0/acuity/extraction/__init__.py +22 -0
  7. acuity_framework-1.0.0/acuity/extraction/ner_crf.py +164 -0
  8. acuity_framework-1.0.0/acuity/extraction/ner_transformer.py +76 -0
  9. acuity_framework-1.0.0/acuity/extraction/pipeline.py +171 -0
  10. acuity_framework-1.0.0/acuity/extraction/postprocessing.py +74 -0
  11. acuity_framework-1.0.0/acuity/extraction/preprocessing.py +57 -0
  12. acuity_framework-1.0.0/acuity/extraction/rules.py +49 -0
  13. acuity_framework-1.0.0/acuity/recommendation/__init__.py +16 -0
  14. acuity_framework-1.0.0/acuity/recommendation/engine.py +138 -0
  15. acuity_framework-1.0.0/acuity/recommendation/proximity.py +35 -0
  16. acuity_framework-1.0.0/acuity/recommendation/ranker.py +61 -0
  17. acuity_framework-1.0.0/acuity/recommendation/similarity.py +48 -0
  18. acuity_framework-1.0.0/acuity/recommendation/vectorizer.py +174 -0
  19. acuity_framework-1.0.0/acuity/scraper/__init__.py +16 -0
  20. acuity_framework-1.0.0/acuity/scraper/scraper.py +376 -0
  21. acuity_framework-1.0.0/acuity/scraper/utils.py +62 -0
  22. acuity_framework-1.0.0/acuity/utils.py +84 -0
  23. acuity_framework-1.0.0/acuity/verification/__init__.py +16 -0
  24. acuity_framework-1.0.0/acuity/verification/bplo.py +134 -0
  25. acuity_framework-1.0.0/acuity_framework.egg-info/PKG-INFO +255 -0
  26. acuity_framework-1.0.0/acuity_framework.egg-info/SOURCES.txt +32 -0
  27. acuity_framework-1.0.0/acuity_framework.egg-info/dependency_links.txt +1 -0
  28. acuity_framework-1.0.0/acuity_framework.egg-info/requires.txt +25 -0
  29. acuity_framework-1.0.0/acuity_framework.egg-info/top_level.txt +2 -0
  30. acuity_framework-1.0.0/pyproject.toml +82 -0
  31. acuity_framework-1.0.0/setup.cfg +4 -0
  32. acuity_framework-1.0.0/tests/test_extraction.py +150 -0
  33. acuity_framework-1.0.0/tests/test_recommendation.py +143 -0
  34. acuity_framework-1.0.0/tests/test_verification.py +106 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ACUITY Research Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,255 @@
1
+ Metadata-Version: 2.4
2
+ Name: acuity-framework
3
+ Version: 1.0.0
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
@@ -0,0 +1,211 @@
1
+ # ACUITY Framework
2
+
3
+ **A**utomated **C**ommunity **U**nstructured **I**nformation to **T**argeted visibilit**Y**
4
+
5
+ A Python machine learning framework for extracting, verifying, and recommending local micro-enterprise profiles from unstructured community posts (e.g., Facebook groups, forums).
6
+
7
+ ---
8
+
9
+ ## 🚀 Installation
10
+
11
+ ```bash
12
+ # Core framework (no heavy dependencies)
13
+ pip install acuity-framework
14
+
15
+ # With NLP support (nltk for CRF-based NER)
16
+ pip install acuity-framework[nlp]
17
+
18
+ # With Transformer NER (requires PyTorch)
19
+ pip install acuity-framework[transformers]
20
+
21
+ # With Facebook scraper
22
+ pip install acuity-framework[scraper]
23
+
24
+ # Everything
25
+ pip install acuity-framework[all]
26
+ ```
27
+
28
+ ### Local Development Install
29
+
30
+ ```bash
31
+ git clone https://github.com/acuity-framework/acuity-framework.git
32
+ cd acuity-framework
33
+ pip install -e ".[dev]"
34
+ ```
35
+
36
+ ---
37
+
38
+ ## 📦 Modules
39
+
40
+ | Module | Description |
41
+ |--------|-------------|
42
+ | `acuity.extraction` | NLP pipeline: preprocessing → NER → rule-based extraction → profile construction |
43
+ | `acuity.recommendation` | TF-IDF + cosine similarity + Haversine proximity ranking |
44
+ | `acuity.verification` | Business legitimacy verification via fuzzy matching (Levenshtein) |
45
+ | `acuity.scraper` | Facebook community group post scraper (optional) |
46
+
47
+ ---
48
+
49
+ ## 🔧 Quick Start
50
+
51
+ ### 1. Extract Business Profiles from Text
52
+
53
+ ```python
54
+ from acuity.extraction import ExtractionPipeline
55
+
56
+ pipeline = ExtractionPipeline()
57
+ profiles = pipeline.extract_from_texts([
58
+ "Mang Juan's Bakery sa Mamatid, open 8am-5pm, 0917-123-4567, pandesal ₱5",
59
+ "JC Auto Repair, vulcanizing, Brgy Banay-Banay, 0918-987-6543",
60
+ ])
61
+
62
+ for p in profiles:
63
+ print(f"{p['business_name']}: {p['phones']}, {p['hours']}")
64
+ ```
65
+
66
+ ### 2. Verify Against a Government Registry
67
+
68
+ ```python
69
+ from acuity.verification import BPLOVerifier
70
+
71
+ verifier = BPLOVerifier()
72
+ verifier.load_registry_from_list([
73
+ {"name": "Juan's Bakeshop", "address": "Mamatid"},
74
+ {"name": "JC Automotive Repair", "address": "Banay-Banay"},
75
+ ])
76
+
77
+ result = verifier.verify("Mang Juan's Bakery")
78
+ print(f"Status: {result['status']}, Score: {result['score']}")
79
+ # Output: Status: Pending Verification, Score: 0.65
80
+ ```
81
+
82
+ ### 3. Recommend Businesses
83
+
84
+ ```python
85
+ from acuity.recommendation import RecommendationEngine
86
+
87
+ engine = RecommendationEngine()
88
+ engine.set_profiles([
89
+ {"name": "Juan's Bakery", "description": "Fresh bread daily", "latitude": 14.27, "longitude": 121.12},
90
+ {"name": "Auto Repair", "description": "Vulcanizing and oil change", "latitude": 14.26, "longitude": 121.11},
91
+ ])
92
+
93
+ results = engine.recommend("bakery bread", user_lat=14.27, user_lon=121.12)
94
+ for r in results:
95
+ print(f"{r['name']}: score={r['final_score']}, dist={r['distance_km']}km")
96
+ ```
97
+
98
+ ---
99
+
100
+ ## ⚙️ Configuration
101
+
102
+ All settings are controlled via the `AcuityConfig` dataclass:
103
+
104
+ ```python
105
+ from acuity.config import AcuityConfig
106
+
107
+ config = AcuityConfig(
108
+ # NER settings
109
+ ner_backend="crf", # "crf" or "transformer"
110
+ ner_model_path="./models/crf.pkl", # Path to your trained model
111
+
112
+ # Recommendation weights
113
+ relevance_weight=0.6,
114
+ proximity_weight=0.4,
115
+ default_top_k=10,
116
+
117
+ # Verification thresholds
118
+ fuzzy_match_threshold_verified=0.8,
119
+ fuzzy_match_threshold_pending=0.6,
120
+ )
121
+ ```
122
+
123
+ ---
124
+
125
+ ## 🌐 Integrating with Your Web Application
126
+
127
+ ACUITY is framework-agnostic. Here's how to use it with Flask:
128
+
129
+ ```python
130
+ from flask import Flask, request, jsonify
131
+ from acuity.recommendation import RecommendationEngine
132
+
133
+ app = Flask(__name__)
134
+ engine = RecommendationEngine()
135
+
136
+ @app.route("/api/recommend")
137
+ def recommend():
138
+ query = request.args.get("q", "")
139
+ results = engine.recommend(query)
140
+ return jsonify(results)
141
+ ```
142
+
143
+ See [`examples/flask_integration.py`](examples/flask_integration.py) for a complete working example.
144
+
145
+ ---
146
+
147
+ ## 🧪 Running Tests
148
+
149
+ ```bash
150
+ pip install -e ".[dev]"
151
+ pytest tests/ -v
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 📁 Project Structure
157
+
158
+ ```
159
+ acuity-framework/
160
+ ├── pyproject.toml # Package configuration
161
+ ├── README.md
162
+ ├── LICENSE
163
+ ├── acuity/
164
+ │ ├── __init__.py # Public API
165
+ │ ├── config.py # AcuityConfig dataclass
166
+ │ ├── utils.py # Levenshtein similarity utilities
167
+ │ ├── extraction/ # NLP extraction pipeline
168
+ │ │ ├── pipeline.py # ExtractionPipeline class
169
+ │ │ ├── preprocessing.py
170
+ │ │ ├── ner_crf.py
171
+ │ │ ├── ner_transformer.py
172
+ │ │ ├── rules.py
173
+ │ │ └── postprocessing.py
174
+ │ ├── recommendation/ # Recommendation engine
175
+ │ │ ├── engine.py # RecommendationEngine class
176
+ │ │ ├── vectorizer.py # TF-IDF vectorizer
177
+ │ │ ├── similarity.py # Cosine similarity
178
+ │ │ ├── proximity.py # Haversine distance
179
+ │ │ └── ranker.py # Combined ranking
180
+ │ ├── verification/ # Business verification
181
+ │ │ └── bplo.py # BPLOVerifier class
182
+ │ └── scraper/ # Facebook scraper (optional)
183
+ │ ├── scraper.py # FacebookScraper class
184
+ │ └── utils.py
185
+ ├── examples/
186
+ │ ├── basic_extraction.py
187
+ │ ├── basic_recommendation.py
188
+ │ └── flask_integration.py
189
+ └── tests/
190
+ ├── test_extraction.py
191
+ ├── test_recommendation.py
192
+ └── test_verification.py
193
+ ```
194
+
195
+ ---
196
+
197
+ ## 📄 License
198
+
199
+ MIT License — see [LICENSE](LICENSE) for details.
200
+
201
+ ---
202
+
203
+ ## 🎓 Academic Reference
204
+
205
+ This framework was developed as part of an academic thesis at the College of Computing Studies. The core algorithms implement:
206
+
207
+ - **TF-IDF Vectorization** with log-normalised term frequency and inverse document frequency
208
+ - **Cosine Similarity** for textual relevance scoring
209
+ - **Haversine Formula** for geographic proximity computation
210
+ - **CRF (Conditional Random Field)** for Named Entity Recognition with BIO tagging
211
+ - **Levenshtein Distance** for fuzzy string matching in business verification
@@ -0,0 +1,27 @@
1
+ """
2
+ ACUITY Framework
3
+ ================
4
+
5
+ **A**utomated **C**ommunity **U**nstructured **I**nformation to **T**argeted visibilit**Y**
6
+
7
+ A machine learning framework for extracting, verifying, and recommending
8
+ local micro-enterprise profiles from unstructured community posts.
9
+
10
+ Modules:
11
+ - acuity.extraction: NLP pipeline (preprocessing → NER → rule-based → profile building)
12
+ - acuity.recommendation: TF-IDF + cosine similarity + Haversine proximity ranking
13
+ - acuity.verification: Business legitimacy verification via fuzzy matching against registries
14
+ - acuity.scraper: Facebook community group post scraper (optional)
15
+
16
+ Quick Start:
17
+ >>> from acuity.extraction import ExtractionPipeline
18
+ >>> from acuity.recommendation import RecommendationEngine
19
+ >>> from acuity.verification import BPLOVerifier
20
+ """
21
+
22
+ __version__ = "1.0.0"
23
+ __author__ = "ACUITY Research Team"
24
+
25
+ from .config import AcuityConfig
26
+
27
+ __all__ = ["AcuityConfig"]
@@ -0,0 +1,47 @@
1
+ """
2
+ ACUITY Framework Configuration
3
+
4
+ Provides a centralized dataclass for all configurable parameters.
5
+ No hardcoded paths — users supply their own paths and thresholds.
6
+ """
7
+ from dataclasses import dataclass
8
+
9
+
10
+ @dataclass
11
+ class AcuityConfig:
12
+ """Configuration for the ACUITY framework.
13
+
14
+ All paths default to None, requiring the user to set them
15
+ based on their own project structure.
16
+
17
+ Attributes:
18
+ ner_model_path: Path to a trained NER model (CRF .pkl or HuggingFace directory).
19
+ ner_backend: Which NER backend to use: ``"crf"`` or ``"transformer"``.
20
+ completeness_threshold: Minimum number of populated detail fields
21
+ for a profile to be considered complete enough to keep.
22
+ relevance_weight: Weight for textual relevance in recommendation ranking [0, 1].
23
+ proximity_weight: Weight for geographic proximity in recommendation ranking [0, 1].
24
+ default_top_k: Default number of results returned by the recommendation engine.
25
+ fuzzy_match_threshold_verified: Levenshtein ratio threshold (0–1) to mark
26
+ a business as "Verified" against a BPLO registry.
27
+ fuzzy_match_threshold_pending: Levenshtein ratio threshold (0–1) to mark
28
+ a business as "Pending Verification".
29
+ max_flags_threshold: Number of user flags before a profile is auto-deactivated.
30
+ """
31
+
32
+ # NLP / Pipeline settings
33
+ ner_model_path: str | None = None
34
+ ner_backend: str = "crf" # "crf" or "transformer"
35
+ completeness_threshold: int = 2
36
+
37
+ # Recommendation settings
38
+ relevance_weight: float = 0.6
39
+ proximity_weight: float = 0.4
40
+ default_top_k: int = 10
41
+
42
+ # BPLO Verification settings
43
+ fuzzy_match_threshold_verified: float = 0.8
44
+ fuzzy_match_threshold_pending: float = 0.6
45
+
46
+ # Business Profile limits
47
+ max_flags_threshold: int = 3
@@ -0,0 +1,22 @@
1
+ """
2
+ ACUITY Framework — Extraction Module
3
+
4
+ NLP pipeline for extracting structured business information from
5
+ unstructured community group posts (e.g., Facebook, forums).
6
+
7
+ Components:
8
+ - preprocessing: Text cleaning and normalisation
9
+ - ner: Named Entity Recognition (CRF or Transformer backend)
10
+ - rules: Regex-based structured field extraction
11
+ - postprocessing: Profile construction from extraction outputs
12
+ - pipeline: End-to-end orchestrator
13
+
14
+ Quick Start:
15
+ >>> from acuity.extraction import ExtractionPipeline
16
+ >>> pipeline = ExtractionPipeline()
17
+ >>> profiles = pipeline.extract_from_texts(["Mang Juan's Bakery, Mamatid, open 8am-5pm, 0917-123-4567"])
18
+ """
19
+
20
+ from .pipeline import ExtractionPipeline
21
+
22
+ __all__ = ["ExtractionPipeline"]