-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add CalculateScoreAndDescSort & add doc
- Loading branch information
1 parent
60a759c
commit 259ce57
Showing
4 changed files
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 句子打分 | ||
|
||
# 一、概述 | ||
|
||
用来区分一个句子中含有的有效的单词的数量,其实就是一个简单的分词,用于在一些暴力枚举破解字典的场景下把尽可能真实的解找出来。 | ||
|
||
# 二、安装 | ||
|
||
```bash | ||
go get -u github.com/cryptography-research-lab/go-sentence-score | ||
``` | ||
|
||
# 三、示例代码 | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
sentence_score "github.com/cryptography-research-lab/go-sentence-score" | ||
) | ||
|
||
func main() { | ||
|
||
// 计算单个句子 | ||
s := "1123thisisverybkjkjbsecurityfghfkeyassdfdfadasdasdasdasdasdasdasdgoodasdasdking" | ||
words, score := sentence_score.CalculateScore(s) | ||
fmt.Println(words) | ||
fmt.Println(score) | ||
|
||
// 计算多个句子并排序 | ||
slice := []string{ | ||
"1123thisisverybkjkjbsecurityfghfkeygoodasdasdking", | ||
"1123thisisverybkjkintenetjbsecurityfghfkeygoodasdasdking", | ||
"1123thisisverybknamejkjbsecurityfghfkeygoodasdasdking", | ||
} | ||
sort := sentence_score.CalculateScoreAndDescSort(slice) | ||
fmt.Println(sort) | ||
|
||
} | ||
``` | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
sentence_score "github.com/cryptography-research-lab/go-sentence-score" | ||
) | ||
|
||
func main() { | ||
|
||
// 计算单个句子 | ||
s := "1123thisisverybkjkjbsecurityfghfkeyassdfdfadasdasdasdasdasdasdasdgoodasdasdking" | ||
words, score := sentence_score.CalculateScore(s) | ||
fmt.Println(words) | ||
fmt.Println(score) | ||
|
||
// 计算多个句子并排序 | ||
slice := []string{ | ||
"1123thisisverybkjkjbsecurityfghfkeygoodasdasdking", | ||
"1123thisisverybkjkintenetjbsecurityfghfkeygoodasdasdking", | ||
"1123thisisverybknamejkjbsecurityfghfkeygoodasdasdking", | ||
} | ||
sort := sentence_score.CalculateScoreAndDescSort(slice) | ||
fmt.Println(sort) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters