@@ -73,7 +73,7 @@ result = model["This laptop has amazing performance but terrible battery life!"]
7373
7474pp result
7575
76- # => {" sentiment"=> #<data Gliner::Label ...>}
76+ # => { sentiment: #<data Gliner::Label ...> }
7777
7878result[" sentiment" ].label
7979# => "negative"
@@ -88,15 +88,15 @@ Multiple classification tasks:
8888text = " Breaking: Tech giant announces major layoffs amid market downturn"
8989
9090tasks = {
91- " sentiment" => %w[positive negative neutral] ,
92- " urgency" => %w[high medium low] ,
93- " category" => { " labels" => %w[tech finance politics sports] , " multi_label" => false }
91+ sentiment: %w[positive negative neutral] ,
92+ urgency: %w[high medium low] ,
93+ category: { labels: %w[tech finance politics sports] , multi_label: false }
9494}
9595
9696results = Gliner .classify[tasks][text]
9797
9898results.transform_values { |value | value.label }
99- # => {" sentiment"=>" negative", " urgency"=>" high", " category"=>" tech"}
99+ # => { sentiment: " negative", urgency: " high", category: " tech" }
100100```
101101
102102### Structured extraction
@@ -128,15 +128,16 @@ product["processor"].text
128128# => "A17 Pro"
129129
130130product[" price" ].text
131- # => "$ 1199"
131+ # => "1199"
132132```
133133
134134Choices can be included in field specs:
135135
136136``` ruby
137137result = Gliner [{ order: [" status::[pending|processing|shipped]::str" ] }][" Status: shipped" ]
138138
139- # => {"order"=>[{"status"=>"shipped"}]}
139+ result.fetch(" order" ).first[" status" ].text
140+ # shipped
140141```
141142
142143## Model files
0 commit comments