calmlens 0.29.0 → 0.29.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 +4 -4
- data/lib/calmlens/text.rb +7 -5
- data/lib/calmlens/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55a4f4ba7407405cbfa72162ffac349011ffa9e3ebb645fc0bd70b32acf60489
|
|
4
|
+
data.tar.gz: 8d452e156dd1ef001bf49b677e10d72a61aa432fdc7e34756365c6bb417f2706
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d2814a8f159bade80c35c1bd5e07434622433d62b754c1ca22c08e7537407a966d897d145e01a61dd0722849c08e6723f793dbaea9ec5c5965129873bd36f7a
|
|
7
|
+
data.tar.gz: afc26fe093df1ede24bf413a83db6ce97217b68b93ac681b3fb3301b498db6100666a6cad5236d38bb26cb0687a97ed13364c8be8841574cead4e67d01907904
|
data/lib/calmlens/text.rb
CHANGED
|
@@ -20,12 +20,14 @@ module CalmLens
|
|
|
20
20
|
# @return [Asset] show it to everyone only when `classification.moderation.decision` is
|
|
21
21
|
# `allowed` or `limited` (reduce the reach of `limited` content).
|
|
22
22
|
def classify(**options)
|
|
23
|
-
call
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
# Within this call, assets.classify's requests report the text.classify operation.
|
|
24
|
+
call(options, __method__) do
|
|
25
|
+
text = options[:text]
|
|
26
|
+
raise Internal.invalid('Text to classify must be a non-empty string') unless text.is_a?(String) && !text.strip.empty?
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
@assets.classify(**options.except(:text), name: options.fetch(:name, 'text'),
|
|
29
|
+
content: { plain_text: text, type: 'text/plain' })
|
|
30
|
+
end
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
end
|
data/lib/calmlens/version.rb
CHANGED