Skip to content

Commit

Permalink
Release v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Mar 1, 2022
1 parent 6faf659 commit 82570ef
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.2] - 2022-03-01
### Fixed
- Fix a bug where a single line would cause a panic

## [0.1.1] - 2022-02-09
### Fixed
- Don't consider empty files to have any lines
Expand Down Expand Up @@ -39,7 +43,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- First functional version

[Unreleased]: https://github.com/SmartBear/lhdiff/compare/v0.1.1...HEAD
[Unreleased]: https://github.com/SmartBear/lhdiff/compare/v0.1.2...HEAD
[0.1.2]: https://github.com/SmartBear/lhdiff/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/SmartBear/lhdiff/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/SmartBear/lhdiff/compare/v0.0.5...v0.1.0
[0.0.5]: https://github.com/SmartBear/lhdiff/compare/v0.0.4...v0.0.5
Expand Down
27 changes: 27 additions & 0 deletions lhdiff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,33 @@ four`
// 3,3
}

func ExampleLhdiff_oneDifferentLineWithNewLine() {
left := "a\n"
right := "b\n"
mappings, err := Lhdiff(left, right, 4, true)
printErr(err)
err = PrintMappings(mappings)
printErr(err)

// Output:
// 1,_
// 2,2
// _,1
}

func ExampleLhdiff_oneModifiedLineWithNewLine() {
left := "a b c d\n"
right := "a b c d e\n"
mappings, err := Lhdiff(left, right, 4, true)
printErr(err)
err = PrintMappings(mappings)
printErr(err)

// Output:
// 1,1
// 2,2
}

func ExampleLhdiff_withEmptyLeft() {
right := `one
two
Expand Down
3 changes: 3 additions & 0 deletions tfidf_cosine_similarity.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ func TfIdfCosineSimilarity(docA string, docB string) float64 {
)
allTokens = append(allTokens, tokensA...)
allTokens = append(allTokens, tokensB...)
if len(allTokens) == 0 {
return 1
}
var documentFrequency = map[string]int{}
for _, token := range allTokens {
if documentFrequency[token] == 0 {
Expand Down

0 comments on commit 82570ef

Please sign in to comment.