diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-10-25 00:47:47 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2024-10-25 00:47:47 +0200 |
| commit | c6cc0108ca7738023b45e0eeac0fa2390532dd93 (patch) | |
| tree | 36890e6cd3091bbab8efbe686cc56f467f645bfd /vendor/github.com/DavidBelicza/TextRank/v2/parse/text.go | |
| parent | 0130404a1dc663d4aa68d780c9bcb23a4243e68d (diff) | |
| download | jbmafp-c6cc0108ca7738023b45e0eeac0fa2390532dd93.tar.gz | |
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 +} |
