Documentation ¶
Overview ¶
Copyright 2016 by Leipzig University Library, http://ub.uni-leipzig.de The Finc Authors, http://finc.info Martin Czygan, <martin.czygan@uni-leipzig.de>
This file is part of some open source application.
Some open source application is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Some open source application is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
@license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
Index ¶
- Variables
- func DiscardRows(records [][]string) ([][]string, error)
- func GroupRewrite(r io.Reader, w io.Writer, attrFunc AttrFunc, rewriterFunc RewriterFunc) error
- func LastRow(records [][]string) ([][]string, error)
- func LexChoice(s []string) string
- type AttrFunc
- type ChoiceFunc
- type Preferences
- type RewriterFunc
Constants ¶
This section is empty.
Variables ¶
var ( // Verbose output. Verbose = true )
Functions ¶
func DiscardRows ¶ added in v0.0.8
Discard all rows.
func GroupRewrite ¶
GroupRewrite reads CSV records from a given reader, extracts attribute values with attrFunc, groups subsequent records with the same attribute value and passes these groups to a rewriter. The potentially modified records are written as CSV to the given writer.
Types ¶
type AttrFunc ¶
AttrFunc extracts an attribute value from a slice of strings (e.g. coming from a CSV file). Example values could be a single column, part of a column or a value spanning multiple columns.
func ColumnLower ¶ added in v0.0.10
ColumnLower returns an AttrFunc. Yields the lowercase value of a given column (zero-indexed), refs #12755.
type ChoiceFunc ¶
ChoiceFunc presented with a list of choices, chooses one.
func ListChooser ¶ added in v0.0.8
func ListChooser(prefs []string) ChoiceFunc
ListChooser takes a preference list (most preferred first) and returns a ChoiceFunc. It's a panic, if the given preference list is empty. If a set of options is given and preferences and options intersect, then the option with the highest preference is choosen. If preferences and options do not intersect, we randomly select an option.
type Preferences ¶ added in v0.0.8
type Preferences struct { Map map[string]ChoiceFunc Default ChoiceFunc }
Preferences groups many choices by key (e.g. ISIL). If there is no ChoiceFunc for a key, a default can be used.
type RewriterFunc ¶
RewriterFunc rewrites a list of records.
func SimpleRewriter ¶
func SimpleRewriter(preferences Preferences) RewriterFunc
SimpleRewriter takes a preference map (which key is interested in which group) and returns a rewriter, which drops certain keys that are assigned to records from multiple groups with the same attribute value. Note: This rewriter returns only differing records.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
groupindex
The groupindex tool can be applied to an intermediate schema or solr file, that is about to be indexed.
|
The groupindex tool can be applied to an intermediate schema or solr file, that is about to be indexed. |