You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.0 KiB
60 lines
1.0 KiB
package main |
|
|
|
import ( |
|
docstract "AUDIAG/rtcusertr/DocStract" |
|
"fmt" |
|
"io/ioutil" |
|
"os" |
|
"strings" |
|
|
|
"github.com/sirupsen/logrus" |
|
) |
|
|
|
const MaxBT = 4 |
|
const MaxED = 186 |
|
const MinED = 100 |
|
const MaxEK = 85 |
|
const MaxGQ = 32 |
|
const MaxPG = 200 |
|
|
|
type Master struct { |
|
} |
|
|
|
func main() { |
|
path, _ := os.Getwd() |
|
pathTo := path + "Testdaten/rtcinfo" |
|
pathFiles, _ := ioutil.ReadDir(pathTo) |
|
|
|
for _, file := range pathFiles { |
|
if file.Name()[len(file.Name())-4:] != ".txt" { |
|
continue |
|
} |
|
logrus.Infof("reading %s", file.Name()) |
|
|
|
data, err := ioutil.ReadFile(file.Name()) |
|
|
|
if err != nil { |
|
panic(err) |
|
} |
|
|
|
files, count, err := docstract.Extract(data) |
|
if err != nil { |
|
panic(err) |
|
} |
|
|
|
fmt.Println("Found ", count, " files") |
|
|
|
for i, document := range *files { |
|
if !strings.Contains(*document.FileName, ".") { |
|
s := fmt.Sprintf("%d.txt", i) |
|
document.FileName = &s |
|
} |
|
|
|
if err := document.SaveFile(""); err != nil { |
|
logrus.Warn(err) |
|
} else { |
|
logrus.Infof("Saved file %s", *document.FileName) |
|
} |
|
} |
|
} |
|
}
|
|
|