risolti i problemi di parsign su file di esempio semplificato
This commit is contained in:
@@ -107,7 +107,7 @@ class bananaSPLITTER(threading.Thread):
|
|||||||
# ricerco la data
|
# ricerco la data
|
||||||
if (lineWords[self.settings['monthPosition']]).capitalize() in self.docStruct['dateWords']:
|
if (lineWords[self.settings['monthPosition']]).capitalize() in self.docStruct['dateWords']:
|
||||||
try:
|
try:
|
||||||
docDate=parse.parse(self.docParams['dateFormat'],l).named
|
docDate=parse.parse(self.docStruct['dateFormat'],l).named
|
||||||
docDate['month']=docDate['month'].lstrip().rstrip().capitalize()
|
docDate['month']=docDate['month'].lstrip().rstrip().capitalize()
|
||||||
docDate['month']=self.docStruct['dateWords'].index(docDate['month'])+1
|
docDate['month']=self.docStruct['dateWords'].index(docDate['month'])+1
|
||||||
title = ''
|
title = ''
|
||||||
@@ -231,7 +231,7 @@ class bananaSPLITTER(threading.Thread):
|
|||||||
print ('Persorso: {0}'.format(self.paths['OUTworkPath'].format('nomeFile')))
|
print ('Persorso: {0}'.format(self.paths['OUTworkPath'].format('nomeFile')))
|
||||||
try:
|
try:
|
||||||
fName=slugify(self.fileName)
|
fName=slugify(self.fileName)
|
||||||
fName='BODYFILE_{0}_{1}.txt'.format(self.fileCounter,fName[:self.settings['maxTitleLen']])
|
fName='BODYFILE_{0}.txt'.format(fName[:self.settings['maxTitleLen']])
|
||||||
fileContent = os.linesep.join([cc['content'] for cc in self.fileList])
|
fileContent = os.linesep.join([cc['content'] for cc in self.fileList])
|
||||||
out=open(self.paths['OUTworkPath']+'{0}'.format(fName),'wb')
|
out=open(self.paths['OUTworkPath']+'{0}'.format(fName),'wb')
|
||||||
out.write(fileContent.encode(self.settings['encoding']))
|
out.write(fileContent.encode(self.settings['encoding']))
|
||||||
@@ -240,8 +240,5 @@ class bananaSPLITTER(threading.Thread):
|
|||||||
print("OOPS! Qualcosa e\' andato storto, non riesco a scrivere il file: {}".format(e))
|
print("OOPS! Qualcosa e\' andato storto, non riesco a scrivere il file: {}".format(e))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
logg = fancyLogger(name="LibSplit")
|
|
||||||
spp = bananaSPLITTER(fileParams="testfile.txt", logger=logg)
|
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
"nameNotFoundStr": "ND",
|
"nameNotFoundStr": "ND",
|
||||||
"includeTitle": true,
|
"includeTitle": true,
|
||||||
"removeDuplicates": true,
|
"removeDuplicates": true,
|
||||||
"showSkipped": false,
|
"showSkipped": true,
|
||||||
"showRemovedDuplicates": true,
|
"showRemovedDuplicates": true,
|
||||||
"maxTitleLen": 32,
|
"maxTitleLen": 32,
|
||||||
"loadTXT": true,
|
"loadTXT": true,
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
"saveSeparateFiles": true,
|
"saveSeparateFiles": true,
|
||||||
"saveBodyFile": true,
|
"saveBodyFile": true,
|
||||||
"saveBodyNumber": true,
|
"saveBodyNumber": true,
|
||||||
"delLF": false,
|
"delLF": true,
|
||||||
"delWordBreak": true,
|
"delWordBreak": true,
|
||||||
"delChars": [
|
"delChars": [
|
||||||
"'",
|
"'",
|
||||||
|
|||||||
@@ -17,9 +17,12 @@ confl.use("testEN.json")
|
|||||||
splconf = confl.getParams("splitter")
|
splconf = confl.getParams("splitter")
|
||||||
splconf["name"] = splconf["paths"]["INworkPath"]+"GUARDIAN 1989.txt"
|
splconf["name"] = splconf["paths"]["INworkPath"]+"GUARDIAN 1989.txt"
|
||||||
splitter = bananaSPLITTER(fileParams=splconf, logger=logger)
|
splitter = bananaSPLITTER(fileParams=splconf, logger=logger)
|
||||||
splitter.start()
|
splitter.openFile()
|
||||||
splitter.join()
|
splitter.remEmptyLines()
|
||||||
|
splitter.splitFile()
|
||||||
|
splitter.removeDuplicates()
|
||||||
|
splitter.saveBody()
|
||||||
|
splitter.saveSeparate()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user