Ethosoft-Math 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,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: Ethosoft-Math
3
+ Version: 0.1.0
4
+ Summary: Convert math solutions into verified tool-use traces (add(3, 4) -> 7) with an executable math tool protocol.
5
+ Author: Ethosoft
6
+ License: MIT
7
+ Keywords: math,tool-use,llm,dataset,reasoning,sympy,function-calling
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: sympy>=1.12
15
+ Provides-Extra: test
16
+ Requires-Dist: pytest; extra == "test"
17
+
18
+ # Ethosoft-Math
19
+
20
+ Matematik çözümlerindeki **her hesabı** doğrulanmış bir araç çağrısına (tool-use) çeviren kütüphane.
21
+ Turn math solutions into verified tool-use traces: `3 + 4 = 7` → `add(3, 4)` → `7`.
22
+
23
+ ```python
24
+ import ethosoft_math as em
25
+
26
+ em.convert("Toplam 3 + 4 = 7 elma.")
27
+ # 'Toplam <tool_call>add(3, 4)</tool_call><tool_result>7</tool_result> elma.'
28
+
29
+ em.execute('solve("x^2 - 4 = 0", "x")') # '[-2, 2]'
30
+ em.verify(em.convert(text)) # (cagri_sayisi, hatali_sayisi)
31
+ ```
32
+
33
+ ## Neden
34
+
35
+ LLM'e hesabı "kafadan" yaptırmak yerine aracı çağırtmak için eğitim verisi üretirsin.
36
+ Her çağrı, çevirme anında **yeniden çalıştırılıp doğrulanır**; tutmayan hiçbir şey çıktıya girmez.
37
+ Veride yanlış olan eşitlikler (`2 + 2 = 5`) olduğu gibi bırakılır.
38
+
39
+ ## Protokol
40
+
41
+ ```
42
+ <tool_call>FONKSIYON(arg1, arg2, ...)</tool_call><tool_result>SONUC</tool_result>
43
+ ```
44
+
45
+ - Operatörler: `+` add, `-` sub, `*` mul, `/` div, `^` pow, `!` fact, `√` sqrt
46
+ - Gruplar: aritmetik, yüzde, sayı teorisi, üs/log, trigonometri, geometri, olasılık/istatistik,
47
+ diziler (`sum_range`, `arith_sum`), cebir (`solve`, `expand`, `factor`, `equal`), analiz, lineer cebir,
48
+ fonksiyon tanımlama (`define`).
49
+ - Tam liste: `ethosoft-math protocol`
50
+
51
+ ## Komut satırı
52
+
53
+ ```bash
54
+ ethosoft-math exec "mul(add(3, 4), 2)"
55
+ ethosoft-math protocol > PROTOCOL.md
56
+ ethosoft-math convert in.jsonl out.jsonl --field solution
57
+ ```
58
+
59
+ ## Çalışma modları
60
+
61
+ | Mod | Ne yapar |
62
+ |---|---|
63
+ | `convert(text)` (varsayılan) | Yalnızca doğrulanabilen eşitlikleri, denklemleri, eşitsizlikleri, toplamları çevirir |
64
+ | `convert(text, aggressive=True)` | Ek olarak `=` içermeyen salt-sayısal işlemleri de çevirir (küçük ek kapsam, daha gürültülü) |
65
+
66
+ ## Sınırlar
67
+
68
+ - Python/PoT kodu içeren çözümlere dokunmaz.
69
+ - İspat ve sözel anlatım satırlarında çağrı üretilmez (hesap yoktur).
70
+ - Çeviri modelinden önce çalıştırılmalıdır; araç blokları çeviriden korunmalıdır.
71
+
72
+ Lisans: MIT
@@ -0,0 +1,55 @@
1
+ # Ethosoft-Math
2
+
3
+ Matematik çözümlerindeki **her hesabı** doğrulanmış bir araç çağrısına (tool-use) çeviren kütüphane.
4
+ Turn math solutions into verified tool-use traces: `3 + 4 = 7` → `add(3, 4)` → `7`.
5
+
6
+ ```python
7
+ import ethosoft_math as em
8
+
9
+ em.convert("Toplam 3 + 4 = 7 elma.")
10
+ # 'Toplam <tool_call>add(3, 4)</tool_call><tool_result>7</tool_result> elma.'
11
+
12
+ em.execute('solve("x^2 - 4 = 0", "x")') # '[-2, 2]'
13
+ em.verify(em.convert(text)) # (cagri_sayisi, hatali_sayisi)
14
+ ```
15
+
16
+ ## Neden
17
+
18
+ LLM'e hesabı "kafadan" yaptırmak yerine aracı çağırtmak için eğitim verisi üretirsin.
19
+ Her çağrı, çevirme anında **yeniden çalıştırılıp doğrulanır**; tutmayan hiçbir şey çıktıya girmez.
20
+ Veride yanlış olan eşitlikler (`2 + 2 = 5`) olduğu gibi bırakılır.
21
+
22
+ ## Protokol
23
+
24
+ ```
25
+ <tool_call>FONKSIYON(arg1, arg2, ...)</tool_call><tool_result>SONUC</tool_result>
26
+ ```
27
+
28
+ - Operatörler: `+` add, `-` sub, `*` mul, `/` div, `^` pow, `!` fact, `√` sqrt
29
+ - Gruplar: aritmetik, yüzde, sayı teorisi, üs/log, trigonometri, geometri, olasılık/istatistik,
30
+ diziler (`sum_range`, `arith_sum`), cebir (`solve`, `expand`, `factor`, `equal`), analiz, lineer cebir,
31
+ fonksiyon tanımlama (`define`).
32
+ - Tam liste: `ethosoft-math protocol`
33
+
34
+ ## Komut satırı
35
+
36
+ ```bash
37
+ ethosoft-math exec "mul(add(3, 4), 2)"
38
+ ethosoft-math protocol > PROTOCOL.md
39
+ ethosoft-math convert in.jsonl out.jsonl --field solution
40
+ ```
41
+
42
+ ## Çalışma modları
43
+
44
+ | Mod | Ne yapar |
45
+ |---|---|
46
+ | `convert(text)` (varsayılan) | Yalnızca doğrulanabilen eşitlikleri, denklemleri, eşitsizlikleri, toplamları çevirir |
47
+ | `convert(text, aggressive=True)` | Ek olarak `=` içermeyen salt-sayısal işlemleri de çevirir (küçük ek kapsam, daha gürültülü) |
48
+
49
+ ## Sınırlar
50
+
51
+ - Python/PoT kodu içeren çözümlere dokunmaz.
52
+ - İspat ve sözel anlatım satırlarında çağrı üretilmez (hesap yoktur).
53
+ - Çeviri modelinden önce çalıştırılmalıdır; araç blokları çeviriden korunmalıdır.
54
+
55
+ Lisans: MIT
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "Ethosoft-Math"
7
+ version = "0.1.0"
8
+ description = "Convert math solutions into verified tool-use traces (add(3, 4) -> 7) with an executable math tool protocol."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "Ethosoft" }]
13
+ keywords = ["math", "tool-use", "llm", "dataset", "reasoning", "sympy", "function-calling"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Intended Audience :: Science/Research",
18
+ "Topic :: Scientific/Engineering :: Mathematics",
19
+ ]
20
+ dependencies = ["sympy>=1.12"]
21
+
22
+ [project.optional-dependencies]
23
+ test = ["pytest"]
24
+
25
+ [project.scripts]
26
+ ethosoft-math = "ethosoft_math.cli:main"
27
+
28
+ [tool.setuptools.packages.find]
29
+ where = ["src"]
30
+
31
+ [tool.setuptools]
32
+ license-files = []
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: Ethosoft-Math
3
+ Version: 0.1.0
4
+ Summary: Convert math solutions into verified tool-use traces (add(3, 4) -> 7) with an executable math tool protocol.
5
+ Author: Ethosoft
6
+ License: MIT
7
+ Keywords: math,tool-use,llm,dataset,reasoning,sympy,function-calling
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: sympy>=1.12
15
+ Provides-Extra: test
16
+ Requires-Dist: pytest; extra == "test"
17
+
18
+ # Ethosoft-Math
19
+
20
+ Matematik çözümlerindeki **her hesabı** doğrulanmış bir araç çağrısına (tool-use) çeviren kütüphane.
21
+ Turn math solutions into verified tool-use traces: `3 + 4 = 7` → `add(3, 4)` → `7`.
22
+
23
+ ```python
24
+ import ethosoft_math as em
25
+
26
+ em.convert("Toplam 3 + 4 = 7 elma.")
27
+ # 'Toplam <tool_call>add(3, 4)</tool_call><tool_result>7</tool_result> elma.'
28
+
29
+ em.execute('solve("x^2 - 4 = 0", "x")') # '[-2, 2]'
30
+ em.verify(em.convert(text)) # (cagri_sayisi, hatali_sayisi)
31
+ ```
32
+
33
+ ## Neden
34
+
35
+ LLM'e hesabı "kafadan" yaptırmak yerine aracı çağırtmak için eğitim verisi üretirsin.
36
+ Her çağrı, çevirme anında **yeniden çalıştırılıp doğrulanır**; tutmayan hiçbir şey çıktıya girmez.
37
+ Veride yanlış olan eşitlikler (`2 + 2 = 5`) olduğu gibi bırakılır.
38
+
39
+ ## Protokol
40
+
41
+ ```
42
+ <tool_call>FONKSIYON(arg1, arg2, ...)</tool_call><tool_result>SONUC</tool_result>
43
+ ```
44
+
45
+ - Operatörler: `+` add, `-` sub, `*` mul, `/` div, `^` pow, `!` fact, `√` sqrt
46
+ - Gruplar: aritmetik, yüzde, sayı teorisi, üs/log, trigonometri, geometri, olasılık/istatistik,
47
+ diziler (`sum_range`, `arith_sum`), cebir (`solve`, `expand`, `factor`, `equal`), analiz, lineer cebir,
48
+ fonksiyon tanımlama (`define`).
49
+ - Tam liste: `ethosoft-math protocol`
50
+
51
+ ## Komut satırı
52
+
53
+ ```bash
54
+ ethosoft-math exec "mul(add(3, 4), 2)"
55
+ ethosoft-math protocol > PROTOCOL.md
56
+ ethosoft-math convert in.jsonl out.jsonl --field solution
57
+ ```
58
+
59
+ ## Çalışma modları
60
+
61
+ | Mod | Ne yapar |
62
+ |---|---|
63
+ | `convert(text)` (varsayılan) | Yalnızca doğrulanabilen eşitlikleri, denklemleri, eşitsizlikleri, toplamları çevirir |
64
+ | `convert(text, aggressive=True)` | Ek olarak `=` içermeyen salt-sayısal işlemleri de çevirir (küçük ek kapsam, daha gürültülü) |
65
+
66
+ ## Sınırlar
67
+
68
+ - Python/PoT kodu içeren çözümlere dokunmaz.
69
+ - İspat ve sözel anlatım satırlarında çağrı üretilmez (hesap yoktur).
70
+ - Çeviri modelinden önce çalıştırılmalıdır; araç blokları çeviriden korunmalıdır.
71
+
72
+ Lisans: MIT
@@ -0,0 +1,14 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/Ethosoft_Math.egg-info/PKG-INFO
4
+ src/Ethosoft_Math.egg-info/SOURCES.txt
5
+ src/Ethosoft_Math.egg-info/dependency_links.txt
6
+ src/Ethosoft_Math.egg-info/entry_points.txt
7
+ src/Ethosoft_Math.egg-info/requires.txt
8
+ src/Ethosoft_Math.egg-info/top_level.txt
9
+ src/ethosoft_math/__init__.py
10
+ src/ethosoft_math/__main__.py
11
+ src/ethosoft_math/cli.py
12
+ src/ethosoft_math/converter.py
13
+ src/ethosoft_math/protocol.py
14
+ tests/test_basic.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ethosoft-math = ethosoft_math.cli:main
@@ -0,0 +1,4 @@
1
+ sympy>=1.12
2
+
3
+ [test]
4
+ pytest
@@ -0,0 +1 @@
1
+ ethosoft_math
@@ -0,0 +1,30 @@
1
+ """Ethosoft-Math: matematik cozumlerini dogrulanmis tool-use izlerine ceviren kutuphane.
2
+
3
+ >>> import ethosoft_math as em
4
+ >>> em.convert("Toplam 3 + 4 = 7 elma.")
5
+ 'Toplam <tool_call>add(3, 4)</tool_call><tool_result>7</tool_result> elma.'
6
+ >>> em.execute("add(3, 4)")
7
+ '7'
8
+ """
9
+ from .protocol import ( # noqa: F401
10
+ CALL_OPEN, CALL_CLOSE, RES_OPEN, RES_CLOSE, REG, ToolError,
11
+ execute, parse_call, run, render_protocol_md,
12
+ )
13
+ from .converter import convert_text, verify_converted # noqa: F401
14
+
15
+ __version__ = "0.1.0"
16
+
17
+
18
+ def convert(text: str, aggressive: bool = False) -> str:
19
+ """Metindeki dogrulanabilir hesaplari arac cagrilarina cevirir; sadece metni dondurur."""
20
+ return convert_text(text, aggressive=aggressive)[0]
21
+
22
+
23
+ def verify(text: str):
24
+ """Metindeki her arac cagrisini yeniden calistirir; (toplam, hatali) dondurur."""
25
+ return verify_converted(text)
26
+
27
+
28
+ def functions():
29
+ """Protokoldeki fonksiyonlar: {ad: {cat, sig, doc}}"""
30
+ return {k: {"cat": v["cat"], "sig": v["sig"], "doc": v["doc"]} for k, v in REG.items()}
@@ -0,0 +1,3 @@
1
+ from .cli import main
2
+
3
+ main()
@@ -0,0 +1,56 @@
1
+ import argparse
2
+ import json
3
+ import sys
4
+
5
+ from . import __version__, convert_text, execute, render_protocol_md, verify_converted
6
+
7
+
8
+ def _convert_file(args):
9
+ n = n_conv = n_calls = n_bad = 0
10
+ with open(args.input, encoding="utf-8") as fin, open(args.output, "w", encoding="utf-8") as fout:
11
+ for line in fin:
12
+ line = line.strip()
13
+ if not line:
14
+ continue
15
+ row = json.loads(line)
16
+ text = row.get(args.field)
17
+ if isinstance(text, str):
18
+ out, _ = convert_text(text, aggressive=args.aggressive)
19
+ calls, bad = verify_converted(out)
20
+ row[args.out_field or args.field] = out
21
+ row["tool_calls"] = calls
22
+ n_calls += calls
23
+ n_bad += bad
24
+ n_conv += calls > 0
25
+ n += 1
26
+ fout.write(json.dumps(row, ensure_ascii=False) + "\n")
27
+ print(f"satir={n} aracli={n_conv} ({100 * n_conv / max(1, n):.1f}%) cagri={n_calls} hatali={n_bad}")
28
+
29
+
30
+ def main(argv=None):
31
+ ap = argparse.ArgumentParser(prog="ethosoft-math", description="Matematik tool-use protokolu")
32
+ ap.add_argument("--version", action="version", version=__version__)
33
+ sub = ap.add_subparsers(dest="cmd", required=True)
34
+
35
+ c = sub.add_parser("convert", help="jsonl dosyasindaki bir alani tool-use bicimine cevir")
36
+ c.add_argument("input")
37
+ c.add_argument("output")
38
+ c.add_argument("--field", default="solution")
39
+ c.add_argument("--out-field", default=None)
40
+ c.add_argument("--aggressive", action="store_true", help="'=' olmayan sayisal islemleri de cevir")
41
+ c.set_defaults(func=_convert_file)
42
+
43
+ p = sub.add_parser("protocol", help="protokol dokumanini yazdir (Markdown)")
44
+ p.set_defaults(func=lambda a: print(render_protocol_md()))
45
+
46
+ e = sub.add_parser("exec", help="tek bir arac cagrisini calistir, orn: add(3, 4)")
47
+ e.add_argument("call")
48
+ e.set_defaults(func=lambda a: print(execute(a.call)))
49
+
50
+ args = ap.parse_args(argv)
51
+ sys.stdout.reconfigure(encoding="utf-8")
52
+ args.func(args)
53
+
54
+
55
+ if __name__ == "__main__":
56
+ main()