ruby-spacy 0.6.0 → 0.8.0

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +75 -92
  3. data/Gemfile +7 -0
  4. data/README.md +68 -15
  5. data/Rakefile +6 -0
  6. data/docs/syntax_trees.md +59 -0
  7. data/examples/llm/anthropic_chat.rb +1 -1
  8. data/examples/openai_integration/openai_completion.rb +2 -3
  9. data/examples/openai_integration/openai_query_1.rb +2 -3
  10. data/examples/openai_integration/openai_query_2.rb +2 -3
  11. data/examples/openai_integration/openai_query_3.rb +2 -3
  12. data/examples/openai_integration/openai_query_4.rb +2 -3
  13. data/examples/rsyntaxtree/outputs/tree_ar_projection.png +0 -0
  14. data/examples/rsyntaxtree/outputs/tree_de_projection.png +0 -0
  15. data/examples/rsyntaxtree/outputs/tree_en_chunks.png +0 -0
  16. data/examples/rsyntaxtree/outputs/tree_en_morphology.png +0 -0
  17. data/examples/rsyntaxtree/outputs/tree_en_path.png +0 -0
  18. data/examples/rsyntaxtree/outputs/tree_en_projection.png +0 -0
  19. data/examples/rsyntaxtree/outputs/tree_ja_chunks.png +0 -0
  20. data/examples/rsyntaxtree/outputs/tree_ja_projection.png +0 -0
  21. data/examples/rsyntaxtree/outputs/tree_ru_morphology.png +0 -0
  22. data/examples/rsyntaxtree/outputs/tree_ru_projection.png +0 -0
  23. data/examples/rsyntaxtree/outputs/tree_zh_projection.png +0 -0
  24. data/examples/rsyntaxtree/syntax_tree_ar.rb +36 -0
  25. data/examples/rsyntaxtree/syntax_tree_de.rb +19 -0
  26. data/examples/rsyntaxtree/syntax_tree_en.rb +30 -0
  27. data/examples/rsyntaxtree/syntax_tree_ja.rb +21 -0
  28. data/examples/rsyntaxtree/syntax_tree_ru.rb +23 -0
  29. data/examples/rsyntaxtree/syntax_tree_zh.rb +21 -0
  30. data/lib/ruby-spacy/anthropic_client.rb +8 -7
  31. data/lib/ruby-spacy/anthropic_helper.rb +15 -7
  32. data/lib/ruby-spacy/llm_client_base.rb +69 -12
  33. data/lib/ruby-spacy/openai_client.rb +27 -16
  34. data/lib/ruby-spacy/openai_helper.rb +12 -7
  35. data/lib/ruby-spacy/syntax_tree.rb +349 -0
  36. data/lib/ruby-spacy/version.rb +1 -1
  37. data/lib/ruby-spacy.rb +138 -34
  38. data/ruby-spacy.gemspec +8 -1
  39. metadata +24 -4
  40. data/.github/FUNDING.yml +0 -6
  41. data/.github/workflows/ci.yml +0 -74
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-spacy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoichiro Hasebe
@@ -159,8 +159,6 @@ executables: []
159
159
  extensions: []
160
160
  extra_rdoc_files: []
161
161
  files:
162
- - ".github/FUNDING.yml"
163
- - ".github/workflows/ci.yml"
164
162
  - ".gitignore"
165
163
  - CHANGELOG.md
166
164
  - Gemfile
@@ -169,6 +167,7 @@ files:
169
167
  - Rakefile
170
168
  - bin/console
171
169
  - bin/setup
170
+ - docs/syntax_trees.md
172
171
  - examples/get_started/lexeme.rb
173
172
  - examples/get_started/linguistic_annotations.rb
174
173
  - examples/get_started/morphology.rb
@@ -230,6 +229,23 @@ files:
230
229
  - examples/openai_integration/openai_query_2.rb
231
230
  - examples/openai_integration/openai_query_3.rb
232
231
  - examples/openai_integration/openai_query_4.rb
232
+ - examples/rsyntaxtree/outputs/tree_ar_projection.png
233
+ - examples/rsyntaxtree/outputs/tree_de_projection.png
234
+ - examples/rsyntaxtree/outputs/tree_en_chunks.png
235
+ - examples/rsyntaxtree/outputs/tree_en_morphology.png
236
+ - examples/rsyntaxtree/outputs/tree_en_path.png
237
+ - examples/rsyntaxtree/outputs/tree_en_projection.png
238
+ - examples/rsyntaxtree/outputs/tree_ja_chunks.png
239
+ - examples/rsyntaxtree/outputs/tree_ja_projection.png
240
+ - examples/rsyntaxtree/outputs/tree_ru_morphology.png
241
+ - examples/rsyntaxtree/outputs/tree_ru_projection.png
242
+ - examples/rsyntaxtree/outputs/tree_zh_projection.png
243
+ - examples/rsyntaxtree/syntax_tree_ar.rb
244
+ - examples/rsyntaxtree/syntax_tree_de.rb
245
+ - examples/rsyntaxtree/syntax_tree_en.rb
246
+ - examples/rsyntaxtree/syntax_tree_ja.rb
247
+ - examples/rsyntaxtree/syntax_tree_ru.rb
248
+ - examples/rsyntaxtree/syntax_tree_zh.rb
233
249
  - examples/rule_based_matching/creating_spans_from_matches.rb
