fetchit-engine 0.1.1__py3-none-any.whl

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.
@@ -0,0 +1,31 @@
1
+ """fetchit-engine: deterministic text cleanup and AI-writing heuristics.
2
+
3
+ Public API mirrors @fetchit/engine (JavaScript). See core.py for the
4
+ CleanResult contract; parity is enforced by packages/engine-core/vectors.json.
5
+ """
6
+ from .core import (
7
+ ENGINE_VERSION,
8
+ RULESET_VERSION,
9
+ MIN_CHARS,
10
+ MIN_WORDS,
11
+ clean,
12
+ rebuild_text,
13
+ remove_em_dashes,
14
+ apply_edits,
15
+ find_ai_spans,
16
+ analyze_ai_signals,
17
+ )
18
+
19
+ __all__ = [
20
+ "ENGINE_VERSION",
21
+ "RULESET_VERSION",
22
+ "MIN_CHARS",
23
+ "MIN_WORDS",
24
+ "clean",
25
+ "rebuild_text",
26
+ "remove_em_dashes",
27
+ "apply_edits",
28
+ "find_ai_spans",
29
+ "analyze_ai_signals",
30
+ ]
31
+ __version__ = ENGINE_VERSION
fetchit_engine/core.py ADDED
@@ -0,0 +1,506 @@
1
+ """Fetch It AI text engine (canonical core).
2
+
3
+ Emits the language-neutral CleanResult contract shared with @fetchit/engine
4
+ (JavaScript). Ported in lockstep; the parity vectors in
5
+ packages/engine-core/vectors.json are the contract both sides must satisfy.
6
+
7
+ Offsets in every result are CODE POINTS into the input text (offsetUnit
8
+ "codePoint"), so Python and JavaScript agree regardless of astral characters.
9
+ JS hosts that paint into the DOM convert to UTF-16 with the converter shipped
10
+ in the JS package.
11
+
12
+ This module has no third-party dependencies and no Qt/DOM coupling.
13
+ """
14
+ import json
15
+ import os
16
+ import re
17
+
18
+ ENGINE_VERSION = "0.1.1"
19
+
20
+ # --- ruleset (single source of truth, shared with the JS package) -----------
21
+ _RULESET_PATH = os.path.join(
22
+ os.path.dirname(__file__), "ruleset.json"
23
+ )
24
+
25
+
26
+ def _load_ruleset(path=_RULESET_PATH):
27
+ with open(path, "r", encoding="utf-8") as fh:
28
+ return json.load(fh)
29
+
30
+
31
+ RULESET = _load_ruleset()
32
+ RULESET_VERSION = RULESET["rulesetVersion"]
33
+ _PHRASES = RULESET["phrases"] # [{id, text}]
34
+ _ENUMERATORS = RULESET["enumerators"] # [{id, text}]
35
+ _INVISIBLE_RANGES = RULESET["invisibleRanges"]
36
+ _ODD_SPACE_RANGES = RULESET["oddSpaceRanges"]
37
+ _ODD_SPACE_RULE_ID = RULESET["oddSpaceRuleId"]
38
+ _ODD_SPACE_LABEL = RULESET["oddSpaceLabel"]
39
+ _T = RULESET["thresholds"]
40
+ MIN_CHARS = _T["MIN_CHARS"]
41
+ MIN_WORDS = _T["MIN_WORDS"]
42
+ _LEVEL_MODERATE = _T["levelModerate"]
43
+ _LEVEL_HIGH = _T["levelHigh"]
44
+
45
+ # --- regexes that are logic, not data (kept in code; may contain dashes) -----
46
+ # Em dash (U+2014) / horizontal bar (U+2015) in any spacing; en dash (U+2013)
47
+ # only when spaced on both sides. Only spaces/tabs are consumed so line breaks
48
+ # survive. Mirrors _EM_DASH in text_tools.py.
49
+ _EM_DASH = re.compile(r"[ \t]*[—―][ \t]*|[ \t]+–[ \t]+")
50
+ _MULTI_SPACE = re.compile(r"[ \t]{2,}")
51
+ _SPACE_BEFORE_PUNCT = re.compile(r"[ \t]+([,.;:!?])")
52
+
53
+ # re.ASCII pins \b, \d, \w, \s to ASCII so they match JavaScript's default
54
+ # (ASCII) semantics exactly. Without it Python treats accented letters as word
55
+ # characters and JS does not, which breaks \b matches near Unicode letters.
56
+ _RULE_OF_THREE = re.compile(
57
+ r"\b[A-Za-z]+,\s+[A-Za-z]+,\s+and\s+[A-Za-z]+\b", re.IGNORECASE | re.ASCII
58
+ )
59
+ _LIST_MARKER = re.compile(r"^\s*(?:[-*•·]|\d+[.)])\s+", re.MULTILINE | re.ASCII)
60
+ _CONTRACTION = re.compile(r"\b[A-Za-z]+'(?:t|s|re|ve|ll|d|m)\b", re.IGNORECASE | re.ASCII)
61
+ _WORD = re.compile(r"[A-Za-z']+")
62
+ # Sentence split: same as the JS splitSentences(). ASCII whitespace only.
63
+ _SENTENCE_SPLIT = re.compile(r"(?<=[.!?])[ \t\n\r\f\v]+", re.ASCII)
64
+ # One shared whitespace set for trimming and word splitting, identical in both
65
+ # engines. It is the union of what Python str.strip() and JS String.trim()
66
+ # consider whitespace, so gating on length never diverges by language.
67
+ _WS = frozenset(
68
+ [0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x85, 0xA0,
69
+ 0x1680, 0x2028, 0x2029, 0x202F, 0x205F, 0x3000, 0xFEFF]
70
+ + list(range(0x2000, 0x200B))
71
+ )
72
+
73
+
74
+ def _strip(text):
75
+ a, b = 0, len(text)
76
+ while a < b and ord(text[a]) in _WS:
77
+ a += 1
78
+ while b > a and ord(text[b - 1]) in _WS:
79
+ b -= 1
80
+ return text[a:b]
81
+
82
+
83
+ def _split_ws(s):
84
+ """Split on ASCII whitespace runs, dropping empties. Matches JS splitWords."""
85
+ return [w for w in re.split(r"[ \t\n\r\f\v]+", s) if w]
86
+
87
+ # Rule metadata for edits produced by the dash/space normalization passes.
88
+ _DASH_RULE = ("dash.spaced", "dash", "Replaced a spaced dash with a space")
89
+ _COLLAPSE_RULE = ("space.collapse", "space", "Collapsed repeated spaces")
90
+ _SPACE_BEFORE_RULE = ("punct.space-before", "space", "Removed a space before punctuation")
91
+
92
+ # Priority when several passes touch the same characters and their cells merge.
93
+ # Higher wins the label. Dash beats space cleanup beats invisible.
94
+ _RULE_PRIORITY = {
95
+ "dash.spaced": 40,
96
+ "space.lookalike": 30,
97
+ "space.collapse": 20,
98
+ "punct.space-before": 15,
99
+ }
100
+
101
+
102
+ def _ascii_lower(text):
103
+ """Lowercase only A-Z. Length- and position-preserving, so offsets computed
104
+ against the result map 1:1 back onto the input. Every rule phrase is ASCII,
105
+ so this never misses a match, and it is identical in JS."""
106
+ out = []
107
+ for ch in text:
108
+ o = ord(ch)
109
+ if 65 <= o <= 90:
110
+ out.append(chr(o + 32))
111
+ else:
112
+ out.append(ch)
113
+ return "".join(out)
114
+
115
+
116
+ def _invisible_rule(codepoint):
117
+ for r in _INVISIBLE_RANGES:
118
+ if r["min"] <= codepoint <= r["max"]:
119
+ return r
120
+ return None
121
+
122
+
123
+ def _is_odd_space(codepoint):
124
+ for r in _ODD_SPACE_RANGES:
125
+ if r["min"] <= codepoint <= r["max"]:
126
+ return True
127
+ return False
128
+
129
+
130
+ class _Cell:
131
+ """One unit of the working buffer, carrying provenance back to the input.
132
+
133
+ text current character(s), "" for a deletion
134
+ src0/src1 half-open code-point range in the INPUT this cell represents
135
+ rule (ruleId, category, message) if this cell is the product of an edit,
136
+ else None
137
+ """
138
+ __slots__ = ("text", "src0", "src1", "rule")
139
+
140
+ def __init__(self, text, src0, src1, rule=None):
141
+ self.text = text
142
+ self.src0 = src0
143
+ self.src1 = src1
144
+ self.rule = rule
145
+
146
+
147
+ def _regex_pass(cells, regex, replacement, rule):
148
+ """Run a regex over the string the cells currently spell, replacing each
149
+ match's cell range with a single edit cell. Match indices are code points
150
+ (Python native), which line up with cell boundaries because these regexes
151
+ only ever match BMP space/tab/dash/punct characters, never astral ones."""
152
+ current = "".join(c.text for c in cells)
153
+ if not regex.search(current):
154
+ return cells, False
155
+ # offset (in code points) where each cell's text starts in `current`
156
+ starts = []
157
+ pos = 0
158
+ for c in cells:
159
+ starts.append(pos)
160
+ pos += len(c.text)
161
+ starts.append(pos)
162
+
163
+ def cell_at(offset):
164
+ # first cell index whose start == offset (boundaries always align)
165
+ lo, hi = 0, len(cells)
166
+ while lo < hi:
167
+ mid = (lo + hi) // 2
168
+ if starts[mid] < offset:
169
+ lo = mid + 1
170
+ else:
171
+ hi = mid
172
+ return lo
173
+
174
+ out = []
175
+ last = 0
176
+ changed = False
177
+ for m in regex.finditer(current):
178
+ a, b = m.start(), m.end()
179
+ ci, cj = cell_at(a), cell_at(b)
180
+ out.extend(cells[last:ci])
181
+ merged = cells[ci:cj]
182
+ src0 = merged[0].src0
183
+ src1 = merged[-1].src1
184
+ # if any merged cell already carried a higher-priority rule, keep it
185
+ best = rule
186
+ best_pri = _RULE_PRIORITY.get(rule[0], 0)
187
+ for c in merged:
188
+ if c.rule and _RULE_PRIORITY.get(c.rule[0], 0) > best_pri:
189
+ best = c.rule
190
+ best_pri = _RULE_PRIORITY.get(c.rule[0], 0)
191
+ rep = m.expand(replacement) if "\\" in replacement else replacement
192
+ out.append(_Cell(rep, src0, src1, best))
193
+ last = cj
194
+ changed = True
195
+ out.extend(cells[last:])
196
+ return out, changed
197
+
198
+
199
+ def _build_cells(text, disabled=frozenset()):
200
+ """Pass A: invisible removal and look-alike-space normalization, cell-wise
201
+ by code point. A disabled rule leaves its characters untouched. Returns the
202
+ cell list (input order preserved)."""
203
+ cells = []
204
+ for i, ch in enumerate(text):
205
+ cp = ord(ch)
206
+ inv = _invisible_rule(cp)
207
+ if inv and inv["id"] not in disabled:
208
+ cells.append(_Cell("", i, i + 1, (inv["id"], "invisible", "Removed " + inv["label"])))
209
+ elif _is_odd_space(cp) and _ODD_SPACE_RULE_ID not in disabled:
210
+ cells.append(_Cell(" ", i, i + 1, (_ODD_SPACE_RULE_ID, "space", "Normalized a " + _ODD_SPACE_LABEL)))
211
+ else:
212
+ cells.append(_Cell(ch, i, i + 1, None))
213
+ return cells
214
+
215
+
216
+ def _cells_to_edits(cells, text):
217
+ """Turn edit-cells into CleanResult edit records (input code-point coords)."""
218
+ edits = []
219
+ n = 0
220
+ for c in cells:
221
+ if c.rule is None:
222
+ continue
223
+ original = text[c.src0:c.src1]
224
+ if original == c.text:
225
+ continue # no-op (e.g. a look-alike space that was already " ")
226
+ n += 1
227
+ rule_id, category, message = c.rule
228
+ edits.append({
229
+ "id": "e%d" % n,
230
+ "ruleId": rule_id,
231
+ "category": category,
232
+ "severity": "auto",
233
+ "start": c.src0,
234
+ "end": c.src1,
235
+ "original": original,
236
+ "replacement": c.text,
237
+ "message": message,
238
+ })
239
+ return edits
240
+
241
+
242
+ def _clean_cells(text, disabled=frozenset()):
243
+ """Full clean pipeline over cells. Mirrors clean_text() in text_tools.py:
244
+ rebuild (invisible + odd space), then, only if a dash was present, the em
245
+ dash pass plus multi-space collapse and space-before-punct tidy. A disabled
246
+ rule id skips its pass entirely, so cleaned text and the edit list agree."""
247
+ cells = _build_cells(text, disabled)
248
+ rebuilt = "".join(c.text for c in cells)
249
+ if _EM_DASH.search(rebuilt):
250
+ if _DASH_RULE[0] not in disabled:
251
+ cells, _ = _regex_pass(cells, _EM_DASH, " ", _DASH_RULE)
252
+ if _COLLAPSE_RULE[0] not in disabled:
253
+ cells, _ = _regex_pass(cells, _MULTI_SPACE, " ", _COLLAPSE_RULE)
254
+ if _SPACE_BEFORE_RULE[0] not in disabled:
255
+ cells, _ = _regex_pass(cells, _SPACE_BEFORE_PUNCT, "\\1", _SPACE_BEFORE_RULE)
256
+ cleaned = "".join(c.text for c in cells)
257
+ return cleaned, cells
258
+
259
+
260
+ # --- public building blocks --------------------------------------------------
261
+
262
+ def rebuild_text(text):
263
+ """Rebuild from visible characters only (invisible dropped, look-alike
264
+ spaces normalized). Returns (new_text, changed_count). Back-compatible with
265
+ text_tools.rebuild_text."""
266
+ cells = _build_cells(text)
267
+ changed = sum(1 for c in cells if c.rule is not None and text[c.src0:c.src1] != c.text)
268
+ return "".join(c.text for c in cells), changed
269
+
270
+
271
+ def remove_em_dashes(text):
272
+ """Replace spaced dashes with a single space. Returns (new_text, count).
273
+ Back-compatible with text_tools.remove_em_dashes."""
274
+ count = len(_EM_DASH.findall(text))
275
+ if not count:
276
+ return text, 0
277
+ new = _EM_DASH.sub(" ", text)
278
+ new = _MULTI_SPACE.sub(" ", new)
279
+ new = _SPACE_BEFORE_PUNCT.sub(r"\1", new)
280
+ return new, count
281
+
282
+
283
+ def apply_edits(text, accepted_ids, edits):
284
+ """Apply the chosen edits to text (code-point splices, right to left).
285
+ Accepting every edit reproduces CleanResult.cleaned.text exactly."""
286
+ accepted = set(accepted_ids)
287
+ chosen = [e for e in edits if e["id"] in accepted]
288
+ chosen.sort(key=lambda e: e["start"], reverse=True)
289
+ chars = list(text)
290
+ for e in chosen:
291
+ chars[e["start"]:e["end"]] = list(e["replacement"])
292
+ return "".join(chars)
293
+
294
+
295
+ def find_ai_spans(text):
296
+ """(start, end) code-point spans of AI-associated wording, sorted and
297
+ non-overlapping. Matches on an ASCII-lowercased copy so offsets map 1:1 to
298
+ the input (no lowercase round-trip drift)."""
299
+ return [(s["start"], s["end"]) for s in _find_ai_flags(text)]
300
+
301
+
302
+ def _find_ai_flags(text):
303
+ lowered = _ascii_lower(text)
304
+ raw = []
305
+ for p in _PHRASES:
306
+ phrase = p["text"]
307
+ start = lowered.find(phrase)
308
+ while start != -1:
309
+ raw.append((start, start + len(phrase), p["id"], phrase))
310
+ start = lowered.find(phrase, start + len(phrase))
311
+ for w in _ENUMERATORS:
312
+ for m in re.finditer(r"\b" + re.escape(w["text"]) + r"\b", lowered, re.ASCII):
313
+ raw.append((m.start(), m.end(), w["id"], w["text"]))
314
+ raw.sort(key=lambda s: (s[0], -(s[1] - s[0])))
315
+ chosen = []
316
+ reached = 0
317
+ for start, end, rid, txt in raw:
318
+ if start >= reached:
319
+ chosen.append({
320
+ "ruleId": rid, "start": start, "end": end,
321
+ "text": text[start:end], "matched": txt,
322
+ })
323
+ reached = end
324
+ return chosen
325
+
326
+
327
+ def analyze_ai_signals(text):
328
+ """Heuristic AI-writing scan. Returns a report with structured signals
329
+ (each carrying a stable id and its point contribution)."""
330
+ stripped = _strip(text)
331
+ if not stripped:
332
+ return {"status": "empty"}
333
+ words = _WORD.findall(stripped)
334
+ if len(stripped) < MIN_CHARS or len(words) < MIN_WORDS:
335
+ return {"status": "too_short"}
336
+
337
+ score = 0
338
+ signals = []
339
+ lowered = _ascii_lower(stripped)
340
+
341
+ # 1. Em/en dash density.
342
+ dash_count = sum(stripped.count(d) for d in ("—", "–", "―"))
343
+ dash_rate = dash_count / len(stripped) * 1000
344
+ if dash_rate > 3:
345
+ score += 25
346
+ signals.append({"id": "signal.dash-density", "points": 25,
347
+ "message": "Heavy em-dash use (%d dashes)" % dash_count})
348
+ elif dash_rate > 1.2:
349
+ score += 12
350
+ signals.append({"id": "signal.dash-density", "points": 12,
351
+ "message": "Frequent em-dash use (%d dashes)" % dash_count})
352
+
353
+ # 2. Stock AI phrases.
354
+ found = [p["text"] for p in _PHRASES if p["text"] in lowered]
355
+ if found:
356
+ occurrences = sum(lowered.count(p) for p in found)
357
+ pts = min(30, 10 * len(found))
358
+ score += pts
359
+ shown = ", ".join('"%s"' % p for p in found[:4])
360
+ extra = " and %d more" % (len(found) - 4) if len(found) > 4 else ""
361
+ signals.append({"id": "signal.stock-phrases", "points": pts,
362
+ "message": "AI-associated wording: %s%s (%d occurrence(s))"
363
+ % (shown, extra, occurrences)})
364
+
365
+ # 3. Contraction rate.
366
+ contractions = len(_CONTRACTION.findall(stripped))
367
+ if len(words) >= 120 and contractions / len(words) * 100 < 0.5:
368
+ score += 10
369
+ signals.append({"id": "signal.contractions", "points": 10,
370
+ "message": "Almost no contractions (stiff, formal tone)"})
371
+
372
+ # 4. Sentence-length uniformity.
373
+ sentences = [s for s in _SENTENCE_SPLIT.split(stripped) if len(_split_ws(s)) >= 3]
374
+ if len(sentences) >= 6:
375
+ lengths = [len(_split_ws(s)) for s in sentences]
376
+ mean = sum(lengths) / len(lengths)
377
+ variance = sum((v - mean) ** 2 for v in lengths) / len(lengths)
378
+ if mean and (variance ** 0.5) / mean < 0.35:
379
+ score += 15
380
+ signals.append({"id": "signal.sentence-uniformity", "points": 15,
381
+ "message": "Unusually uniform sentence lengths"})
382
+
383
+ # 5. Rule of three.
384
+ triads = len(_RULE_OF_THREE.findall(stripped))
385
+ if triads >= 3:
386
+ score += 12
387
+ signals.append({"id": "signal.rule-of-three", "points": 12,
388
+ "message": "Frequent rule-of-three lists (%d triads)" % triads})
389
+ elif triads == 2:
390
+ score += 6
391
+ signals.append({"id": "signal.rule-of-three", "points": 6,
392
+ "message": "Some rule-of-three phrasing"})
393
+
394
+ # 6. List structure.
395
+ enum_hits = sum(len(re.findall(r"\b" + re.escape(w["text"]) + r"\b", lowered, re.ASCII))
396
+ for w in _ENUMERATORS)
397
+ marker_hits = len(_LIST_MARKER.findall(text))
398
+ list_signal = enum_hits + marker_hits
399
+ if list_signal >= 4:
400
+ score += 12
401
+ signals.append({"id": "signal.list-structure", "points": 12,
402
+ "message": "Heavily list-structured (enumerators / bullets)"})
403
+ elif list_signal >= 2:
404
+ score += 6
405
+ signals.append({"id": "signal.list-structure", "points": 6,
406
+ "message": "Somewhat list-structured"})
407
+
408
+ score = min(score, 100)
409
+ level = "high" if score >= _LEVEL_HIGH else "moderate" if score >= _LEVEL_MODERATE else "low"
410
+ return {"status": "ok", "score": score, "level": level, "signals": signals}
411
+
412
+
413
+ # --- the one-call entry point -----------------------------------------------
414
+
415
+ def clean(text, options=None):
416
+ """Clean text and return the full CleanResult.
417
+
418
+ options (all optional):
419
+ mode: "review" (default) | "auto" - advisory only; the result is identical.
420
+ Callers apply auto edits unattended and show suggest flags to a human.
421
+ rules.disable: list of rule ids to drop from edits and flags.
422
+ rules.customPhrases: extra phrases flagged as AI-associated wording.
423
+ """
424
+ options = options or {}
425
+ rules = options.get("rules") or {}
426
+ disabled = set(rules.get("disable") or [])
427
+ custom = list(rules.get("customPhrases") or [])
428
+
429
+ cleaned, cells = _clean_cells(text, disabled)
430
+ edits = _cells_to_edits(cells, text)
431
+
432
+ flag_hits = _find_ai_flags(text)
433
+ if custom:
434
+ lowered = _ascii_lower(text)
435
+ for phrase in custom:
436
+ needle = _ascii_lower(phrase)
437
+ if not needle:
438
+ continue
439
+ start = lowered.find(needle)
440
+ while start != -1:
441
+ flag_hits.append({"ruleId": "ai-custom." + re.sub(r"[^a-z0-9]+", "-", needle).strip("-"),
442
+ "start": start, "end": start + len(needle),
443
+ "text": text[start:start + len(needle)], "matched": needle})
444
+ start = lowered.find(needle, start + len(needle))
445
+ flag_hits.sort(key=lambda s: (s["start"], -(s["end"] - s["start"])))
446
+ deduped = []
447
+ reached = 0
448
+ for h in flag_hits:
449
+ if h["start"] >= reached:
450
+ deduped.append(h)
451
+ reached = h["end"]
452
+ flag_hits = deduped
453
+
454
+ flags = []
455
+ fn = 0
456
+ for h in flag_hits:
457
+ if h["ruleId"] in disabled:
458
+ continue
459
+ fn += 1
460
+ flags.append({
461
+ "id": "f%d" % fn,
462
+ "ruleId": h["ruleId"],
463
+ "category": "ai-wording",
464
+ "severity": "suggest",
465
+ "start": h["start"],
466
+ "end": h["end"],
467
+ "text": h["text"],
468
+ "replacement": None,
469
+ "message": "AI-associated wording",
470
+ })
471
+
472
+ report = analyze_ai_signals(text)
473
+
474
+ # Count the characters an edit actually CONSUMED, not the rule that fired.
475
+ #
476
+ # Attributing by ruleId undercounts: a broader rule can swallow a span that
477
+ # contained invisible characters. " <ZWSP> " is collapsed by space.collapse,
478
+ # which removed the zero-width space while reporting hidden: 0. Since no
479
+ # replacement ever contains an invisible or look-alike character, counting
480
+ # them in `original` is exact regardless of which rule did the removing.
481
+ def _count_consumed(pred):
482
+ return sum(
483
+ 1 for e in edits for ch in e["original"] if pred(ord(ch))
484
+ )
485
+
486
+ invisible_n = _count_consumed(lambda cp: _invisible_rule(cp) is not None)
487
+ oddspace_n = _count_consumed(_is_odd_space)
488
+ dashes_n = sum(1 for e in edits if e["ruleId"] == "dash.spaced")
489
+
490
+ return {
491
+ "engineVersion": ENGINE_VERSION,
492
+ "rulesetVersion": RULESET_VERSION,
493
+ "offsetUnit": "codePoint",
494
+ "input": {"length": len(text)},
495
+ "cleaned": {"text": cleaned, "length": len(cleaned)},
496
+ "edits": edits,
497
+ "flags": flags,
498
+ "aiReport": report,
499
+ "summary": {
500
+ "invisible": invisible_n,
501
+ "oddSpaces": oddspace_n,
502
+ "dashes": dashes_n,
503
+ "hidden": invisible_n + oddspace_n,
504
+ "flagged": len(flags),
505
+ },
506
+ }
@@ -0,0 +1,389 @@
1
+ {
2
+ "rulesetVersion": "2026-08-18",
3
+ "phrases": [
4
+ {
5
+ "id": "ai-wording.delve",
6
+ "text": "delve"
7
+ },
8
+ {
9
+ "id": "ai-wording.delving",
10
+ "text": "delving"
11
+ },
12
+ {
13
+ "id": "ai-wording.tapestry",
14
+ "text": "tapestry"
15
+ },
16
+ {
17
+ "id": "ai-wording.seamlessly",
18
+ "text": "seamlessly"
19
+ },
20
+ {
21
+ "id": "ai-wording.meticulously",
22
+ "text": "meticulously"
23
+ },
24
+ {
25
+ "id": "ai-wording.myriad",
26
+ "text": "myriad"
27
+ },
28
+ {
29
+ "id": "ai-wording.plethora",
30
+ "text": "plethora"
31
+ },
32
+ {
33
+ "id": "ai-wording.underscore",
34
+ "text": "underscore"
35
+ },
36
+ {
37
+ "id": "ai-wording.multifaceted",
38
+ "text": "multifaceted"
39
+ },
40
+ {
41
+ "id": "ai-wording.unleash",
42
+ "text": "unleash"
43
+ },
44
+ {
45
+ "id": "ai-wording.unveil",
46
+ "text": "unveil"
47
+ },
48
+ {
49
+ "id": "ai-wording.nuanced",
50
+ "text": "nuanced"
51
+ },
52
+ {
53
+ "id": "ai-wording.pivotal",
54
+ "text": "pivotal"
55
+ },
56
+ {
57
+ "id": "ai-wording.commendable",
58
+ "text": "commendable"
59
+ },
60
+ {
61
+ "id": "ai-wording.noteworthy",
62
+ "text": "noteworthy"
63
+ },
64
+ {
65
+ "id": "ai-wording.intricate",
66
+ "text": "intricate"
67
+ },
68
+ {
69
+ "id": "ai-wording.realm",
70
+ "text": "realm"
71
+ },
72
+ {
73
+ "id": "ai-wording.landscape",
74
+ "text": "landscape"
75
+ },
76
+ {
77
+ "id": "ai-wording.testament",
78
+ "text": "testament"
79
+ },
80
+ {
81
+ "id": "ai-wording.it-is-important-to-note",
82
+ "text": "it is important to note"
83
+ },
84
+ {
85
+ "id": "ai-wording.it-s-important-to-note",
86
+ "text": "it's important to note"
87
+ },
88
+ {
89
+ "id": "ai-wording.it-s-worth-noting",
90
+ "text": "it's worth noting"
91
+ },
92
+ {
93
+ "id": "ai-wording.it-is-worth-noting",
94
+ "text": "it is worth noting"
95
+ },
96
+ {
97
+ "id": "ai-wording.that-being-said",
98
+ "text": "that being said"
99
+ },
100
+ {
101
+ "id": "ai-wording.when-it-comes-to",
102
+ "text": "when it comes to"
103
+ },
104
+ {
105
+ "id": "ai-wording.first-and-foremost",
106
+ "text": "first and foremost"
107
+ },
108
+ {
109
+ "id": "ai-wording.at-the-end-of-the-day",
110
+ "text": "at the end of the day"
111
+ },
112
+ {
113
+ "id": "ai-wording.in-today-s-fast-paced",
114
+ "text": "in today's fast-paced"
115
+ },
116
+ {
117
+ "id": "ai-wording.in-an-era-of",
118
+ "text": "in an era of"
119
+ },
120
+ {
121
+ "id": "ai-wording.in-the-realm-of",
122
+ "text": "in the realm of"
123
+ },
124
+ {
125
+ "id": "ai-wording.on-the-other-hand",
126
+ "text": "on the other hand"
127
+ },
128
+ {
129
+ "id": "ai-wording.more-than-just",
130
+ "text": "more than just"
131
+ },
132
+ {
133
+ "id": "ai-wording.plays-a-crucial-role",
134
+ "text": "plays a crucial role"
135
+ },
136
+ {
137
+ "id": "ai-wording.plays-a-vital-role",
138
+ "text": "plays a vital role"
139
+ },
140
+ {
141
+ "id": "ai-wording.plays-a-significant-role",
142
+ "text": "plays a significant role"
143
+ },
144
+ {
145
+ "id": "ai-wording.a-wide-range-of",
146
+ "text": "a wide range of"
147
+ },
148
+ {
149
+ "id": "ai-wording.a-wide-array-of",
150
+ "text": "a wide array of"
151
+ },
152
+ {
153
+ "id": "ai-wording.various-factors",
154
+ "text": "various factors"
155
+ },
156
+ {
157
+ "id": "ai-wording.it-is-essential-to",
158
+ "text": "it is essential to"
159
+ },
160
+ {
161
+ "id": "ai-wording.it-is-crucial-to",
162
+ "text": "it is crucial to"
163
+ },
164
+ {
165
+ "id": "ai-wording.there-are-several",
166
+ "text": "there are several"
167
+ },
168
+ {
169
+ "id": "ai-wording.ever-evolving",
170
+ "text": "ever-evolving"
171
+ },
172
+ {
173
+ "id": "ai-wording.ever-changing",
174
+ "text": "ever-changing"
175
+ },
176
+ {
177
+ "id": "ai-wording.game-changer",
178
+ "text": "game-changer"
179
+ },
180
+ {
181
+ "id": "ai-wording.game-changer-2",
182
+ "text": "game changer"
183
+ },
184
+ {
185
+ "id": "ai-wording.testament-to",
186
+ "text": "testament to"
187
+ },
188
+ {
189
+ "id": "ai-wording.paving-the-way",
190
+ "text": "paving the way"
191
+ },
192
+ {
193
+ "id": "ai-wording.look-no-further",
194
+ "text": "look no further"
195
+ },
196
+ {
197
+ "id": "ai-wording.beacon-of",
198
+ "text": "beacon of"
199
+ },
200
+ {
201
+ "id": "ai-wording.elevate-your",
202
+ "text": "elevate your"
203
+ },
204
+ {
205
+ "id": "ai-wording.unlock-the-full-potential",
206
+ "text": "unlock the full potential"
207
+ },
208
+ {
209
+ "id": "ai-wording.unlock-the-power",
210
+ "text": "unlock the power"
211
+ },
212
+ {
213
+ "id": "ai-wording.embark-on-a-journey",
214
+ "text": "embark on a journey"
215
+ },
216
+ {
217
+ "id": "ai-wording.navigating-the-complexities",
218
+ "text": "navigating the complexities"
219
+ },
220
+ {
221
+ "id": "ai-wording.navigating-the",
222
+ "text": "navigating the"
223
+ },
224
+ {
225
+ "id": "ai-wording.holistic-approach",
226
+ "text": "holistic approach"
227
+ },
228
+ {
229
+ "id": "ai-wording.at-its-core",
230
+ "text": "at its core"
231
+ },
232
+ {
233
+ "id": "ai-wording.let-s-dive-in",
234
+ "text": "let's dive in"
235
+ },
236
+ {
237
+ "id": "ai-wording.dive-deeper",
238
+ "text": "dive deeper"
239
+ },
240
+ {
241
+ "id": "ai-wording.rich-tapestry",
242
+ "text": "rich tapestry"
243
+ },
244
+ {
245
+ "id": "ai-wording.treasure-trove",
246
+ "text": "treasure trove"
247
+ },
248
+ {
249
+ "id": "ai-wording.in-conclusion",
250
+ "text": "in conclusion,"
251
+ },
252
+ {
253
+ "id": "ai-wording.in-summary",
254
+ "text": "in summary,"
255
+ },
256
+ {
257
+ "id": "ai-wording.to-sum-up",
258
+ "text": "to sum up"
259
+ },
260
+ {
261
+ "id": "ai-wording.ultimately",
262
+ "text": "ultimately,"
263
+ }
264
+ ],
265
+ "enumerators": [
266
+ {
267
+ "id": "ai-enumerator.firstly",
268
+ "text": "firstly"
269
+ },
270
+ {
271
+ "id": "ai-enumerator.secondly",
272
+ "text": "secondly"
273
+ },
274
+ {
275
+ "id": "ai-enumerator.thirdly",
276
+ "text": "thirdly"
277
+ },
278
+ {
279
+ "id": "ai-enumerator.fourthly",
280
+ "text": "fourthly"
281
+ },
282
+ {
283
+ "id": "ai-enumerator.lastly",
284
+ "text": "lastly"
285
+ },
286
+ {
287
+ "id": "ai-enumerator.moreover",
288
+ "text": "moreover"
289
+ },
290
+ {
291
+ "id": "ai-enumerator.furthermore",
292
+ "text": "furthermore"
293
+ },
294
+ {
295
+ "id": "ai-enumerator.additionally",
296
+ "text": "additionally"
297
+ },
298
+ {
299
+ "id": "ai-enumerator.consequently",
300
+ "text": "consequently"
301
+ }
302
+ ],
303
+ "invisibleRanges": [
304
+ {
305
+ "min": 173,
306
+ "max": 173,
307
+ "id": "invisible.soft-hyphen",
308
+ "label": "soft hyphen"
309
+ },
310
+ {
311
+ "min": 6158,
312
+ "max": 6158,
313
+ "id": "invisible.format",
314
+ "label": "Mongolian vowel separator"
315
+ },
316
+ {
317
+ "min": 8203,
318
+ "max": 8205,
319
+ "id": "invisible.zero-width",
320
+ "label": "zero-width character"
321
+ },
322
+ {
323
+ "min": 8206,
324
+ "max": 8207,
325
+ "id": "invisible.bidi",
326
+ "label": "bidirectional mark"
327
+ },
328
+ {
329
+ "min": 8234,
330
+ "max": 8238,
331
+ "id": "invisible.bidi",
332
+ "label": "bidirectional control"
333
+ },
334
+ {
335
+ "min": 8288,
336
+ "max": 8292,
337
+ "id": "invisible.zero-width",
338
+ "label": "word joiner / invisible operator"
339
+ },
340
+ {
341
+ "min": 8293,
342
+ "max": 8303,
343
+ "id": "invisible.format",
344
+ "label": "format control"
345
+ },
346
+ {
347
+ "min": 65279,
348
+ "max": 65279,
349
+ "id": "invisible.zero-width",
350
+ "label": "byte-order mark"
351
+ },
352
+ {
353
+ "min": 917504,
354
+ "max": 917631,
355
+ "id": "invisible.tag-block",
356
+ "label": "Unicode tag character"
357
+ }
358
+ ],
359
+ "oddSpaceRanges": [
360
+ {
361
+ "min": 160,
362
+ "max": 160
363
+ },
364
+ {
365
+ "min": 8192,
366
+ "max": 8202
367
+ },
368
+ {
369
+ "min": 8239,
370
+ "max": 8239
371
+ },
372
+ {
373
+ "min": 8287,
374
+ "max": 8287
375
+ },
376
+ {
377
+ "min": 12288,
378
+ "max": 12288
379
+ }
380
+ ],
381
+ "oddSpaceRuleId": "space.lookalike",
382
+ "oddSpaceLabel": "look-alike space",
383
+ "thresholds": {
384
+ "MIN_CHARS": 200,
385
+ "MIN_WORDS": 40,
386
+ "levelModerate": 20,
387
+ "levelHigh": 45
388
+ }
389
+ }
@@ -0,0 +1,117 @@
1
+ """Structured spellcheck, extracted from the desktop app's spellcheck.py.
2
+
3
+ Qt-free: this is the reusable detection and ranking logic with the Qt widget
4
+ classes removed, returning misspellings and ranked suggestions as plain data.
5
+ The desktop SpellHighlighter / SpellCheckTextEdit can be refactored to consume
6
+ this later; the tool web engine does not use it (browsers spellcheck natively).
7
+
8
+ Backed by pyspellchecker, which is an optional extra:
9
+ pip install "fetchit-engine[spell]"
10
+ If it is not installed, get_spellchecker() returns None and the functions here
11
+ degrade to empty results, exactly like the desktop app does.
12
+
13
+ Offsets in check_text results are CODE POINTS into the text, matching the rest
14
+ of the engine (offsetUnit "codePoint"). Results use the same shape as engine
15
+ flags: severity "suggest", a ruleId, category, start/end, and text.
16
+ """
17
+ import re
18
+
19
+ WORD_RE = re.compile(r"[A-Za-z']{2,}")
20
+
21
+ _spell = None
22
+ _spell_load_failed = False
23
+
24
+
25
+ def get_spellchecker():
26
+ """Lazily load the dictionary (~0.3s once). Returns None if pyspellchecker
27
+ is unavailable, so callers keep working without spellcheck."""
28
+ global _spell, _spell_load_failed
29
+ if _spell is None and not _spell_load_failed:
30
+ try:
31
+ from spellchecker import SpellChecker
32
+
33
+ _spell = SpellChecker()
34
+ except Exception:
35
+ _spell_load_failed = True
36
+ return _spell
37
+
38
+
39
+ def is_checkable(word):
40
+ """Skip things that are not prose: words with digits, ALL-CAPS acronyms,
41
+ and CamelCase / mid-word capitals. Same rule as the desktop app."""
42
+ if any(ch.isdigit() for ch in word):
43
+ return False
44
+ if word.isupper():
45
+ return False
46
+ if any(ch.isupper() for ch in word[1:]):
47
+ return False
48
+ return True
49
+
50
+
51
+ def suggest(word, max_suggestions=5):
52
+ """Ranked replacement suggestions for one word: the best correction first,
53
+ then remaining candidates alphabetically, capped. Capitalization of the
54
+ original is restored. Returns [] if the word is fine, too long/short, not
55
+ checkable, or the dictionary is unavailable. Mirrors the desktop ranking."""
56
+ spell = get_spellchecker()
57
+ if spell is None:
58
+ return []
59
+ w = word.strip("'")
60
+ # Long garbage strings make candidate search slow; skip them (as the app does).
61
+ if not w or not (2 <= len(w) <= 15) or not is_checkable(w):
62
+ return []
63
+ lw = w.lower()
64
+ if lw not in spell.unknown([lw]):
65
+ return []
66
+ best = spell.correction(lw)
67
+ candidates = set(spell.candidates(lw) or set())
68
+ candidates.discard(lw)
69
+ ordered = []
70
+ if best and best != lw:
71
+ ordered.append(best)
72
+ ordered.extend(sorted(c for c in candidates if c != best))
73
+ ordered = ordered[:max_suggestions]
74
+ if w[0].isupper():
75
+ ordered = [c.capitalize() for c in ordered]
76
+ return ordered
77
+
78
+
79
+ def check_text(text, with_suggestions=True, max_suggestions=5):
80
+ """Find misspelled words in text. Returns a list of records:
81
+
82
+ {ruleId, category, severity, start, end, text, suggestions, message}
83
+
84
+ start/end are code-point offsets. Every unknown checkable word (2+ letters)
85
+ is reported; suggestions are provided for words 2-15 characters long when
86
+ with_suggestions is true (longer words are still reported, with []).
87
+ Returns [] if the dictionary is unavailable."""
88
+ found = []
89
+ for m in WORD_RE.finditer(text):
90
+ raw = m.group()
91
+ word = raw.strip("'")
92
+ if word and is_checkable(word):
93
+ start = m.start() + raw.index(word)
94
+ found.append((start, start + len(word), word))
95
+
96
+ spell = get_spellchecker()
97
+ if spell is None or not found:
98
+ return []
99
+
100
+ unknown = spell.unknown({w.lower() for _, _, w in found})
101
+ if not unknown:
102
+ return []
103
+
104
+ results = []
105
+ for start, end, word in found:
106
+ if word.lower() in unknown:
107
+ results.append({
108
+ "ruleId": "spell.misspelling",
109
+ "category": "spell",
110
+ "severity": "suggest",
111
+ "start": start,
112
+ "end": end,
113
+ "text": word,
114
+ "suggestions": suggest(word, max_suggestions) if with_suggestions else [],
115
+ "message": "Possible misspelling",
116
+ })
117
+ return results
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.4
2
+ Name: fetchit-engine
3
+ Version: 0.1.1
4
+ Summary: Deterministic text cleanup and AI-writing heuristics. Runs entirely in your process; text never leaves it.
5
+ Author: Outta Work Solutions
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://fetchitai.com/developers
8
+ Project-URL: Repository, https://github.com/OuttaWorkSolutions/fetchit-engine
9
+ Project-URL: Changelog, https://github.com/OuttaWorkSolutions/fetchit-engine/blob/main/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/OuttaWorkSolutions/fetchit-engine/issues
11
+ Keywords: ai text,cleanup,invisible characters,em dash,text hygiene
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Topic :: Text Processing :: Linguistic
15
+ Requires-Python: >=3.8
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ License-File: NOTICE
19
+ Provides-Extra: spell
20
+ Requires-Dist: pyspellchecker>=0.7; extra == "spell"
21
+ Dynamic: license-file
22
+
23
+ # fetchit-engine
24
+
25
+ Deterministic text cleanup and AI-writing heuristics that run entirely in your
26
+ process. Your users text never leaves it. Pure standard library, no dependencies.
27
+
28
+ ```python
29
+ from fetchit_engine import clean, apply_edits
30
+
31
+ r = clean(ai_draft, {"mode": "auto"}) # apply only auto-safe edits unattended
32
+ publish(r["cleaned"]["text"])
33
+ if r["aiReport"].get("level") == "high":
34
+ review_queue.put(ai_draft, r) # hand a human the full result
35
+ ```
36
+
37
+ Offsets are code points. See the [repository README](https://github.com/OuttaWorkSolutions/fetchit-engine#the-design-in-four-claims)
38
+ for the full CleanResult contract, shared 1:1 with @fetchitai/engine (JavaScript).
39
+
40
+
41
+ ## License
42
+
43
+ Apache-2.0. Free for everyone, including commercial use.
@@ -0,0 +1,10 @@
1
+ fetchit_engine/__init__.py,sha256=Z37F_L0nx1r7xw5Qr1jbZw9M4DwdkVcm481YR5wEd50,676
2
+ fetchit_engine/core.py,sha256=YyA1bn6Wb0hycE0SZzCJnX2H_eNJkk5A63xF_dF-FGI,19195
3
+ fetchit_engine/ruleset.json,sha256=GNimU9WFU36pOTVhIlAjjtm9TrmVFq69LCAIcLziLBM,8232
4
+ fetchit_engine/spell_core.py,sha256=hCWdmetoqnrregMs0nEMOqUkwA6qvk89IpGmo8aDCj4,4261
5
+ fetchit_engine-0.1.1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
6
+ fetchit_engine-0.1.1.dist-info/licenses/NOTICE,sha256=akoIiN0j_ZZBtzA_mVqs0MNy8oXezJHK8nluu998v4w,146
7
+ fetchit_engine-0.1.1.dist-info/METADATA,sha256=9A04o9h4lL4b6QuxpkKsEMTmVMfI04wI4jC4tfmq9Ik,1762
8
+ fetchit_engine-0.1.1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
9
+ fetchit_engine-0.1.1.dist-info/top_level.txt,sha256=IK43FAp244fOwCdK8vAtdozPviRmGLOzTFG2yq69wCA,15
10
+ fetchit_engine-0.1.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ Fetch It AI engine
2
+ Copyright 2026 Outta Work Solutions
3
+
4
+ This product includes software developed at Outta Work Solutions
5
+ (https://fetchitai.com).
@@ -0,0 +1 @@
1
+ fetchit_engine