analysistoolbox 2.2.84__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/PKG-INFO +1 -1
  2. analysistoolbox-2.3.0/analysistoolbox/file_management/ConvertWordToHTML.py +177 -0
  3. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/file_management/__init__.py +1 -0
  4. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/pymetalog/__init__.py +38 -38
  5. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox.egg-info/PKG-INFO +1 -1
  6. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox.egg-info/SOURCES.txt +1 -0
  7. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/setup.py +2 -1
  8. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/LICENSE.md +0 -0
  9. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/README.md +0 -0
  10. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/__init__.py +0 -0
  11. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/calculus/FindDerivative.py +0 -0
  12. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/calculus/FindLimitOfFunction.py +0 -0
  13. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/calculus/FindMinimumSquareLoss.py +0 -0
  14. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/calculus/PlotFunction.py +0 -0
  15. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/calculus/__init__.py +0 -0
  16. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_collection/ExtractTextFromPDF.py +0 -0
  17. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_collection/FetchPDFFromURL.py +0 -0
  18. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_collection/FetchUSShapefile.py +0 -0
  19. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_collection/FetchWebsiteText.py +0 -0
  20. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_collection/GetCompanyFilings.py +0 -0
  21. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_collection/GetGoogleSearchResults.py +0 -0
  22. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_collection/GetZipFile.py +0 -0
  23. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_collection/__init__.py +0 -0
  24. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/AddDateNumberColumns.py +0 -0
  25. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/AddLeadingZeros.py +0 -0
  26. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/AddRowCountColumn.py +0 -0
  27. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/AddTPeriodColumn.py +0 -0
  28. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/AddTukeyOutlierColumn.py +0 -0
  29. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/CleanTextColumns.py +0 -0
  30. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/ConductAnomalyDetection.py +0 -0
  31. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/ConductEntityMatching.py +0 -0
  32. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/ConvertOddsToProbability.py +0 -0
  33. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/CountMissingDataByGroup.py +0 -0
  34. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/CreateBinnedColumn.py +0 -0
  35. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/CreateDataOverview.py +0 -0
  36. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/CreateRandomSampleGroups.py +0 -0
  37. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/CreateRareCategoryColumn.py +0 -0
  38. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/CreateStratifiedRandomSampleGroups.py +0 -0
  39. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/GeocodeUSAddresses.py +0 -0
  40. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/ImputeMissingValuesUsingNearestNeighbors.py +0 -0
  41. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/VerifyGranularity.py +0 -0
  42. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/data_processing/__init__.py +0 -0
  43. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/descriptive_analytics/ConductManifoldLearning.py +0 -0
  44. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/descriptive_analytics/ConductPrincipalComponentAnalysis.py +0 -0
  45. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/descriptive_analytics/ConductPropensityScoreMatching.py +0 -0
  46. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/descriptive_analytics/CreateAssociationRules.py +0 -0
  47. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/descriptive_analytics/CreateGaussianMixtureClusters.py +0 -0
  48. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/descriptive_analytics/CreateHierarchicalClusters.py +0 -0
  49. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/descriptive_analytics/CreateKMeansClusters.py +0 -0
  50. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/descriptive_analytics/GenerateEDAWithLIDA.py +0 -0
  51. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/descriptive_analytics/__init__.py +0 -0
  52. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/file_management/ConvertWordDocsToPDF.py +0 -0
  53. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/file_management/CreateCopyOfPDF.py +0 -0
  54. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/file_management/CreateFileTree.py +0 -0
  55. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/file_management/ImportDataFromFolder.py +0 -0
  56. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/ChiSquareTestOfIndependence.py +0 -0
  57. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/ChiSquareTestOfIndependenceFromTable.py +0 -0
  58. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/ConductCoxProportionalHazardRegression.py +0 -0
  59. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/ConductLinearRegressionAnalysis.py +0 -0
  60. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/ConductLogisticRegressionAnalysis.py +0 -0
  61. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/ConductSurvivalAnalysis.py +0 -0
  62. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/OneSampleTTest.py +0 -0
  63. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/OneWayANOVA.py +0 -0
  64. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/TTestOfMeanFromStats.py +0 -0
  65. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/TTestOfProportionFromStats.py +0 -0
  66. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/TTestOfTwoMeansFromStats.py +0 -0
  67. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/TwoSampleTTestOfIndependence.py +0 -0
  68. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/TwoSampleTTestPaired.py +0 -0
  69. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/hypothesis_testing/__init__.py +0 -0
  70. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/linear_algebra/CalculateEigenvalues.py +0 -0
  71. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/linear_algebra/ConvertMatrixToRowEchelonForm.py +0 -0
  72. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/linear_algebra/ConvertSystemOfEquationsToMatrix.py +0 -0
  73. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/linear_algebra/PlotVectors.py +0 -0
  74. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/linear_algebra/SolveSystemOfEquations.py +0 -0
  75. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/linear_algebra/VisualizeMatrixAsLinearTransformation.py +0 -0
  76. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/linear_algebra/__init__.py +0 -0
  77. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/llm/SendPromptToAnthropic.py +0 -0
  78. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/llm/SendPromptToChatGPT.py +0 -0
  79. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/llm/__init__.py +0 -0
  80. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/predictive_analytics/CreateARIMAModel.py +0 -0
  81. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/predictive_analytics/CreateBoostedTreeModel.py +0 -0
  82. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/predictive_analytics/CreateDecisionTreeModel.py +0 -0
  83. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/predictive_analytics/CreateLinearRegressionModel.py +0 -0
  84. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/predictive_analytics/CreateLogisticRegressionModel.py +0 -0
  85. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/predictive_analytics/CreateNeuralNetwork_SingleOutcome.py +0 -0
  86. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/predictive_analytics/__init__.py +0 -0
  87. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/prescriptive_analytics/CreateContentBasedRecommender.py +0 -0
  88. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/prescriptive_analytics/__init__.py +0 -0
  89. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/probability/ProbabilityOfAtLeastOne.py +0 -0
  90. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/probability/ProbabilityOfHypothesisGivenData.py +0 -0
  91. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/probability/__init__.py +0 -0
  92. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/CreateCorrelatedSIPs.py +0 -0
  93. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/CreateMetalogDistribution.py +0 -0
  94. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/CreateMetalogDistributionFromPercentiles.py +0 -0
  95. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/CreateSIPDataframe.py +0 -0
  96. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/CreateSLURPDistribution.py +0 -0
  97. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/SimulateCountOfSuccesses.py +0 -0
  98. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/SimulateCountOutcome.py +0 -0
  99. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/SimulateCountUntilFirstSuccess.py +0 -0
  100. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/SimulateNormallyDistributedOutcome.py +0 -0
  101. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/SimulateTDistributedOutcome.py +0 -0
  102. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/SimulateTimeBetweenEvents.py +0 -0
  103. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/SimulateTimeUntilNEvents.py +0 -0
  104. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/__init__.py +0 -0
  105. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/pymetalog/a_vector.py +0 -0
  106. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/pymetalog/class_method.py +0 -0
  107. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/pymetalog/metalog.py +0 -0
  108. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/pymetalog/pdf_quantile_functions.py +0 -0
  109. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/simulations/pymetalog/support.py +0 -0
  110. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/statistics/CalculateConfidenceIntervalOfMean.py +0 -0
  111. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/statistics/CalculateConfidenceIntervalOfProportion.py +0 -0
  112. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/statistics/__init__.py +0 -0
  113. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/Plot100PercentStackedBarChart.py +0 -0
  114. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotBarChart.py +0 -0
  115. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotBoxWhiskerByGroup.py +0 -0
  116. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotBulletChart.py +0 -0
  117. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotCard.py +0 -0
  118. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotClusteredBarChart.py +0 -0
  119. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotContingencyHeatmap.py +0 -0
  120. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotCorrelationMatrix.py +0 -0
  121. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotDensityByGroup.py +0 -0
  122. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotDotPlot.py +0 -0
  123. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotHeatmap.py +0 -0
  124. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotOverlappingAreaChart.py +0 -0
  125. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotRiskTolerance.py +0 -0
  126. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotScatterplot.py +0 -0
  127. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotSingleVariableCountPlot.py +0 -0
  128. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotSingleVariableHistogram.py +0 -0
  129. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/PlotTimeSeries.py +0 -0
  130. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/RenderTableOne.py +0 -0
  131. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox/visualizations/__init__.py +0 -0
  132. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox.egg-info/dependency_links.txt +0 -0
  133. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox.egg-info/requires.txt +0 -0
  134. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/analysistoolbox.egg-info/top_level.txt +0 -0
  135. {analysistoolbox-2.2.84 → analysistoolbox-2.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: analysistoolbox
3
- Version: 2.2.84
3
+ Version: 2.3.0
4
4
  Summary: A collection tools in Python for data collection and processing, statistics, analytics, and intelligence analysis.
5
5
  Home-page: https://github.com/KyleProtho/AnalysisToolBox/tree/master/analysistoolbox
6
6
  Author: Kyle Protho
@@ -0,0 +1,177 @@
1
+ # Load packages
2
+ import os
3
+ import base64
4
+
5
+ # Declare function
6
+ def ConvertWordToHTML(docx_file_path, html_file_path=None):
7
+ """
8
+ This function converts a Word document (.docx) to HTML format while preserving formatting,
9
+ including headings, tables, images, footnotes, and endnotes. All footnotes are converted to endnotes.
10
+
11
+ Args:
12
+ docx_file_path (str): The path to the input .docx file.
13
+ html_file_path (str, optional): The path where the output .html file will be saved.
14
+ If None, saves to the same folder as the input file.
15
+ """
16
+ # Lazy load uncommon packages
17
+ import mammoth
18
+
19
+ # Check if input file exists
20
+ if not os.path.exists(docx_file_path):
21
+ raise FileNotFoundError(f"Input file not found: {docx_file_path}")
22
+
23
+ # Check if input file is .docx
24
+ if not docx_file_path.lower().endswith('.docx'):
25
+ raise ValueError("Input file must be a .docx file")
26
+
27
+ # If html_file_path is None, use the same folder as the input file
28
+ if html_file_path is None:
29
+ input_dir = os.path.dirname(docx_file_path)
30
+ input_filename = os.path.splitext(os.path.basename(docx_file_path))[0]
31
+ html_file_path = os.path.join(input_dir, f"{input_filename}.html")
32
+ print(f"No output path specified. Using: {html_file_path}")
33
+
34
+ # Check if html_file_path is a directory instead of a file
35
+ if os.path.isdir(html_file_path):
36
+ # If it's a directory, create a filename based on the input file
37
+ input_filename = os.path.splitext(os.path.basename(docx_file_path))[0]
38
+ html_file_path = os.path.join(html_file_path, f"{input_filename}.html")
39
+ print(f"Directory provided instead of file path. Using: {html_file_path}")
40
+
41
+ # Check if html_file_path ends with a path separator (indicating it's meant to be a directory)
42
+ if html_file_path.endswith(('/', '\\')):
43
+ input_filename = os.path.splitext(os.path.basename(docx_file_path))[0]
44
+ html_file_path = os.path.join(html_file_path, f"{input_filename}.html")
45
+ print(f"Directory path provided. Using: {html_file_path}")
46
+
47
+ # Ensure the output file has .html extension
48
+ if not html_file_path.lower().endswith('.html'):
49
+ html_file_path += '.html'
50
+ print(f"Added .html extension. Using: {html_file_path}")
51
+
52
+ # Create output directory if it doesn't exist
53
+ output_dir = os.path.dirname(html_file_path)
54
+ if output_dir and not os.path.exists(output_dir):
55
+ try:
56
+ os.makedirs(output_dir)
57
+ except PermissionError:
58
+ raise PermissionError(f"Permission denied: Cannot create directory '{output_dir}'. "
59
+ f"Please check your permissions or choose a different output location.")
60
+
61
+ # Test write access to the output location
62
+ try:
63
+ test_file = html_file_path + '.tmp'
64
+ with open(test_file, 'w') as f:
65
+ f.write('test')
66
+ os.remove(test_file)
67
+ except PermissionError:
68
+ raise PermissionError(f"Permission denied: Cannot write to location '{html_file_path}'. "
69
+ f"Please check that:\n"
70
+ f"1. The file is not currently open in another application\n"
71
+ f"2. You have write permissions to this directory\n"
72
+ f"3. The path is not read-only\n"
73
+ f"4. OneDrive sync is not preventing file access")
74
+ except OSError as e:
75
+ raise ValueError(f"Invalid output path '{html_file_path}': {str(e)}")
76
+
77
+ # Define custom image converter to embed images as base64
78
+ def convert_image(image):
79
+ with image.open() as image_bytes:
80
+ encoded_src = base64.b64encode(image_bytes.read()).decode("ascii")
81
+ return {
82
+ "src": f"data:{image.content_type};base64,{encoded_src}"
83
+ }
84
+
85
+ # Define style mapping to ensure footnotes are converted to endnotes
86
+ # and preserve other formatting
87
+ style_map = """
88
+ p[style-name='Footnote Text'] => p.endnote
89
+ p[style-name='Endnote Text'] => p.endnote
90
+ comment-reference => sup
91
+ """
92
+
93
+ try:
94
+ # Open and convert the docx file
95
+ with open(docx_file_path, "rb") as docx_file:
96
+ result = mammoth.convert_to_html(
97
+ docx_file,
98
+ convert_image=mammoth.images.img_element(convert_image),
99
+ style_map=style_map
100
+ )
101
+
102
+ # Get the HTML content
103
+ html_content = result.value
104
+
105
+ # Add basic HTML structure and CSS for better formatting
106
+ full_html = f"""<!DOCTYPE html>
107
+ <html lang="en">
108
+ <head>
109
+ <meta charset="UTF-8">
110
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
111
+ <title>Converted Document</title>
112
+ <style>
113
+ body {{
114
+ font-family: 'Times New Roman', serif;
115
+ line-height: 1.6;
116
+ max-width: 800px;
117
+ margin: 0 auto;
118
+ padding: 20px;
119
+ }}
120
+ table {{
121
+ border-collapse: collapse;
122
+ width: 100%;
123
+ margin: 20px 0;
124
+ }}
125
+ table, th, td {{
126
+ border: 1px solid #ddd;
127
+ }}
128
+ th, td {{
129
+ padding: 8px;
130
+ text-align: left;
131
+ }}
132
+ th {{
133
+ background-color: #f2f2f2;
134
+ }}
135
+ .endnote {{
136
+ font-size: 0.9em;
137
+ margin-top: 2em;
138
+ border-top: 1px solid #ccc;
139
+ padding-top: 1em;
140
+ }}
141
+ img {{
142
+ max-width: 100%;
143
+ height: auto;
144
+ }}
145
+ </style>
146
+ </head>
147
+ <body>
148
+ {html_content}
149
+ </body>
150
+ </html>"""
151
+
152
+ # Write the HTML content to the output file
153
+ try:
154
+ with open(html_file_path, 'w', encoding='utf-8') as html_file:
155
+ html_file.write(full_html)
156
+ except PermissionError:
157
+ raise PermissionError(f"Permission denied: Cannot write to '{html_file_path}'. "
158
+ f"The file may be open in another application, or you may not have "
159
+ f"write permissions to this location. Please close any open files "
160
+ f"and check your permissions.")
161
+ except OSError as e:
162
+ if "Invalid argument" in str(e) or "cannot find the path" in str(e).lower():
163
+ raise ValueError(f"Invalid file path: '{html_file_path}'. "
164
+ f"Please ensure the path is valid and accessible.")
165
+ else:
166
+ raise OSError(f"Error writing file: {str(e)}")
167
+
168
+ # Print any warnings from mammoth
169
+ if result.messages:
170
+ print("Conversion warnings:")
171
+ for message in result.messages:
172
+ print(f" - {message}")
173
+
174
+ print(f"Successfully converted {docx_file_path} to {html_file_path}")
175
+
176
+ except Exception as e:
177
+ raise Exception(f"Error converting document: {str(e)}")
@@ -1,4 +1,5 @@
1
1
  from .ConvertWordDocsToPDF import ConvertWordDocsToPDF
2
+ from .ConvertWordToHTML import ConvertWordToHTML
2
3
  from .CreateCopyOfPDF import CreateCopyOfPDF
3
4
  from .CreateFileTree import CreateFileTree
4
5
  from .ImportDataFromFolder import ImportDataFromFolder
@@ -3,7 +3,7 @@ from .class_method import rmetalog, plot, qmetalog, pmetalog, dmetalog, summary,
3
3
 
4
4
  # Create a pymetalog module that can be imported
5
5
  class pymetalog:
6
- def __init__(self, x=None, bounds=[0,1], boundedness='u', term_limit=13, term_lower_bound=2, step_len=0.01, probs=None, fit_method='any', penalty=None, alpha=0.0, new_data=None, random_draws=1, random_generator='rand', specified_term=2):
6
+ def __init__(self, x=None, bounds=[0,1], boundedness='u', term_limit=13, term_lower_bound=2, step_len=0.01, probs=None, fit_method='any', penalty=None, alpha=0.0, new_data=None, n=1, generator='rand', term=2):
7
7
  self.x = x
8
8
  self.bounds = bounds
9
9
  self.boundedness = boundedness
@@ -15,9 +15,9 @@ class pymetalog:
15
15
  self.penalty = penalty
16
16
  self.alpha = alpha
17
17
  self.new_data = new_data
18
- self.random_draws = random_draws
19
- self.random_generator = random_generator
20
- self.specified_term = specified_term
18
+ self.n = n
19
+ self.generator = generator
20
+ self.term = term
21
21
  self.my_metalog = None
22
22
 
23
23
  def metalog(self, x=None, bounds=None, boundedness=None, term_limit=None, term_lower_bound=None, step_len=None, probs=None, fit_method=None, penalty=None, alpha=None):
@@ -40,104 +40,104 @@ class pymetalog:
40
40
  self.my_metalog = metalog(x_val, bounds_val, boundedness_val, term_limit_val, term_lower_bound_val, step_len_val, probs_val, fit_method_val, penalty_val, alpha_val)
41
41
  return self.my_metalog
42
42
 
43
- def rmetalog(self, metalog_obj=None, random_draws=1, specified_term=2, random_generator='rand'):
43
+ def rmetalog(self, m=None, n=1, term=2, generator='rand'):
44
44
  """
45
45
  Take random draws from the metalog distribution
46
46
 
47
47
  Parameters:
48
48
  -----------
49
- metalog_obj : object, optional
49
+ m : object, optional
50
50
  A metalog object. If None, uses the class's metalog object
51
- random_draws : int, default=1
51
+ n : int, default=1
52
52
  Number of random draws to take
53
- specified_term : int, default=2
53
+ term : int, default=2
54
54
  Term to use for the metalog distribution
55
- random_generator : str, default='rand'
55
+ generator : str, default='rand'
56
56
  Random number generator to use
57
57
  """
58
58
  # Use the provided metalog object or the class's metalog object
59
- m_obj = metalog_obj if metalog_obj is not None else self.metalog()
60
- return rmetalog(m_obj, n=random_draws, term=specified_term, generator=random_generator)
59
+ m = m if m is not None else self.metalog()
60
+ return rmetalog(m, n=n, term=term, generator=generator)
61
61
 
62
- # def plot(self, metalog_obj=None):
62
+ # def plot(self, m=None):
63
63
  # """
64
64
  # Plot the metalog distribution
65
65
 
66
66
  # Parameters:
67
67
  # -----------
68
- # metalog_obj : object, optional
68
+ # m : object, optional
69
69
  # A metalog object. If None, uses the class's metalog object
70
70
  # """
71
- # m_obj = metalog_obj if metalog_obj is not None else self.metalog()
72
- # return plot(m_obj)
71
+ # m = m if m is not None else self.metalog()
72
+ # return plot(m)
73
73
 
74
- def qmetalog(self, metalog_obj=None, y=None, specified_term=2):
74
+ def qmetalog(self, m=None, y=None, term=2):
75
75
  """
76
76
  Calculate the quantile of the metalog distribution
77
77
 
78
78
  Parameters:
79
79
  -----------
80
- metalog_obj : object, optional
80
+ m : object, optional
81
81
  A metalog object. If None, uses the class's metalog object
82
82
  y : list or float
83
83
  Probability values to calculate quantiles for
84
- specified_term : int, default=2
84
+ term : int, default=2
85
85
  Term to use for the metalog distribution
86
86
  """
87
- m_obj = metalog_obj if metalog_obj is not None else self.metalog()
88
- return qmetalog(m_obj, y=y, term=specified_term)
87
+ m = m if m is not None else self.metalog()
88
+ return qmetalog(m, y=y, term=term)
89
89
 
90
- def pmetalog(self, metalog_obj=None, q=None, specified_term=2):
90
+ def pmetalog(self, m=None, q=None, term=2):
91
91
  """
92
92
  Calculate the probability of the metalog distribution
93
93
 
94
94
  Parameters:
95
95
  -----------
96
- metalog_obj : object, optional
96
+ m : object, optional
97
97
  A metalog object. If None, uses the class's metalog object
98
98
  q : list or float
99
99
  Quantile values to calculate probabilities for
100
- specified_term : int, default=2
100
+ term : int, default=2
101
101
  Term to use for the metalog distribution
102
102
  """
103
- m_obj = metalog_obj if metalog_obj is not None else self.metalog()
104
- return pmetalog(m_obj, q=q, term=specified_term)
103
+ m = m if m is not None else self.metalog()
104
+ return pmetalog(m, q=q, term=term)
105
105
 
106
- def dmetalog(self, metalog_obj=None, q=None, specified_term=2):
106
+ def dmetalog(self, m=None, q=None, term=2):
107
107
  """
108
108
  Calculate the density of the metalog distribution
109
109
 
110
110
  Parameters:
111
111
  -----------
112
- metalog_obj : object, optional
112
+ m : object, optional
113
113
  A metalog object. If None, uses the class's metalog object
114
114
  q : list or float
115
115
  Quantile values to calculate densities for
116
- specified_term : int, default=2
116
+ term : int, default=2
117
117
  Term to use for the metalog distribution
118
118
  """
119
- m_obj = metalog_obj if metalog_obj is not None else self.metalog()
120
- return dmetalog(m_obj, q=q, term=specified_term)
119
+ m = m if m is not None else self.metalog()
120
+ return dmetalog(m, q=q, term=term)
121
121
 
122
- def summary(self, metalog_obj=None):
122
+ def summary(self, m=None):
123
123
  """
124
124
  Return a summary of the metalog distribution
125
125
 
126
126
  Parameters:
127
127
  -----------
128
- metalog_obj : object, optional
128
+ m : object, optional
129
129
  A metalog object. If None, uses the class's metalog object
130
130
  """
131
- m_obj = metalog_obj if metalog_obj is not None else self.metalog()
132
- return summary(m_obj)
131
+ m = m if m is not None else self.metalog()
132
+ return summary(m)
133
133
 
134
- # def update(self, metalog_obj=None, new_data=None, penalty=None, alpha=0.0):
134
+ # def update(self, m=None, new_data=None, penalty=None, alpha=0.0):
135
135
  # """
136
136
  # Update the metalog distribution with new data
137
137
 
138
138
  # Parameters:
139
139
  # -----------
140
- # metalog_obj : object, optional
140
+ # m : object, optional
141
141
  # A metalog object. If None, uses the class's metalog object
142
142
  # new_data : list or array
143
143
  # New data to update the distribution with
@@ -146,5 +146,5 @@ class pymetalog:
146
146
  # alpha : float, default=0.0
147
147
  # Alpha parameter for the update
148
148
  # """
149
- # m_obj = metalog_obj if metalog_obj is not None else self.metalog()
150
- # return update(m_obj, new_data=new_data, penalty=penalty, alpha=alpha)
149
+ # m = m if m is not None else self.metalog()
150
+ # return update(m, new_data=new_data, penalty=penalty, alpha=alpha)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: analysistoolbox
3
- Version: 2.2.84
3
+ Version: 2.3.0
4
4
  Summary: A collection tools in Python for data collection and processing, statistics, analytics, and intelligence analysis.
5
5
  Home-page: https://github.com/KyleProtho/AnalysisToolBox/tree/master/analysistoolbox
6
6
  Author: Kyle Protho
@@ -49,6 +49,7 @@ analysistoolbox/descriptive_analytics/CreateKMeansClusters.py
49
49
  analysistoolbox/descriptive_analytics/GenerateEDAWithLIDA.py
50
50
  analysistoolbox/descriptive_analytics/__init__.py
51
51
  analysistoolbox/file_management/ConvertWordDocsToPDF.py
52
+ analysistoolbox/file_management/ConvertWordToHTML.py
52
53
  analysistoolbox/file_management/CreateCopyOfPDF.py
53
54
  analysistoolbox/file_management/CreateFileTree.py
54
55
  analysistoolbox/file_management/ImportDataFromFolder.py
@@ -12,7 +12,7 @@ setup(
12
12
  long_description=long_description,
13
13
  long_description_content_type='text/markdown',
14
14
  url="https://github.com/KyleProtho/AnalysisToolBox/tree/master/analysistoolbox",
15
- version='2.2.84',
15
+ version='2.3.0',
16
16
  author='Kyle Protho',
17
17
  author_email='kyletprotho@gmail.com',
18
18
  license='MIT',
@@ -41,6 +41,7 @@ setup(
41
41
  'langchain_core',
42
42
  'lida',
43
43
  'lifelines',
44
+ 'mammoth',
44
45
  'mapclassify',
45
46
  'matplotlib<3.8',
46
47
  'mlxtend',