markrel 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.
- markrel-0.1.0/.github/workflows/ci.yml +73 -0
- markrel-0.1.0/.github/workflows/release.yml +48 -0
- markrel-0.1.0/.gitignore +148 -0
- markrel-0.1.0/CONTRIBUTING.md +66 -0
- markrel-0.1.0/LICENSE +21 -0
- markrel-0.1.0/PKG-INFO +542 -0
- markrel-0.1.0/README.md +507 -0
- markrel-0.1.0/RELEASE.md +114 -0
- markrel-0.1.0/data/wikiqa/wikiqa_processed.json +1 -0
- markrel-0.1.0/demo.py +258 -0
- markrel-0.1.0/docs/inference.md +499 -0
- markrel-0.1.0/docs/performance.md +298 -0
- markrel-0.1.0/docs/training.md +358 -0
- markrel-0.1.0/experiments/bayesian_optimization_precision_results.json +1326 -0
- markrel-0.1.0/experiments/bayesian_optimization_precision_study.pkl +0 -0
- markrel-0.1.0/experiments/bayesian_optimization_recall_results.json +1326 -0
- markrel-0.1.0/experiments/bayesian_optimization_recall_study.pkl +0 -0
- markrel-0.1.0/experiments/bayesian_optimization_results.json +1325 -0
- markrel-0.1.0/experiments/bayesian_optimization_study.pkl +0 -0
- markrel-0.1.0/experiments/benchmark.py +512 -0
- markrel-0.1.0/experiments/benchmark_real_data.py +399 -0
- markrel-0.1.0/experiments/benchmark_report.md +231 -0
- markrel-0.1.0/experiments/benchmark_results.json +286 -0
- markrel-0.1.0/experiments/download_msmarco.py +317 -0
- markrel-0.1.0/experiments/download_wikiqa.py +375 -0
- markrel-0.1.0/experiments/realworld_benchmark_report.md +177 -0
- markrel-0.1.0/experiments/realworld_benchmark_results.json +95 -0
- markrel-0.1.0/experiments/run_msmarco_benchmark.py +387 -0
- markrel-0.1.0/experiments/run_wikiqa_1024dim_benchmark.py +341 -0
- markrel-0.1.0/experiments/run_wikiqa_bayesian_optimization.py +348 -0
- markrel-0.1.0/experiments/run_wikiqa_bayesian_precision.py +339 -0
- markrel-0.1.0/experiments/run_wikiqa_bayesian_recall.py +339 -0
- markrel-0.1.0/experiments/run_wikiqa_benchmark.py +200 -0
- markrel-0.1.0/experiments/run_wikiqa_better_embeddings.py +288 -0
- markrel-0.1.0/experiments/run_wikiqa_embedding_comparison.py +185 -0
- markrel-0.1.0/experiments/run_wikiqa_embeddings_benchmark.py +301 -0
- markrel-0.1.0/experiments/run_wikiqa_optimized.py +357 -0
- markrel-0.1.0/experiments/run_wikiqa_ranking_benchmark.py +360 -0
- markrel-0.1.0/experiments/run_wikiqa_rerank_benchmark.py +410 -0
- markrel-0.1.0/experiments/wikiqa_1024dim_benchmark_report.md +100 -0
- markrel-0.1.0/experiments/wikiqa_1024dim_benchmark_results.json +100 -0
- markrel-0.1.0/experiments/wikiqa_benchmark_report.md +45 -0
- markrel-0.1.0/experiments/wikiqa_benchmark_results.json +38 -0
- markrel-0.1.0/experiments/wikiqa_better_embeddings_results.json +22 -0
- markrel-0.1.0/experiments/wikiqa_embedding_comparison.json +44 -0
- markrel-0.1.0/experiments/wikiqa_embeddings_benchmark_report.md +62 -0
- markrel-0.1.0/experiments/wikiqa_embeddings_benchmark_results.json +54 -0
- markrel-0.1.0/experiments/wikiqa_optimization_results.json +34 -0
- markrel-0.1.0/experiments/wikiqa_ranking_benchmark_report.md +31 -0
- markrel-0.1.0/experiments/wikiqa_ranking_benchmark_results.json +32 -0
- markrel-0.1.0/experiments/wikiqa_rerank_benchmark_report.md +27 -0
- markrel-0.1.0/experiments/wikiqa_rerank_benchmark_results.json +35 -0
- markrel-0.1.0/markrel/__init__.py +62 -0
- markrel-0.1.0/markrel/__pycache__/__init__.cpython-38.pyc +0 -0
- markrel-0.1.0/markrel/__pycache__/model.cpython-38.pyc +0 -0
- markrel-0.1.0/markrel/__pycache__/similarity.cpython-38.pyc +0 -0
- markrel-0.1.0/markrel/__pycache__/states.cpython-38.pyc +0 -0
- markrel-0.1.0/markrel/__pycache__/transitions.cpython-38.pyc +0 -0
- markrel-0.1.0/markrel/__pycache__/vectorizer.cpython-38.pyc +0 -0
- markrel-0.1.0/markrel/model.py +322 -0
- markrel-0.1.0/markrel/similarity.py +137 -0
- markrel-0.1.0/markrel/states.py +202 -0
- markrel-0.1.0/markrel/transitions.py +209 -0
- markrel-0.1.0/markrel/vectorizer.py +105 -0
- markrel-0.1.0/markrel.egg-info/PKG-INFO +542 -0
- markrel-0.1.0/markrel.egg-info/SOURCES.txt +71 -0
- markrel-0.1.0/markrel.egg-info/dependency_links.txt +1 -0
- markrel-0.1.0/markrel.egg-info/requires.txt +8 -0
- markrel-0.1.0/markrel.egg-info/top_level.txt +1 -0
- markrel-0.1.0/pyproject.toml +69 -0
- markrel-0.1.0/setup.cfg +4 -0
- markrel-0.1.0/tests/__init__.py +1 -0
- markrel-0.1.0/tests/test_model.py +338 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master, main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ master, main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Lint with flake8
|
|
30
|
+
run: |
|
|
31
|
+
pip install flake8
|
|
32
|
+
flake8 markrel tests --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
33
|
+
|
|
34
|
+
- name: Run tests
|
|
35
|
+
run: |
|
|
36
|
+
pytest tests/ -v --cov=markrel --cov-report=xml
|
|
37
|
+
|
|
38
|
+
- name: Upload coverage to Codecov
|
|
39
|
+
uses: codecov/codecov-action@v3
|
|
40
|
+
with:
|
|
41
|
+
file: ./coverage.xml
|
|
42
|
+
fail_ci_if_error: false
|
|
43
|
+
|
|
44
|
+
build:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
needs: test
|
|
47
|
+
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
|
|
51
|
+
- name: Set up Python
|
|
52
|
+
uses: actions/setup-python@v5
|
|
53
|
+
with:
|
|
54
|
+
python-version: '3.10'
|
|
55
|
+
|
|
56
|
+
- name: Install build dependencies
|
|
57
|
+
run: |
|
|
58
|
+
python -m pip install --upgrade pip
|
|
59
|
+
pip install build twine
|
|
60
|
+
|
|
61
|
+
- name: Build package
|
|
62
|
+
run: |
|
|
63
|
+
python -m build
|
|
64
|
+
|
|
65
|
+
- name: Check package
|
|
66
|
+
run: |
|
|
67
|
+
twine check dist/*
|
|
68
|
+
|
|
69
|
+
- name: Upload artifact
|
|
70
|
+
uses: actions/upload-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: dist
|
|
73
|
+
path: dist/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Release to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.10'
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: |
|
|
25
|
+
python -m pip install --upgrade pip
|
|
26
|
+
pip install build
|
|
27
|
+
|
|
28
|
+
- name: Build package
|
|
29
|
+
run: |
|
|
30
|
+
python -m build
|
|
31
|
+
|
|
32
|
+
- name: Publish to PyPI
|
|
33
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
34
|
+
# Trusted publishing - no password needed
|
|
35
|
+
# Requires: https://pypi.org/manage/project/markrel/settings/publishing/
|
|
36
|
+
# Add GitHub Actions as a trusted publisher with:
|
|
37
|
+
# Owner: petabyte
|
|
38
|
+
# Repository: markrel
|
|
39
|
+
# Workflow: release.yml
|
|
40
|
+
|
|
41
|
+
- name: Create GitHub Release
|
|
42
|
+
uses: softprops/action-gh-release@v1
|
|
43
|
+
with:
|
|
44
|
+
files: |
|
|
45
|
+
dist/*
|
|
46
|
+
generate_release_notes: true
|
|
47
|
+
env:
|
|
48
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
markrel-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Unit test / coverage reports
|
|
34
|
+
htmlcov/
|
|
35
|
+
.tox/
|
|
36
|
+
.nox/
|
|
37
|
+
.coverage
|
|
38
|
+
.coverage.*
|
|
39
|
+
.cache
|
|
40
|
+
nosetests.xml
|
|
41
|
+
coverage.xml
|
|
42
|
+
*.cover
|
|
43
|
+
*.py,cover
|
|
44
|
+
.hypothesis/
|
|
45
|
+
.pytest_cache/
|
|
46
|
+
cover/
|
|
47
|
+
|
|
48
|
+
# Translations
|
|
49
|
+
*.mo
|
|
50
|
+
*.pot
|
|
51
|
+
|
|
52
|
+
# Django / Flask stuff:
|
|
53
|
+
instance/
|
|
54
|
+
.webassets-cache
|
|
55
|
+
|
|
56
|
+
# Scrapy stuff:
|
|
57
|
+
.scrapy
|
|
58
|
+
|
|
59
|
+
# Sphinx documentation
|
|
60
|
+
docs/_build/
|
|
61
|
+
|
|
62
|
+
# PyBuilder
|
|
63
|
+
.pybuilder/
|
|
64
|
+
target/
|
|
65
|
+
|
|
66
|
+
# Jupyter Notebook
|
|
67
|
+
.ipynb_checkpoints
|
|
68
|
+
|
|
69
|
+
# IPython
|
|
70
|
+
profile_default/
|
|
71
|
+
ipython_config.py
|
|
72
|
+
|
|
73
|
+
# pyenv
|
|
74
|
+
.python-version
|
|
75
|
+
|
|
76
|
+
# pipenv
|
|
77
|
+
Pipfile.lock
|
|
78
|
+
|
|
79
|
+
# poetry
|
|
80
|
+
poetry.lock
|
|
81
|
+
|
|
82
|
+
# pdm
|
|
83
|
+
.pdm.toml
|
|
84
|
+
|
|
85
|
+
# PEP 582
|
|
86
|
+
__pypackages__/
|
|
87
|
+
|
|
88
|
+
# Celery stuff
|
|
89
|
+
celerybeat-schedule
|
|
90
|
+
celerybeat.pid
|
|
91
|
+
|
|
92
|
+
# SageMath parsed files
|
|
93
|
+
*.sage.py
|
|
94
|
+
|
|
95
|
+
# Environments
|
|
96
|
+
.env
|
|
97
|
+
.venv
|
|
98
|
+
env/
|
|
99
|
+
venv/
|
|
100
|
+
ENV/
|
|
101
|
+
env.bak/
|
|
102
|
+
venv.bak/
|
|
103
|
+
|
|
104
|
+
# Spyder project settings
|
|
105
|
+
.spyderproject
|
|
106
|
+
.spyproject
|
|
107
|
+
|
|
108
|
+
# Rope project settings
|
|
109
|
+
.ropeproject
|
|
110
|
+
|
|
111
|
+
# mkdocs documentation
|
|
112
|
+
/site
|
|
113
|
+
|
|
114
|
+
# mypy
|
|
115
|
+
.mypy_cache/
|
|
116
|
+
.dmypy.json
|
|
117
|
+
dmypy.json
|
|
118
|
+
|
|
119
|
+
# Pyre type checker
|
|
120
|
+
.pyre/
|
|
121
|
+
|
|
122
|
+
# pytype static type analyzer
|
|
123
|
+
.pytype/
|
|
124
|
+
|
|
125
|
+
# Cython debug symbols
|
|
126
|
+
cython_debug/
|
|
127
|
+
|
|
128
|
+
# PyCharm
|
|
129
|
+
.idea/
|
|
130
|
+
|
|
131
|
+
# VS Code
|
|
132
|
+
.vscode/
|
|
133
|
+
|
|
134
|
+
# Data files (large)
|
|
135
|
+
data/wikiqa/*.txt
|
|
136
|
+
data/wikiqa/*.tsv
|
|
137
|
+
data/wikiqa/*.zip
|
|
138
|
+
|
|
139
|
+
# Experiment results (large)
|
|
140
|
+
experiments/*.pkl
|
|
141
|
+
experiments/*.json
|
|
142
|
+
|
|
143
|
+
# OS files
|
|
144
|
+
.DS_Store
|
|
145
|
+
Thumbs.db
|
|
146
|
+
|
|
147
|
+
# OpenClaw
|
|
148
|
+
.openclaw/
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Contributing to markrel ๐
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to markrel! We welcome contributions from the community.
|
|
4
|
+
|
|
5
|
+
## ๐ How to Contribute
|
|
6
|
+
|
|
7
|
+
### Reporting Bugs
|
|
8
|
+
|
|
9
|
+
If you find a bug, please open an issue with:
|
|
10
|
+
- A clear description of the problem
|
|
11
|
+
- Steps to reproduce
|
|
12
|
+
- Expected vs actual behavior
|
|
13
|
+
- Python version and markrel version
|
|
14
|
+
|
|
15
|
+
### Suggesting Features
|
|
16
|
+
|
|
17
|
+
We'd love to hear your ideas! Open an issue with:
|
|
18
|
+
- Feature description
|
|
19
|
+
- Use case
|
|
20
|
+
- Proposed API (if applicable)
|
|
21
|
+
|
|
22
|
+
### Pull Requests
|
|
23
|
+
|
|
24
|
+
1. Fork the repository
|
|
25
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
26
|
+
3. Make your changes
|
|
27
|
+
4. Run tests (`pytest tests/ -v`)
|
|
28
|
+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
29
|
+
6. Push to your branch (`git push origin feature/amazing-feature`)
|
|
30
|
+
7. Open a Pull Request
|
|
31
|
+
|
|
32
|
+
## ๐งช Development Setup
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
git clone https://github.com/yourusername/markrel.git
|
|
36
|
+
cd markrel
|
|
37
|
+
pip install -e ".[dev]"
|
|
38
|
+
pytest tests/ -v
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## ๐ Code Style
|
|
42
|
+
|
|
43
|
+
- Follow PEP 8
|
|
44
|
+
- Add type hints to new functions
|
|
45
|
+
- Write docstrings in Google style
|
|
46
|
+
- Keep functions focused and small
|
|
47
|
+
|
|
48
|
+
## ๐งช Testing
|
|
49
|
+
|
|
50
|
+
All contributions should include tests:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
def test_new_feature():
|
|
54
|
+
model = MarkovRelevanceModel()
|
|
55
|
+
# Your test here
|
|
56
|
+
assert result == expected
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Run tests before submitting:
|
|
60
|
+
```bash
|
|
61
|
+
pytest tests/ -v --cov=markrel
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## ๐ Thanks!
|
|
65
|
+
|
|
66
|
+
Every contribution helps make markrel better for everyone. Thank you for being part of the school! ๐๐๐
|
markrel-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 markrel contributors
|
|
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.
|