<commit_before>package ai

import (
	"log"
	"reflect"
	"strconv"
	"strings"
	"time"

	"github.com/hysios/apiai-go"
)

type ApiAiOrder struct {
	AiResult apiai.Result
}

func (aa ApiAiOrder) Score() float64 {
	return aa.AiResult.Score
}

func (aa ApiAiOrder) Query() string {
	return aa.AiResult.ResolvedQuery
}

func (aa ApiAiOrder) Items() []Item {
	products := aa.Products()
	quantities := aa.Quantities()

	for i, q := range quantities {
		if len(products) >= i+1 {
			products[i].Quantity = q.Quantity
		}
	}

	return products
}

func (aa ApiAiOrder) Products() []Item {
	return aa.ExtractProducts("products")
}

func (aa ApiAiOrder) Quantities() []Item {
	return aa.ExtractQuantities("quantity")
}

func (aa ApiAiOrder) GiftItems() []Item {
	gifts := aa.GiftProducts()
	quantities := aa.GiftQuantities()

	for i, q := range quantities {
		if len(gifts) >= i+1 {
			gifts[i].Quantity = q.Quantity
		}
	}

	return gifts
}

func (aa ApiAiOrder) GiftProducts() []Item {
	return aa.ExtractProducts("gifts")
}

func (aa ApiAiOrder) GiftQuantities() []Item {
	return aa.ExtractQuantities("giftNumber")
}

func (aa ApiAiOrder) Address() string {<commit_msg>fix product unit<commit_after>package ai

import (
	"log"
	"reflect"
	"strconv"
	"strings"
	"time"

	"github.com/hysios/apiai-go"
)

type ApiAiOrder struct {
	AiResult apiai.Result
}

func (aa ApiAiOrder) Score() float64 {
	return aa.AiResult.Score
}

func (aa ApiAiOrder) Query() string {
	return aa.AiResult.ResolvedQuery
}

func (aa ApiAiOrder) Items() []Item {
	products := aa.Products()
	quantities := aa.Quantities()

	for i, q := range quantities {
		if len(products) >= i+1 {
			products[i].Quantity = q.Quantity
			products[i].Unit = q.Unit
		}
	}

	return products
}

func (aa ApiAiOrder) Products() []Item {
	return aa.ExtractProducts("products")
}

func (aa ApiAiOrder) Quantities() []Item {
	return aa.ExtractQuantities("quantity")
}

func (aa ApiAiOrder) GiftItems() []Item {
	gifts := aa.GiftProducts()
	quantities := aa.GiftQuantities()

	for i, q := range quantities {
		if len(gifts) >= i+1 {
			gifts[i].Quantity = q.Quantity
			products[i].Unit = q.Unit
		}
	}

	return gifts
}

func (aa ApiAiOrder) GiftProducts() []Item {
	return aa.ExtractProducts("gifts")
}

func (aa ApiAiOrder) GiftQuantities() []Item {
	return aa.ExtractQuantities("giftNumber")
}

func (aa ApiAiOrder) Address() string {
{'fraction_non_alphanumeric': 0.14520894892359645, 'fraction_numerical': 0.0033769523005487546, 'mean_word_length': 4.278396436525613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4194594', 'n_tokens_mistral': 965, 'n_tokens_neox': 912, 'n_words': 212}