Skip to content

Commit 497ac31

Browse files
author
lvcong
committed
划分libary,区分GoLang与Java
1 parent 648bf21 commit 497ac31

File tree

1,323 files changed

+32
-580392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,323 files changed

+32
-580392
lines changed

go-libary/go/utils/file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func Write2File(filePath string, bytes []byte) error {
106106
// 说明有文件夹
107107
// 判断文件夹是否存在
108108
dirs := SubString(filePath, strings.LastIndex(filePath, "/"))
109-
if IsFileOrDirExists(dirs) {
109+
if !IsFileOrDirExists(dirs) {
110110
if err := CreateMultiFileDirs(dirs); nil != err {
111111
fmt.Println("创建文件夹失败:", err.Error())
112112
return err

go-libary/go/utils/time.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
package utils
99

1010
import (
11+
"fmt"
12+
"github.com/jinzhu/now"
1113
"time"
1214
)
1315

@@ -31,11 +33,19 @@ func TimeConvString2Int64(str string) time.Time {
3133
return parse
3234
}
3335
func TimeConvStringWithOtherWay(str string) time.Time {
34-
parse, _ := time.Parse(BASE_TIME_FORMAT_TILL_SEC, str)
35-
if parse.Unix() < 0 {
36-
parse, _ = time.Parse(BASE_TIME_STRING_FORMAT, str)
37-
}
38-
return parse
36+
t, e := now.Parse(str)
37+
fmt.Print(e)
38+
return t
39+
//
40+
// fmt.Println(str)
41+
// parse, e := time.Parse(BASE_TIME_STRING_FORMAT, str)
42+
// if nil != e {
43+
// parse, _ = time.Parse(BASE_TIME_STRING_FORMAT, str)
44+
// } else if parse.Unix() < 0 {
45+
// // BASE_TIME_FORMAT_TILL_SEC
46+
// parse, _ = time.Parse(BASE_TIME_STRING_FORMAT, str)
47+
// }
48+
// return parse
3949
}
4050

4151
func Int64ConvT2TimeStrTilSec(timeStamp int64) string {

go-libary/go/utils/time_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestFormatTime2StringByTemplate(t *testing.T) {
2323
fmt.Println(FormatTime2StringByTemplate("20060102150405", time.Now().Unix()))
2424
}
2525
func TestTimeConvString2Int64(t *testing.T) {
26-
str := "2019-09-02 16:09:13"
26+
str := "2019-09-20 12:54:21"
2727
string2Int64 := TimeConvStringWithOtherWay(str).Unix()
2828
sec := Int64ConvT2TimeStrTilSec(string2Int64)
2929
fmt.Println(sec)

go-libary/specialLib/opencv/ai/pic/pic.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,8 @@ func CompareImgHashes(prevHashes, newHashes []*goimagehash.ImageHash, threshold
175175
//
176176
// return float64(count) / float64(big), nil
177177
// }
178+
179+
// 生成模糊图
180+
func CreateBlurPic() {
181+
182+
}

go-libary/specialLib/opencv/ai/similar.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,17 @@ package ai
1010
import (
1111
"bytes"
1212
"github.com/corona10/goimagehash"
13+
"github.com/mfonda/simhash"
1314
"github.com/syyongx/php2go"
1415
"image/jpeg"
1516
)
1617

1718
// 校验字符串的相似度,使用simhash进行判断
1819
func CompareTextSimilarity(prev, newUpload string) (float64, int) {
19-
// hash1 := simhash.Simhash(simhash.NewWordFeatureSet([]byte(prev)))
20-
// // hash2:=simhash.Simhash(simhash.NewWordFeatureSet([]byte(newUpload)))
21-
// //
22-
// //
23-
// // per := 0.0
24-
// // text := php2go.SimilarText(prev, newUpload, &per)
25-
// // return per, text
26-
return 0.0, 1
20+
hash1 := simhash.Simhash(simhash.NewWordFeatureSet([]byte(prev)))
21+
hash2 := simhash.Simhash(simhash.NewWordFeatureSet([]byte(newUpload)))
22+
compare := simhash.Compare(hash1, hash2)
23+
return 0.0, int(compare)
2724
}
2825

2926
// 简单字符串匹配,适用于当长度小的情况
@@ -33,9 +30,6 @@ func SimpleCompareTextSimilarity(prev, newUpload string) (float64, int) {
3330
return per, i
3431
}
3532

36-
37-
38-
3933
// Deprecated: Use GetImgHash insteaded
4034
func GetPicSimHash(hashFuncName string, bbs []byte) (uint64, error) {
4135
imgHash := new(goimagehash.ImageHash)

go-libary/specialLib/opencv/ai/similar_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ import (
1515

1616
var (
1717
str1 = `中文 格式`
18-
str2 = `中文 格式时间戳系统需要遵循国际和国家标准有关对时间戳格式的规范要求。在时间戳系统在生成时间戳时,并不需要用户的原始信息(数据),而是只对用户的原始信息(数据)的某些关键特征(HASH值)进行时间戳签名,从而保证了用户原始信息(数据)的保密性和安全性。不同地区建立的时间戳,它们采用的数字签名证书是不同的,这主要用于区别不同的时间戳服务中心。时间戳服务中心用于时间戳签名的数字证书采用树形交叉认证体系,利用交叉认证技术实现不同时间戳服务中心所产生的时间戳文件的验证。我国的时间戳系统由北京联合信任技术有限公司与中国科学院国家授时中心联合建成,采用授时中心的时间源,并由时间守时系统与时间监控系统保证时间源准确性,从而保证时间戳系统产生时间戳的权威性。`
18+
str2 = `中文格式时间戳系统需要遵循国际和国家标准有关对时间戳格式的规范要求。在时间戳系统在生成时间戳时,并不需要用户的原始信息(数据),而是只对用户的原始信息(数据)的某些关键特征(HASH值)进行时间戳签名,从而保证了用户原始信息(数据)的保密性和安全性。不同地区建立的时间戳,它们采用的数字签名证书是不同的,这主要用于区别不同的时间戳服务中心。时间戳服务中心用于时间戳签名的数字证书采用树形交叉认证体系,利用交叉认证技术实现不同时间戳服务中心所产生的时间戳文件的验证。我国的时间戳系统由北京联合信任技术有限公司与中国科学院国家授时中心联合建成,采用授时中心的时间源,并由时间守时系统与时间监控系统保证时间源准确性,从而保证时间戳系统产生时间戳的权威性。`
19+
str3=`中文`
1920
)
2021

21-
var (
22-
str3 = str1
23-
)
2422

2523
func TestCompareTextSimilarity(t *testing.T) {
2624
hash1 := simhash.Simhash(simhash.NewWordFeatureSet([]byte(str1)))
@@ -33,7 +31,7 @@ func TestCompareTextSimilarity(t *testing.T) {
3331
fmt.Println(percent)
3432
}
3533
func TestSimpleCompareTextSimilarity(t *testing.T) {
36-
f, i := SimpleCompareTextSimilarity(str1, str2)
34+
f, i := SimpleCompareTextSimilarity(str1, str3)
3735
fmt.Println(f)
3836
fmt.Println(i)
3937
}

go-libary/specialLib/opencv/ai/video/video.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ func GetVideoFramesWithImg(filePath string, funcName string) ([]*goimagehash.Ima
239239
}
240240

241241
// 通过goimage 获取hash
242+
// 通过level 从而判断要捕获多少帧的图片
242243
func getVideoFramesWithGoimage(filePath string, funName string, level int) ([]*goimagehash.ImageHash, error) {
243244
picCount := int(VIDEO_LEVEL_COUNT_ARRAY[level])
244245
// result := make([][]byte, picCount)
@@ -265,7 +266,7 @@ func getVideoFramesWithGoimage(filePath string, funName string, level int) ([]*g
265266
vc.Set(gocv.VideoCapturePosFrames, frames)
266267
img := gocv.NewMat()
267268
vc.Read(&img)
268-
gocv.IMWrite("/Users/joker/Desktop/temp/images/"+utils.GenerateUUID()+"----"+strconv.Itoa(j)+".jpg", img)
269+
// gocv.IMWrite("/Users/joker/Desktop/temp/images/"+utils.GenerateUUID()+"----"+strconv.Itoa(j)+".jpg", img)
269270
// result[j] = img.ToBytes()
270271
image, err := img.ToImage()
271272
if nil != err {

go-libary/specialLib/vendor/github.com/Sirupsen/logrus/CHANGELOG.md

Lines changed: 0 additions & 200 deletions
This file was deleted.

go-libary/specialLib/vendor/github.com/Sirupsen/logrus/LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)