Skip to content

Commit 2fc0805

Browse files
committed
Update README
1 parent 4030162 commit 2fc0805

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ result = model["This laptop has amazing performance but terrible battery life!"]
7373

7474
pp result
7575

76-
# => {"sentiment"=>#<data Gliner::Label ...>}
76+
# => { sentiment: #<data Gliner::Label ...> }
7777

7878
result["sentiment"].label
7979
# => "negative"
@@ -88,15 +88,15 @@ Multiple classification tasks:
8888
text = "Breaking: Tech giant announces major layoffs amid market downturn"
8989

9090
tasks = {
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

9696
results = Gliner.classify[tasks][text]
9797

9898
results.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

130130
product["price"].text
131-
# => "$1199"
131+
# => "1199"
132132
```
133133

134134
Choices can be included in field specs:
135135

136136
```ruby
137137
result = 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

Comments
 (0)