func NewValidator(r io.Reader) (*Validator, error) {
	if r == nil {
		return nil, errors.New("reader required to initialize word validator from")
	}
	v := make(Validator)
	scanner := bufio.NewScanner(r)
	scanner.Split(bufio.ScanWords)
	for scanner.Scan() {
		rawWord := scanner.Text()
		v[rawWord] = struct{}{}
	}
	if err := scanner.Err(); err != nil {
		return nil, err
	}
	for w := range v {
		for _, r := range w {
			if !unicode.IsLower(r) {
				return nil, errors.New("wanted only lower case words, got " + w)
			}
		}
	}
	return &v, nil
}
// NewValidator consumes the lower case words in the reader to use for validating.
NewValidator consumes the lower case words in the reader to use for validating.
// NewValidator consumes the lower case words in the reader to use for validating .
func NewValidator(r io.Reader) (*Validator, error) {
	if r == nil {
		return nil, errors.New("reader required to initialize word validator from")
	}
	v := make(Validator)
	scanner := bufio.NewScanner(r)
	scanner.Split(bufio.ScanWords)
	for scanner.Scan() {
		rawWord := scanner.Text()
		v[rawWord] = struct{}{}
	}
	if err := scanner.Err(); err != nil {
		return nil, err
	}
	for w := range v {
		for _, r := range w {
			if !unicode.IsLower(r) {
				return nil, errors.New("wanted only lower case words, got " + w)
			}
		}
	}
	return &v, nil
}
func NewValidator ( r io . Reader ) ( * Validator , error ) { if r == nil { return nil , errors . New ( " " ) } v := make ( Validator ) scanner := bufio . NewScanner ( r ) scanner . Split ( bufio . ScanWords ) for scanner . Scan ( ) { rawWord := scanner . Text ( ) v [ rawWord ] = struct { } { } } if err := scanner . Err ( ) ; err != nil { return nil , err } for w := range v { for _ , r := range w { if ! unicode . IsLower ( r ) { return nil , errors . New ( " " + w ) } } } return & v , nil }
NewValidator consumes the lower case words in the reader to use for validating.
NewValidator consumes the lower case words in the reader to use for validating .