jekyll-chatgpt-translate 0.0.36 → 0.0.37
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f1eb7be508b40853f8fc04d94cd0c6f30ddfe2be81b6d3fc7f6a45101d10b1
|
4
|
+
data.tar.gz: cb4d6e55f8d93e00307135f52cfba873a7ece62a01cb785f0d0e4ada293aaa20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 053d40f293680a7b4ec3f78f5b09b1ddef17183b1dbfce93ab10fffca3cbb1b1384644e4da3377c5c1abc0ff96fdb1b55d8f58d7e30788aa7ddeba44dc6e0d65
|
7
|
+
data.tar.gz: 0cc7dd560f374a400b8c8ff2b7782daca793a2db48eac1fc698806506f0341713751241a2feb739d485145efbe57ba6c5d2d43d188208fa0e8142993447a6928
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
29
29
|
s.required_ruby_version = '>= 2.6'
|
30
30
|
s.name = 'jekyll-chatgpt-translate'
|
31
|
-
s.version = '0.0.
|
31
|
+
s.version = '0.0.37'
|
32
32
|
s.license = 'MIT'
|
33
33
|
s.summary = 'Translate Jekyll Pages Through ChatGPT'
|
34
34
|
s.description = [
|
@@ -51,7 +51,7 @@ class GptTranslate::ChatGPT
|
|
51
51
|
@target = target
|
52
52
|
end
|
53
53
|
|
54
|
-
def translate(markdown, min: 32)
|
54
|
+
def translate(markdown, min: 32, window_length: 2000)
|
55
55
|
pars = GptTranslate::Pars.new(markdown).to_a
|
56
56
|
ready = []
|
57
57
|
later = []
|
@@ -82,17 +82,23 @@ class GptTranslate::ChatGPT
|
|
82
82
|
later[i] = par
|
83
83
|
end
|
84
84
|
end
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
out = []
|
86
|
+
i = 0
|
87
|
+
while i < pars.length
|
88
|
+
unless ready[i].nil?
|
89
|
+
out << ready[i]
|
90
|
+
i += 1
|
90
91
|
next
|
91
92
|
end
|
92
|
-
accum
|
93
|
+
accum = []
|
94
|
+
until later[i].nil?
|
95
|
+
accum << later[i]
|
96
|
+
break if accum.join.split.count > window_length
|
97
|
+
i += 1
|
98
|
+
end
|
99
|
+
out << translate_pars(accum)
|
93
100
|
end
|
94
|
-
|
95
|
-
ready.join("\n\n")
|
101
|
+
out.join("\n\n")
|
96
102
|
end
|
97
103
|
|
98
104
|
private
|
data/test/test_chatgpt.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-chatgpt-translate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: humanize
|