simple_inline_text_annotation 1.1.1 → 2.0.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/lib/simple_inline_text_annotation/denotation.rb +2 -2
- data/lib/simple_inline_text_annotation/entity_type_collection.rb +3 -3
- data/lib/simple_inline_text_annotation/generator_error.rb +1 -1
- data/lib/simple_inline_text_annotation/parser.rb +1 -1
- data/lib/simple_inline_text_annotation/version.rb +1 -1
- data/lib/simple_inline_text_annotation.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d8d14f48a850c835dbf62083dcda9ea3f2588e7f2544cacf3125e54481fca37
|
4
|
+
data.tar.gz: 50ebe7c23e5d841697f455586c9ed031d7df4d0da8e625630872948506145b2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99e205823a643812b22d835d9b9eae0041e320430b07175ab95a8b87cfb6287d37c749b18eac48beada081c39bb89a3aa16179cbb930e1ef4b426ce5b4ed0334
|
7
|
+
data.tar.gz: ccd90e14e4b0247428bc271e1663c995126f7361c60c59dfa6a2805fe3d255ef82b73f02ca19ed4beefe0486f3075697a96e389a7577b454d29bdbf19bbe6488
|
data/.rubocop.yml
CHANGED
@@ -15,11 +15,11 @@ class SimpleInlineTextAnnotation
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def span
|
18
|
-
{ begin
|
18
|
+
{ "begin" => @begin_pos, "end" => @end_pos }
|
19
19
|
end
|
20
20
|
|
21
21
|
def to_h
|
22
|
-
{ id
|
22
|
+
{ "id" => @id, "span" => span, "obj" => @obj }.compact
|
23
23
|
end
|
24
24
|
|
25
25
|
def nested_within?(other)
|
@@ -20,12 +20,12 @@ class SimpleInlineTextAnnotation
|
|
20
20
|
# to_config returns a Array of hashes of each entity type.
|
21
21
|
# Example:
|
22
22
|
# [
|
23
|
-
# {id
|
24
|
-
# {id
|
23
|
+
# {"id" => "https://example.com/Person", "label" => "Person"},
|
24
|
+
# {"id" => "https://example.com/Organization", "label" => "Organization"}
|
25
25
|
# ]
|
26
26
|
def to_config
|
27
27
|
entity_types.map do |label, id|
|
28
|
-
{ id
|
28
|
+
{ "id" => id, "label" => label }
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -89,7 +89,7 @@ class SimpleInlineTextAnnotation
|
|
89
89
|
subj, label, pred, obj2 = annotations
|
90
90
|
obj = get_obj_for(label)
|
91
91
|
@denotations << Denotation.new(begin_pos, end_pos, obj, subj)
|
92
|
-
@relations << { pred
|
92
|
+
@relations << { "pred" => pred, "subj" => subj, "obj" => obj2 }
|
93
93
|
end
|
94
94
|
end
|
95
95
|
end
|
@@ -38,10 +38,10 @@ class SimpleInlineTextAnnotation
|
|
38
38
|
|
39
39
|
def to_h
|
40
40
|
{
|
41
|
-
text
|
42
|
-
denotations
|
43
|
-
relations
|
44
|
-
config
|
41
|
+
"text" => format_text(@text),
|
42
|
+
"denotations" => @denotations.map(&:to_h),
|
43
|
+
"relations" => @relations.empty? ? nil : @relations,
|
44
|
+
"config" => config
|
45
45
|
}.compact
|
46
46
|
end
|
47
47
|
|
@@ -68,6 +68,6 @@ class SimpleInlineTextAnnotation
|
|
68
68
|
def config
|
69
69
|
return nil unless @entity_type_collection.any?
|
70
70
|
|
71
|
-
{ "entity types"
|
71
|
+
{ "entity types" => @entity_type_collection.to_config }
|
72
72
|
end
|
73
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_inline_text_annotation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xaiBUh29wX
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem provides inline text annotation functionality, extracted from
|
14
14
|
PubAnnotation, with support for denotations, entity types, and nested spans.
|