234
250
  - examples/rule_based_matching/matcher.rb
235
251
  - lib/ruby-spacy.rb
@@ -238,12 +254,16 @@ files:
238
254
  - lib/ruby-spacy/llm_client_base.rb
239
255
  - lib/ruby-spacy/openai_client.rb
240
256
  - lib/ruby-spacy/openai_helper.rb
257
+ - lib/ruby-spacy/syntax_tree.rb
241
258
  - lib/ruby-spacy/version.rb
242
259
  - ruby-spacy.gemspec
243
260
  homepage: https://github.com/yohasebe/ruby-spacy
244
261
  licenses:
245
262
  - MIT
246
- metadata: {}
263
+ metadata:
264
+ source_code_uri: https://github.com/yohasebe/ruby-spacy
265
+ changelog_uri: https://github.com/yohasebe/ruby-spacy/blob/main/CHANGELOG.md
266
+ rubygems_mfa_required: 'true'
247
267
  rdoc_options: []
248
268
  require_paths:
249
269
  - lib
data/.github/FUNDING.yml DELETED
@@ -1,6 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: [yohasebe]
4
- ko_fi: yohasebe
5
- buy_me_a_coffee: yohasebe
6
- # custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -1,74 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- # Every branch, so that work in progress is tested before a pull request exists
5
- push:
6
- branches: ["**"]
7
- pull_request:
8
- # Weekly run to detect breakage from new spaCy / PyCall / Ruby releases
9
- # even when the repository itself is untouched
10
- schedule:
11
- - cron: "23 3 * * 2"
12
-
13
- jobs:
14
- test:
15
- name: ruby ${{ matrix.ruby }} / python ${{ matrix.python }}
16
- runs-on: ubuntu-latest
17
- # Pull requests from this repository are already covered by the push event;
18
- # only run the pull_request event for forks, to avoid duplicate matrices
19
- if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
20
- # This project has known hang paths (pipeline calls from non-main threads,
21
- # spacy.load hangs that Ruby's Timeout cannot interrupt); never let a job
22
- # run until GitHub's 6-hour limit
23
- timeout-minutes: 30
24
- continue-on-error: ${{ matrix.experimental == true }}
25
- strategy:
26
- fail-fast: false
27
- matrix:
28
- ruby: ["3.2", "3.3", "3.4", "4.0"]
29
- python: ["3.11", "3.12", "3.13", "3.14"]
30
- include:
31
- # Ruby 4.1 is not released yet; track the development branch instead
32
- - { ruby: head, python: "3.13", experimental: true }
33
- env:
34
- # PyCall locates the Python interpreter via this variable
35
- PYTHON: python
36
- steps:
37
- - uses: actions/checkout@v7
38
-
39
- # Must precede ruby/setup-ruby: installing the pycall gem compiles its
40
- # native extension against this Python
41
- - uses: actions/setup-python@v7
42
- with:
43
- python-version: ${{ matrix.python }}
44
-
45
- - uses: ruby/setup-ruby@v1
46
- with:
47
- ruby-version: ${{ matrix.ruby }}
48
- bundler-cache: true
49
-
50
- - id: site-packages
51
- run: echo "path=$(python -c 'import site; print(site.getsitepackages()[0])')" >> "$GITHUB_OUTPUT"
52
-
53
- # Cache the language models only (en_core_web_lg alone is several hundred
54
- # MB). spaCy itself is intentionally installed fresh on every run so that
55
- # new releases are exercised immediately. Bump the key suffix when
56
- # upgrading the models.
57
- - uses: actions/cache@v6
58
- with:
59
- path: |
60
- ${{ steps.site-packages.outputs.path }}/en_core_web_sm*
61
- ${{ steps.site-packages.outputs.path }}/en_core_web_lg*
62
- key: spacy-models-${{ matrix.python }}-v1
63
-
64
- # en_core_web_lg is large; install it only on representative jobs.
65
- # Tests that need it are skipped automatically where it is absent.
66
- - name: Install spaCy and language models
67
- run: |
68
- python -m pip install --upgrade pip
69
- python -m pip install --upgrade spacy
70
- python -m spacy download en_core_web_sm
71
- if [ "${{ matrix.python }}" = "3.13" ]; then python -m spacy download en_core_web_lg; fi
72
-
73
- - name: Run tests
74
- run: bundle exec rake test