<commit_before># go-summarizer
This is a Go library for summarizing text and websites and optionally saving the data to a local file

[![License MIT](https://img.shields.io/npm/l/express.svg)](http://opensource.org/licenses/MIT)

## Installing
    go get github.com/ktodorov/go-summarizer

## Creating Summarizer instance

### From text
    var unsummarizedText = "unsummarized text"
	var s = CreateFromText(unsummarizedText)

### From website url
    var urlToSummarize = "http://testurl.test/"
	var s = CreateFromURL(urlToSummarize)

## Supported methods
### Summarize
    var customNewsStoryURL = `https://techcrunch.com/2017/01/14/spacex-successfully-returns-to-launch-with-iridium-1-next-falcon-9-mission/`
	
    var s = CreateFromURL(customNewsStoryURL)
	summary, err := s.Summarize()
	if err != nil {
		fmt.Println("Error occured: ", err.Error())
        return
	}

	fmt.Println(summary)

Output:
>The launch also resulted in a successful recovery of the Falcon 9 rocket’s first stage, which marks the seventh time SpaceX has succeed in landing this stage back for potential later re-use
>SpaceX also had to push back its timelines for test launches of its Dragon crew capsule as a result of the September incident
>All satellites were successfully deployed as of 11:13 AM PT / 2:12 PM PT, signalling a successful mission for the space company’s first flight back.

### GetSummaryInfo
    var s = CreateFromText("test")
	s.Summarize()
	summaryInfo, err := s.GetSummaryInfo()
	if err != nil {
		fmt.Println("Error occured: ", err.Error())
	}

	fmt.Println(summaryInfo)

Output:
>Summary info:
> \- Original length: 4
> \- Summary length:  0
> \- Summary ratio:   100

### IsSummarized
    var s = CreateFromText("test")
	fmt.Println("Before summarizing: ", s.IsSummarized())
	s.Summarize()
	fmt.Println("After summarizing: ", s.IsSummarized())

Output:
> Before summarizing: false
> After summarizing: true

### StoreToFile
    var s = CreateFromText("test")
	s.Summarize()
	stored, err := s.StoreToFile("some/path/to/file.txt")
	if err != nil {
		fmt.Println("Error occured: ", err.Error())<commit_msg>Readme file fixes<commit_after># go-summarizer
This is a Go library for summarizing text and websites and optionally saving the data to a local file

[![License MIT](https://img.shields.io/npm/l/express.svg)](http://opensource.org/licenses/MIT)

## Installing
    go get github.com/ktodorov/go-summarizer

## Creating Summarizer instance

### From text
    var unsummarizedText = "unsummarized text"
	var s = CreateFromText(unsummarizedText)

### From website url
    var urlToSummarize = "http://testurl.test/"
	var s = CreateFromURL(urlToSummarize)

## Supported methods
### Summarize
    var customNewsStoryURL = `https://techcrunch.com/2017/01/14/spacex-successfully-returns-to-launch-with-iridium-1-next-falcon-9-mission/`
	
    var s = CreateFromURL(customNewsStoryURL)
	summary, err := s.Summarize()
	if err != nil {
		fmt.Println("Error occured: ", err.Error())
        return
	}

	fmt.Println(summary)

Output:
>The launch also resulted in a successful recovery of the Falcon 9 rocket’s first stage, which marks the seventh time SpaceX has succeed in landing this stage back for potential later re-use<br/>
>SpaceX also had to push back its timelines for test launches of its Dragon crew capsule as a result of the September incident<br/>
>All satellites were successfully deployed as of 11:13 AM PT / 2:12 PM PT, signalling a successful mission for the space company’s first flight back.<br/>

### GetSummaryInfo
    var s = CreateFromText("test")
	s.Summarize()
	summaryInfo, err := s.GetSummaryInfo()
	if err != nil {
		fmt.Println("Error occured: ", err.Error())
	}

	fmt.Println(summaryInfo)

Output:
>Summary info:<br/>
> \- Original length: 4<br/>
> \- Summary length:  0<br/>
> \- Summary ratio:   100<br/>

### IsSummarized
    var s = CreateFromText("test")
	fmt.Println("Before summarizing: ", s.IsSummarized())
	s.Summarize()
	fmt.Println("After summarizing: ", s.IsSummarized())

Output:
> Before summarizing: false<br/>
> After summarizing: true<br/>

### StoreToFile
    var s = CreateFromText("test")
	s.Summarize()
	stored, err := s.StoreToFile("some/path/to/file.txt")
	if err != nil {
		fmt.Println("Error occured: ", err.Error())
{'fraction_non_alphanumeric': 0.12256854933208343, 'fraction_numerical': 0.010780407780642137, 'mean_word_length': 4.21760391198044, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 30, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6731770', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1361, 'n_words': 415}