diff options
Diffstat (limited to 'vendor/github.com/DavidBelicza/TextRank/v2/parse/text.go')
| -rw-r--r-- | vendor/github.com/DavidBelicza/TextRank/v2/parse/text.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/vendor/github.com/DavidBelicza/TextRank/v2/parse/text.go b/vendor/github.com/DavidBelicza/TextRank/v2/parse/text.go new file mode 100644 index 0000000..aab27c3 --- /dev/null +++ b/vendor/github.com/DavidBelicza/TextRank/v2/parse/text.go @@ -0,0 +1,44 @@ +package parse + +// Text struct contains a parsed text. +type Text struct { + parsedSentences []ParsedSentence +} + +// ParsedSentence struct contains the original raw sentences and their words. +type ParsedSentence struct { + original string + words []string +} + +// Append method creates a sentence and its words and append them to the Text +// object. +func (text *Text) Append(rawSentence string, words []string) { + if len(words) > 0 { + parsedSentence := ParsedSentence{ + original: rawSentence, + words: words, + } + + text.parsedSentences = append( + text.parsedSentences, + parsedSentence, + ) + } +} + +// GetSentences method returns ParsedSentence slice from Text struct. +func (text *Text) GetSentences() []ParsedSentence { + return text.parsedSentences +} + +// GetWords methods returns the words string slice of ParsedSentence struct. +func (parsedSentence *ParsedSentence) GetWords() []string { + return parsedSentence.words +} + +// GetOriginal method returns the original sentence as a string from a +// ParsedSentence struct. +func (parsedSentence *ParsedSentence) GetOriginal() string { + return parsedSentence.original +} |
