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.
- collaborativenotes_utils-0.1.0/PKG-INFO +37 -0
- collaborativenotes_utils-0.1.0/README.md +24 -0
- collaborativenotes_utils-0.1.0/collaborativenotes_utils/__init__.py +5 -0
- collaborativenotes_utils-0.1.0/collaborativenotes_utils/collections.py +7 -0
- collaborativenotes_utils-0.1.0/collaborativenotes_utils/scoring.py +32 -0
- collaborativenotes_utils-0.1.0/collaborativenotes_utils.egg-info/PKG-INFO +37 -0
- collaborativenotes_utils-0.1.0/collaborativenotes_utils.egg-info/SOURCES.txt +9 -0
- collaborativenotes_utils-0.1.0/collaborativenotes_utils.egg-info/dependency_links.txt +1 -0
- collaborativenotes_utils-0.1.0/collaborativenotes_utils.egg-info/top_level.txt +1 -0
- collaborativenotes_utils-0.1.0/pyproject.toml +20 -0
- collaborativenotes_utils-0.1.0/setup.cfg +4 -0
|
@@ -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,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
|
+
|
|
@@ -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"
|