Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions internal/core/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,8 @@ func NewFile(src string, config *Config) (*File, error) {
return &file, nil
}

// Tokens returns the tagged tokens of text, tagging it only once per document
// however many rules ask for it.
func (f *File) Tokens(text string) []tag.Token {
toks, _ := f.TokensWith("", text)
return toks
}

// TokensWith is Tokens, read with the named tagger.
// TokensWith returns the tagged tokens of text, read with the named tagger,
// tagging it only once per document however many rules ask for it.
//
// Two models disagree about the same sentence -- that is why a rule names
// one -- so each is cached separately.
Expand Down
9 changes: 2 additions & 7 deletions internal/nlp/prose.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,8 @@ type TokenCache struct {
tagged map[string][]tag.Token
}

// Tokens returns the tagged tokens of text, tagging it only the first time.
func (c *TokenCache) Tokens(text string, info *Info) []tag.Token {
toks, _ := c.TokensWith("", text, info)
return toks
}

// TokensWith is Tokens, read with the named tagger.
// TokensWith returns the tagged tokens of text, read with the named tagger,
// tagging it only the first time.
func (c *TokenCache) TokensWith(model, text string, info *Info) ([]tag.Token, error) {
if c == nil {
return textToTokensWith(model, text, info)
Expand Down