Library for mathematical, financial and textual analysis
Project description
HintlyDataAnalisys Documentation
This library is designed to process and analyze text data, perform mathematical computations, and integrate plugins for custom operations. The library supports text normalization, counting specific characters or words, and providing basic mathematical operations like mean, difference, normalization, and more. Additionally, the MatchMaker class allows for text manipulation based on pre-configured rules stored in JSON files.
Table of contents
1. Global Variables
intrepunctions
: A list of punctuation marks used for text analysis (e.g., ".", ",", ":", "?", etc.).whiteSigns
: A list of whitespace characters (e.g., " ", "\n", etc.).data
: JSON data loaded from the filematchmaker.json
that stores configuration settings.
2. Classes
2.1. Math
This class contains mathematical operations for analyzing numerical data.
Mean(analisysData: list)
: Returns the average of a list of numbers.Difference(a, b)
: Calculates the percentage difference between two valuesa
andb
.Normalize(analisysData: list, normalizeNumber: int)
: Normalizes the values inanalisysData
to a scale defined bynormalizeNumber
.MakeInt(value: float, divideNumber: int)
: Converts a float to an integer by rounding after subtractingdivideNumber
.AbsoluteDifference(a, b)
: Returns the absolute difference between two values.AbsoluteIntPercentDifference(a, b)
: Returns the absolute percentage difference, converted to an integer.WeightedAverage(analisysData: list, weights: list)
: Computes the weighted average of the given data.NumberRepeat(numbers: list)
: Returns a dictionary with the count of occurrences of each number innumbers
.PercentNumberChance(numbers: list)
: Returns a dictionary showing the probability (as a percentage) of each number appearing innumbers
.
2.2. Text
This class provides utilities for text analysis and manipulation.
CountInterpunctions(text: str)
: Returns a dictionary with the count of each punctuation mark fromintrepunctions
in the providedtext
.CountSigns(text: str, lowerSigns: bool)
: Returns a dictionary of character counts intext
, either case-sensitive or case-insensitive based on thelowerSigns
flag.CountWord(text: str, word: str)
: Returns the number of times a word appears in the providedtext
.FilterWordsWithSign(text: str, sign: str, filterType: FilterType)
: Based onfilterType
, either counts or removes the occurrences of a word (sign
) fromtext
.NormalizeText(text: str, normalizeType: NormalizeType)
: Performs various normalization actions (such as deleting punctuation or changing text to lowercase) based on the specifiednormalizeType
.GetWordsFromText(text: str)
: Splits the provided text into a list of words.
2.3. MatchMaker
This class is responsible for more advanced text manipulation, including hidden text processing and splitting based on specific rules.
MMSplitText(text: str)
: Splits the text based on a key defined in thematchmaker.json
file and returns a list of text segments.MMHiddenText(text: str)
: Removes hidden parts of the text enclosed by specific start and end markers frommatchmaker.json
.MMPasswordText(text: str)
: Replaces the content between specific markers (start and end) with asterisks for obfuscation.
2.4. Plugins (Nested in MatchMaker)
This class manages external plugins that can extend the library's functionality.
InstallPlugin(name: str)
: Installs a plugin by importing it and updating thematchmaker.json
file.
2.5. timeLib (Nested in MatchMaker)
This class allows for time-based text operations if the timeLib
plugin is installed.
Detect(text: str)
: Detects and replaces time tags in the text if thetimeLib
plugin is available.
API Documentation
Math Operations
-
Mean(analisysData: list) -> float
: Calculate the mean of a list of numbers.Math.Mean([1, 2, 3, 4, 5]) # Returns: 3.0
-
Difference(a: float, b: float) -> float
: Calculate the percentage difference betweena
andb
.Math.Difference(50, 100) # Returns: 100.0
-
Normalize(analisysData: list, normalizeNumber: int) -> list
: Normalize a list of numbers to a specified range.Math.Normalize([1, 2, 3], 10) # Returns: [3.33, 6.67, 10]
-
AbsoluteDifference(a: float, b: float) -> float
: Return the absolute difference between two values.Math.AbsoluteDifference(5, 10) # Returns: 5
-
WeightedAverage(analisysData: list, weights: list) -> float
: Calculate the weighted average of a list.Math.WeightedAverage([3, 4, 5], [1, 2, 1]) # Returns: 4.0
-
NumberRepeat(numbers: list) -> dict
: Return a dictionary with the number of times each number appears in the list.Math.NumberRepeat([1, 2, 2, 3]) # Returns: {1: 1, 2: 2, 3: 1}
Text Operations
-
CountInterpunctions(text: str) -> dict
: Count how many times each punctuation appears in the text.Text.CountInterpunctions("Hello, world!") # Returns: {",": 1, "!": 1}
-
CountSigns(text: str, lowerSigns: bool) -> dict
: Count each character's appearance in the text, either case-sensitive or case-insensitive.Text.CountSigns("Hello", True) # Returns: {"h": 1, "e": 1, "l": 2, "o": 1}
-
CountWord(text: str, word: str) -> int
: Count how many times a word appears in the text.Text.CountWord("This is a test. This test is simple.", "test") # Returns: 2
-
NormalizeText(text: str, normalizeType: NormalizeType) -> str
: Normalize text by performing actions such as removing punctuation or converting text to lowercase.Text.NormalizeText("Hello, World!", NormalizeType.LowText) # Returns: "hello, world!"
MatchMaker
-
MMSplitText(text: str) -> list
: Split text based on a key defined in thematchmaker.json
file.MatchMaker.MMSplitText("Hello world!") # Returns: list of segments based on key
-
MMHiddenText(text: str) -> str
: Remove hidden text segments enclosed by specified markers.MatchMaker.MMHiddenText("This is {hd}secret{/hd} text.") # Returns: "This is text."
-
MMPasswordText(text: str) -> str
: Obfuscate text between markers with asterisks.MatchMaker.MMPasswordText("Password is {password}12345|{/password} hidden.") # Returns: "Password is ***** hidden."
Plugins
-
InstallPlugin(name: str)
: Install and integrate an external plugin into the library.MatchMaker.Plugins.InstallPlugin("example_plugin")
Authors
Franciszek Chmielewski (ferko2610@gmail.com)
License
All in LICENSE file.
MIT Licence
Copyright (c) 2024 Franciszek Chmielewski.
Permission is hereby granted to anyone who obtains a copy of this software and associated documentation files (the ‘Software’) to use the Software for personal purposes only, subject to the following conditions:
1. The Software may not be copied, reproduced, modified or distributed in any form without the prior written consent of the author.
2. It is not permitted to publish, sublicense, sell, share or transfer the Software to others without the written consent of the author.
3. It is prohibited to decompile, reverse engineer, modify or create derivative works based on the Software.
<b>THE SOFTWARE IS PROVIDED ‘AS IS’ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIMS, DAMAGES OR OTHER LIABILITIES, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING OUT OF OR RELATING TO THE SOFTWARE OR THE USE OR OTHER ACTIVITIES IN THE SOFTWARE.</b>
Future Plans
Roadmap: Roadmap
- Adding more mathematical tools
- Adding more text tools
- Adding more plug-ins to MatchMaker.
- Adding functions to MatchMaker.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for hintlydataanalisys-0.4.2.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c924cf44c9d84faf376b9d8813837a9982b5a8bdce054cdf7e459c050d87b33 |
|
MD5 | f864808ceaa23884cf0dbfe6aedcec97 |
|
BLAKE2b-256 | cb38f7e836628f4fec042dbde16e56f5be697eb074612e5207df59a5ae8fb64c |
Hashes for HintlyDataAnalisys-0.4.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dc025bb8caa015277ea90a252647b909555ed057bb346b370892c33dfee4d8b |
|
MD5 | a410e1b226d92297534e00d9fe73935a |
|
BLAKE2b-256 | 696c7b71d7ae80a092f4b3a71080426de73a29cd475c67350f5c27613be5c22b |