collaborativenotes-utils 0.1.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.
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: collaborativenotes-utils
3
+ Version: 0.1.0
4
+ Summary: Scoring, ranking and search utilities for CollaborativeNotes
5
+ Author: Ayush Singh
6
+ Project-URL: Homepage, https://github.com/yourusername/collaborativenotes-utils
7
+ Keywords: notes,scoring,ranking,search,education
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+
14
+ # collaborativenotes-utils
15
+
16
+ Scoring, ranking and search utilities for the CollaborativeNotes Django app.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pip install collaborativenotes-utils
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```python
27
+ from collaborativenotes_utils import rank_notes, calculate_weighted_rating, search_score
28
+
29
+ # Rank notes by relevance to a search query + rating + downloads
30
+ ranked = rank_notes(notes, query="databases")
31
+
32
+ # Bayesian weighted rating (avoids bias from notes with few votes)
33
+ rating = calculate_weighted_rating([5, 4, 3, 5, 4])
34
+
35
+ # Get a single note's relevance score
36
+ score = search_score(note, query="normalisation")
37
+ ```
@@ -0,0 +1,24 @@
1
+ # collaborativenotes-utils
2
+
3
+ Scoring, ranking and search utilities for the CollaborativeNotes Django app.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install collaborativenotes-utils
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ from collaborativenotes_utils import rank_notes, calculate_weighted_rating, search_score
15
+
16
+ # Rank notes by relevance to a search query + rating + downloads
17
+ ranked = rank_notes(notes, query="databases")
18
+
19
+ # Bayesian weighted rating (avoids bias from notes with few votes)
20
+ rating = calculate_weighted_rating([5, 4, 3, 5, 4])
21
+
22
+ # Get a single note's relevance score
23
+ score = search_score(note, query="normalisation")
24
+ ```
@@ -0,0 +1,5 @@
1
+ from .scoring import rank_notes, calculate_weighted_rating, search_score
2
+ from .collections import group_by_collection
3
+
4
+ __version__ = "0.1.0"
5
+ __all__ = ["rank_notes", "calculate_weighted_rating", "search_score"]
@@ -0,0 +1,7 @@
1
+ def group_by_collection(notes: list) -> dict:
2
+
3
+ groups = {}
4
+ for note in notes:
5
+ name = note.get("collection", "").strip() or "Uncategorised"
6
+ groups.setdefault(name, []).append(note)
7
+ return groups
@@ -0,0 +1,32 @@
1
+ def search_score(note: dict, query: str = "") -> float:
2
+
3
+ score = 0.0
4
+ q = query.strip().lower()
5
+
6
+ if q:
7
+ if q in note.get("title", "").lower():
8
+ score += 10
9
+ if q in note.get("subject", "").lower():
10
+ score += 7
11
+ if q in note.get("description", "").lower():
12
+ score += 5
13
+
14
+ # Rating boost (avg_rating stored as string in DynamoDB)
15
+ try:
16
+ score += float(note.get("avg_rating", 0)) * 2
17
+ except (ValueError, TypeError):
18
+ pass
19
+
20
+ # Popularity boost (capped so viral notes don't dominate)
21
+ try:
22
+ score += min(int(note.get("download_count", 0)), 50) * 0.1
23
+ except (ValueError, TypeError):
24
+ pass
25
+
26
+ return score
27
+
28
+
29
+ def rank_notes(notes: list, query: str = "") -> list:
30
+
31
+ return sorted(notes, key=lambda n: search_score(n, query), reverse=True)
32
+
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.4
2
+ Name: collaborativenotes-utils
3
+ Version: 0.1.0
4
+ Summary: Scoring, ranking and search utilities for CollaborativeNotes
5
+ Author: Ayush Singh
6
+ Project-URL: Homepage, https://github.com/yourusername/collaborativenotes-utils
7
+ Keywords: notes,scoring,ranking,search,education
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+
14
+ # collaborativenotes-utils
15
+
16
+ Scoring, ranking and search utilities for the CollaborativeNotes Django app.
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pip install collaborativenotes-utils
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ```python
27
+ from collaborativenotes_utils import rank_notes, calculate_weighted_rating, search_score
28
+
29
+ # Rank notes by relevance to a search query + rating + downloads
30
+ ranked = rank_notes(notes, query="databases")
31
+
32
+ # Bayesian weighted rating (avoids bias from notes with few votes)
33
+ rating = calculate_weighted_rating([5, 4, 3, 5, 4])
34
+
35
+ # Get a single note's relevance score
36
+ score = search_score(note, query="normalisation")
37
+ ```
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ collaborativenotes_utils/__init__.py
4
+ collaborativenotes_utils/collections.py
5
+ collaborativenotes_utils/scoring.py
6
+ collaborativenotes_utils.egg-info/PKG-INFO
7
+ collaborativenotes_utils.egg-info/SOURCES.txt
8
+ collaborativenotes_utils.egg-info/dependency_links.txt
9
+ collaborativenotes_utils.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ collaborativenotes_utils
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "collaborativenotes-utils"
7
+ version = "0.1.0"
8
+ description = "Scoring, ranking and search utilities for CollaborativeNotes"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ authors = [{ name = "Ayush Singh" }]
12
+ keywords = ["notes", "scoring", "ranking", "search", "education"]
13
+ classifiers = [
14
+ "Programming Language :: Python :: 3",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+
19
+ [project.urls]
20
+ Homepage = "https://github.com/yourusername/collaborativenotes-utils"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+