Documentation ¶
Index ¶
- Constants
- Variables
- func NewTFIDF(testCorpus []string) (*nlp.Pipeline, mat.Matrix, error)
- func Restore(log *logrus.Logger, movieDirs, seriesDirs []string) (int, error)
- func SaveStaticLineV1(saveFPath string, infoBaseName, infoSrcName string, ...) error
- func SaveStaticLineV2(name, saveFPath string, xAxis []string, timeLineOrgData []opts.LineData) error
- func SaveStaticLineV3(name, saveFPath string, xAxis []string, ...) error
- type FFTAligner
- type FixResult
- type InputData
- type MatchIndex
- type MatchInfo
- type MatchWindowInfo
- type OverParts
- type PipeResult
- type PipeResults
- type Pipeline
- type StopWordsPair
- type StopWordsPairList
- type SubCompare
- type SubFixInfo
- type SubVADBlockInfo
- type WindowInfo
Constants ¶
View Source
const BackUpExt = ".csf-bk"
View Source
const DefaultMaxOffsetSeconds = 120
View Source
const MaxFramerateRatio = 1.1
View Source
const MinFramerateRatio = 0.9
View Source
const SampleRate = 100
View Source
const TmpExt = ".csf-tmp"
Variables ¶
View Source
var CnStopWords = []string{}/* 842 elements not displayed */
View Source
var EnStopWords = []string{} /* 318 elements not displayed */
View Source
var FramerateRatios = []float64{24. / 23.976, 25. / 23.976, 25. / 24.}
Functions ¶
func SaveStaticLineV1 ¶
func SaveStaticLineV2 ¶
Types ¶
type FFTAligner ¶
type FFTAligner struct {
// contains filtered or unexported fields
}
复现 https://github.com/smacke/ffsubsync 的 FFTAligner 算法
func NewFFTAligner ¶
func NewFFTAligner(maxOffsetSeconds, sampleRate int) *FFTAligner
type FixResult ¶
type InputData ¶
type InputData struct { Index int // 为了让并发处理的数据能够按顺序重新排序 BaseUnit sub_helper.SubUnit // 基准 VAD BaseAudioVADList []float64 // 基准 VAD SrcUnit sub_helper.SubUnit // 需要匹配的 VAD OffsetIndex int // 滑动窗体的移动偏移索引 Wg *sync.WaitGroup // 并发锁 }
InputData 修复函数传入多线程的数据结构
type MatchIndex ¶
type MatchInfo ¶
type MatchInfo struct { IndexMatchWindowInfoMap map[int]MatchWindowInfo // 匹配列表的顺序列表 StartDiffTimeList []float64 StartDiffTimeMap *treemap.Map StartDiffTimeListEx stat.Float64Slice }
MatchInfo 匹配的信息
type MatchWindowInfo ¶
type OverParts ¶
type OverParts struct { XLen float64 // 分段处长度 YLen float64 // 分段处长度 XMean float64 // X 段的 Mean 值 YMean float64 // Y 段的 Mean 值 }
OverParts 总长度 D = XLen + YLen
type PipeResult ¶
type PipeResult struct { Score float64 BestOffset int ScaleFactor float64 ScaledFileInfo *subparser.FileInfo }
func (PipeResult) GetOffsetTime ¶
func (p PipeResult) GetOffsetTime() float64
GetOffsetTime 从偏移得到偏移时间
type PipeResults ¶
type PipeResults []PipeResult
func (PipeResults) Len ¶
func (d PipeResults) Len() int
func (PipeResults) Less ¶
func (d PipeResults) Less(i, j int) bool
func (PipeResults) Swap ¶
func (d PipeResults) Swap(i, j int)
type Pipeline ¶
type Pipeline struct { MaxOffsetSeconds int // contains filtered or unexported fields }
func NewPipeline ¶
func (Pipeline) CalcOffsetTime ¶
func (Pipeline) FixSubFileTimeline ¶
func (p Pipeline) FixSubFileTimeline(infoSrc, scaledInfoSrc *subparser.FileInfo, inOffsetTime float64, desSaveSubFileFullPath string) (string, error)
FixSubFileTimeline 这里传入的 scaledInfoSrc 是从 pipeResults 筛选出来的最大分数的 FileInfo infoSrc 是从源文件读取出来的,这样才能正确匹配 Content 中的时间戳
type StopWordsPair ¶
type StopWordsPairList ¶
type StopWordsPairList []StopWordsPair
func (StopWordsPairList) Len ¶
func (a StopWordsPairList) Len() int
func (StopWordsPairList) Less ¶
func (a StopWordsPairList) Less(i, j int) bool
func (StopWordsPairList) Swap ¶
func (a StopWordsPairList) Swap(i, j int)
type SubCompare ¶
type SubCompare struct {
// contains filtered or unexported fields
}
func NewSubCompare ¶
func NewSubCompare(maxCompareDialogue int) *SubCompare
func (*SubCompare) Add ¶
func (s *SubCompare) Add(baseNowIndex, srcNowIndex int) bool
Add 添加元素进来比较,这里有个细节,如果理论上需要判断是 OffsetIndex 是 1-5 ,那么如果 1 add了,2 add 失败的时候,是应该清理后再 add 2 还有一种情况,从 1-5,添加到 4 的时候false了,那么应该回退到 2 进行 add,而不是从 4 开始
func (*SubCompare) Check ¶
func (s *SubCompare) Check() bool
Check 是否 Add 的元素已经足够满足 maxCompareDialogue 的数量要求了 这里有个细节,如果理论上需要判断是 OffsetIndex 是 1-5 ,如果 add 5 check 的时候 false,那么应该清理后,回退到 2 进行 add,而不是 6 开始
func (*SubCompare) Clear ¶
func (s *SubCompare) Clear()
func (*SubCompare) GetStartIndex ¶
func (s *SubCompare) GetStartIndex() (int, int)
type SubFixInfo ¶
func NewSubFixInfo ¶
func NewSubFixInfo(fileName, fixContent string) *SubFixInfo
type SubVADBlockInfo ¶
SubVADBlockInfo 字幕分块信息
type WindowInfo ¶
type WindowInfo struct { BaseAudioFloatList []float64 // 基准 VAD BaseUnit *sub_helper.SubUnit // 基准 VAD SrcUnit *sub_helper.SubUnit // 需要匹配的 VAD MatchedTimes int // 匹配上的次数 SrcWindowLen int // 滑动窗体长度 SrcSlideStartIndex int // 滑动起始索引 SrcSlideLen int // 滑动距离 OneStep int // 每次滑动的长度 }
WindowInfo 滑动窗体信息
Click to show internal directories.
Click to hide internal directories.