# Choices

> TextChoose(texts, choices, ..) scores each item's legal choices, one byte each, through one forward, and answers a TapeView of one float32 probability per choice that sums to one per item.

`import "github.com/unum-cloud/uform"` 4.0.0-rc.1 · c58749fe

`TextChoose(texts, choices, ..)` scores each item’s legal choices, one byte each, through one forward, and answers a `TapeView` of one `float32` probability per choice that sums to one per item:

```go
config := &uform.TextChooseConfig{TemperatureGroups: []uint32{0, 1}}
probabilities, err := model.TextChoose(uform.TapeOf([]string{"keep this candidate?", "expand which neighbour?"}),
	uform.TapeOf([]string{"yn", "ABCD"}), arena, config)
expand, err := uform.TapeEntry[float32](probabilities, 1) // the probabilities of 'A' through 'D'
```

Each group is a question type below the model’s `ChoiceTemperatureGroups`, and a model without the byte decoder answers `StatusUnsupported`.

## API

### Types

#### `Choices`

Choices is the calibrated choices term over the byte decoder; a zero Weight trains none.

[types.go:307 ↗](https://github.com/unum-cloud/UForm/blob/c58749fe4bb208356cc78a87357ab007041c515b/types.go#L307)

```go
type Choices struct {
    Weight      float32
    BrierWeight float32
}
```

Mirrors uform_choices_t field for field.

#### `TextChooseConfig`

TextChooseConfig holds the knobs of TextChoose; nil derives every field.

[types.go:174 ↗](https://github.com/unum-cloud/UForm/blob/c58749fe4bb208356cc78a87357ab007041c515b/types.go#L174)

```go
type TextChooseConfig struct {
    TemperatureGroups []uint32
    Progress ProgressCallback
    ProgressSteps uint
    Stats *TextEncodeStats
}
```

Mirrors the knobs of uform_text_choose_t.

#### Fields

| `TemperatureGroups` | `[]uint32` | TemperatureGroups holds the question type of each item, below the model's ChoiceTemperatureGroups; empty puts every item in group zero. |
| - | - | - |
| `Progress` | `ProgressCallback` | Progress hears the items scored and may stop the call. |
| `ProgressSteps` | `uint` | ProgressSteps is the reports the call makes at most; zero derives ten. |
| `Stats` | `*TextEncodeStats` | Stats is the report the call overwrites, kept by the caller until it is final; nil skips it. |
