Esempio n. 1
0
func ReadInputLayerAddrs(reader io.Reader) (InputLayerAddrs, error) {
	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanLines)

	ilas := make(InputLayerAddrs, 0)

	for scanner.Scan() {
		data := scanner.Bytes()

		if len(bytes.TrimSpace(data)) == 0 {
			continue
		}

		addrs, err := addr.ParseAddressedValueTemplates(data)
		if err != nil {
			return nil, err
		}

		if len(addrs) > 1 {
			return nil, fmt.Errorf("dparnn does not support/need feature products: %s", data)
		}

		ilas = append(ilas, addrs[0])
	}

	sort.Stable(ilas)

	return ilas, nil
}
Esempio n. 2
0
func parseAddressedValueGenerator(data []byte) (FeatureGenerator, error) {
	templates, err := addr.ParseAddressedValueTemplates(data)
	if err != nil {
		return nil, err
	}

	return NewAddressedValueGenerator(templates), nil
}