ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Redgrave/Amazon-AnalyzeNamesNormOutput.py
Revision: 841
Committed: Fri Dec 6 21:46:55 2024 UTC (15 months, 2 weeks ago) by nino.borges
Content type: text/x-python
File size: 1782 byte(s)
Log Message:
This program will assist with analyzing the output logs from the Names Norm program.  The team has various levels of issues and this will put the higher issues into a sep file,
making the process of finding these easier while not getting rid of those other lower priority issues.

File Contents

# User Rev Content
1 nino.borges 841 """
2    
3     Amazon-AnalyzeNamesNormOutput
4    
5     Created by:
6     Emanuel Borges
7     12.06.2024
8    
9     This program will assist with analyzing the output logs from the Names Norm program. The team has various levels of issues and this will put the higher issues into a sep file,
10     making the process of finding these easier while not getting rid of those other lower priority issues.
11    
12     """
13    
14    
15     import os
16    
17    
18    
19    
20     if __name__ == '__main__':
21     namesNormLogFileName = r"C:\Test_Dir\Amazon\CAAG-20241204\NameNormOutputText(ToValues).txt"
22    
23    
24    
25     outputFilePath, outputFileName = os.path.split(namesNormLogFileName)
26     outputFileName = f"{os.path.splitext(outputFileName)[0]}_Hot{os.path.splitext(outputFileName)[-1]}"
27     outputFileName = os.path.join(outputFilePath, outputFileName)
28     print(outputFileName)
29     outputFile = open(outputFileName,'w')
30    
31    
32     issuesMatrix = {}
33    
34     contents = open(namesNormLogFileName).readlines()
35     for line in contents:
36     line = line.replace("\n","")
37     newline = line.split(" ")
38     docID = newline[0]
39     try:
40     issuesMatrix[docID].append(line)
41     except KeyError:
42     issuesMatrix[docID] = [line,]
43    
44    
45     print(f"There are {len(issuesMatrix.keys())} documents in this log file.")
46    
47     for docID in list(issuesMatrix.keys()):
48     if len(issuesMatrix[docID]) < 2:
49     pass
50     else:
51     attnyFlag = False
52     issuesList = issuesMatrix[docID]
53     issuesList.sort()
54     for i in issuesList:
55     if "*" in i:
56     attnyFlag = True
57     if attnyFlag:
58     for x in issuesList:
59     outputFile.write(f"{x}\n")
60     outputFile.write("\n")
61    
62    
63     outputFile.close()