coelacanth 0.5.0 → 0.5.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06a629b2865e5c4be5508a92637b2824bce0922b2de1209cee7c8f358ea8b438
4
- data.tar.gz: 43eac188f8c3d27e975753ff459c444d9ca49dc6e83aa8d067dca75b3223db87
3
+ metadata.gz: f6e9c7c1d9049b351076d0238e2b5747144b73244e3f0c37d2ce69fb625b823a
4
+ data.tar.gz: d5ef6a678e876b1fabfffd68426785ba6bb4174178e323adbe9593bf9c6ff57a
5
5
  SHA512:
6
- metadata.gz: 4dc3c36802dce0be0e9deb9debdeccb5840bafa44a2613e6a59a270242b16f7f977d44b66a1e47472b9edf5a2a4026d057ffc91a490a776118dd493490e5ca9f
7
- data.tar.gz: 3e558a85ab45b8f738be4c993413c279c7cb46bca7e44399e8fd40d1aa5e764b90865bbc51c7b38ad62be7501605e4f9d6edd3c0e8885ce8fe81830fda36d362
6
+ metadata.gz: 5f9c343b0ddb3a58a78af386715c8c99d905e2161905684438972fc177c8943d2c9a51ebadeffb9393162d83e914436ea134e5c78a3affe8db379f3a65fc3a65
7
+ data.tar.gz: cc6fda69757f79b5a53de36f0ead0315cf1598a4cc372f4e8d2c71cd021c1cf7370aacb583111cdaf0e5bcd711eb445c2d7c673705578217599bd94e7b1fc2ec
data/CHANGELOG.md CHANGED
@@ -4,9 +4,8 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [v0.5.0] - 2025-11-08
7
+ ## [v0.5.1] - 2025-11-08
8
8
  ### :sparkles: New Features
9
- - [`d34ef32`](https://github.com/slidict/coelacanth/commit/d34ef32dbb969f7ef86dce6cd587c44a848ee32d) - add YouTube preprocessing support *(commit by [@yubele](https://github.com/yubele))*
10
- - [`2a566ad`](https://github.com/slidict/coelacanth/commit/2a566adeaaa5b813fded4b9ebd8ce8d90d43ee7c) - add morphological analysis for body markdown *(commit by [@yubele](https://github.com/yubele))*
9
+ - [`726419e`](https://github.com/slidict/coelacanth/commit/726419e6b5fcb6b887d3881532328fdab25e3f0d) - expose standalone morphological analysis *(commit by [@yubele](https://github.com/yubele))*
11
10
 
12
- [v0.5.0]: https://github.com/slidict/coelacanth/compare/v0.4.3...v0.5.0
11
+ [v0.5.1]: https://github.com/slidict/coelacanth/compare/v0.5.0...v0.5.1
data/README.md CHANGED
@@ -82,6 +82,20 @@ result[:extraction] # => article metadata and body markdown
82
82
  result[:dom] # => Oga DOM representation for downstream processing
83
83
  result[:screenshot] # => PNG screenshot as a binary string
84
84
  result[:response] # => HTTP status, headers, and final URL
85
+
86
+ # Plain-text morphology
87
+
88
+ You can run the morphological analyzer without fetching a page by passing plain
89
+ text:
90
+
91
+ ```ruby
92
+ Coelacanth.morphological_analysis("これはテストです。 Testing morphology twice.")
93
+ # => [
94
+ # { token: "testing morphology twice", score: 1.23, count: 2 },
95
+ # { token: "テスト", score: 1.02, count: 1 },
96
+ # ...
97
+ # ]
98
+ ```
85
99
  ```
86
100
 
87
101
  The returned hash includes:
@@ -64,6 +64,10 @@ module Coelacanth
64
64
  @config = config
65
65
  end
66
66
 
67
+ def call_text(text, title: nil)
68
+ call(node: nil, title: title, markdown: text)
69
+ end
70
+
67
71
  def call(node:, title:, markdown:)
68
72
  stats = Hash.new do |hash, key|
69
73
  hash[key] = {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Coelacanth
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.1"
5
5
  end
data/lib/coelacanth.rb CHANGED
@@ -50,4 +50,10 @@ module Coelacanth
50
50
  def self.config
51
51
  @config ||= Configure.new
52
52
  end
53
+
54
+ def self.morphological_analysis(text, title: nil)
55
+ Extractor::MorphologicalAnalyzer
56
+ .new(config: config)
57
+ .call_text(text, title: title)
58
+ end
53
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coelacanth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke