Code Monkey home page Code Monkey logo

tldr's Issues

multiple-value bag.Summarize() in single-value context

I ran into this issue when I used your code provided in README.md

package main

import (
	"fmt"
	"io/ioutil"
	"github.com/JesusIslam/tldr"
)

func main() {
	intoSentences := 3
	textB, _ := ioutil.ReadFile("./sample.txt")
	text := string(textB)
	bag := tldr.New()
	result := bag.Summarize(text, intoSentences)
	fmt.Println(result)
}

But in your code Summarize function returns two values, i.e. result and error.
For me modifying the line result := bag.Summarize(text, intoSentences) worked. Please check and modify README.md file.

Difference between createSentences and createOriginalSentences

Hi, I have a sentence tokenizer that I want to use instead of the one used in this package, but I'm a little confused as to what I need to replace to get it working properly.

It looks like createOriginalSentences returns []string whereas createSentences returns [][]string.

It'd be nice to have one function to replace the sentence tokenizer so anyone can swap it out.

Rank is empty on text with repeated sentences

Try to summarize next text
bag.Summarize("Hello, world. Hello, world. Hello, world.", 1)
and got error
Ranks is empty

I think the summarize function need return Hello, world.
Why this happens?

Empty TL;DR Results?

hi @JesusIslam, Not sure if you are still maintaining this library, but as I don't understand the algorithms used I wanted to ask you if you would have any insights as to why on some inputs (from RSS/Atom feeds) the result is an empty string?

My use-case here is to take RSS/Atom feeds, feed into this library to produce 1-2 sentences and use that as a "summary" with a "Read more" link.

Thanks :)

Error to summarizer

it's my code

package main

import (
    "fmt"
    "github.com/JesusIslam/tldr"
    "strings"
)

func main() {
    intoSentences := 3
    words := "loremdkasmsdma skdmlaskldmsla mdaskdlsamskdlasm..............tsk"
    leng := strings.Count(words, ".")
    if leng > 3 {
        bag := tldr.New()
        result := bag.Summarize(words, intoSentences)
        fmt.Println(result)
    }
}

when I run this code I get

panic: runtime error: slice bounds out of range

Strange check in summarize function

In function

func (bag *Bag) Summarize(text string, num int) (string, error)

checking number of sentences for output

if num > (len(bag.Ranks)-1) || num < 1 {
	num = 1
}

Why len(Ranks)-1?

May be need:

if num > len(bag.Ranks) || num < 1 {
	num = 1
}

?

Error on compilation

When running "go install" on the corresponding project, it reports this error:

./main.go:14: multiple-value bag.Summarize() in single-value context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.