[cmdletbinding()] param( [string]$bench = [string]::Empty ) $p = "..\src\go-pge\data\benchmark\" $OutPath = "..\src\go-pge\data\hlbenchmark\" if(-not $(Test-Path -Path $p)) { Write-Error "Benchmark $p not found!" exit 2 } if($bench -eq [string]::Empty) { $i = Get-ChildItem -Path $p -Filter *.trn } else { $i = Get-ChildItem -Path $p -Filter "$($bench).trn" } foreach($it in $i) { $bench = $it.BaseName $OutFile = Join-Path $OutPath "$($it.BaseName).csv" $TrnCont = Get-Content $(Join-Path -Path $it.DirectoryName -ChildPath "$($it.BaseName).trn") $TrnContNew = @() $Count = 0 $VarHead = "$($TrnCont[0].Trim());$($TrnCont[1].Trim())" $VarHead = $VarHead -replace ' ', ';' $TrnContNew += $VarHead foreach($line in $TrnCont) { if($Count -ge 2) { $TrnContNew += $line.Trim().Replace('.',',').Replace(' ',';') } $Count++ } $TrainEnd = $Count $TestStart = $TrainEnd + 1 $TestCont = Get-Content $(Join-Path -Path $it.DirectoryName -ChildPath "$($it.BaseName).tst") $Count = 0 foreach($line in $TestCont) { if($Count -ge 2) { $TrnContNew += $line.Trim().Replace('.',',').Replace(' ',';') } $Count++ } $TrnContNew | Out-File -FilePath $OutFile $TestEnd = $TestStart + $Count Write-Host "$($bench): TestPartition Start: $TestStart, $TestEnd" Write-Host "$($bench): TrainingPartition Start: 0, $TrainEnd `n" }