Beispiel #1
0
func (d *Document) Pretty(titleLimit int) string {
	title := utf8string.NewString(d.Title)
	length := min(titleLimit, title.RuneCount())
	format := fmt.Sprintf("Doc:%%%ds (%%d,%%d)", titleLimit)
	return fmt.Sprintf(format, title.Slice(0, length), d.Id.Doctype, d.Id.Docid)
}
Beispiel #2
0
func (d *Document) NormalisedText() *utf8string.String {
	if d.normalisedText == nil {
		d.normalisedText = utf8string.NewString(strings.Map(normaliseRune, d.Text))
	}
	return d.normalisedText
}