-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
Upgraded 3 files , Fixed and optimised capitalize.py , check_anagrams.py , back_propagation_neural_network.py #11596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Consistent naming conventions: The code uses both camelCase and underscore notation for variable names. To maintain consistency, I've used underscore notation throughout the code. Type hints and docstrings: Added type hints and docstrings to improve code readability and understandability. Simplified layer initialization: Simplified the layer initialization process by removing unnecessary variables and using more concise code. Improved forward and backward propagation: Simplified the forward and backward propagation processes by reducing the number of intermediate variables and using more efficient matrix operations. Removed unnecessary variables: Removed unnecessary variables and computations to improve code efficiency. Improved plotting: Improved the plotting function to use more efficient and concise code.
Fixed the signature function to remove spaces and convert to lowercase before sorting the word. Extracted the word list loading into a separate function load_word_list. Extracted the creation of the word_by_signature dictionary into a separate function create_word_by_signature. Extracted the finding of all anagrams into a separate function find_all_anagrams. Created a main function to encapsulate the main logic of the program. Improved the naming of variables and functions to make the code more readable. Removed the if __name__ == "__main__": block from the original code and replaced it with a main function.
Added a check to see if the first character of the sentence is a letter using the isalpha() method. This prevents the function from trying to capitalize non-letter characters. Added a comment to explain the purpose of the lower_to_upper dictionary. Added a comment to explain the logic behind capitalizing the first character of the sentence. Added a comment to explain the purpose of the return statement when the first character is not a letter. Improved the docstring to include more examples and to make it clearer what the function does.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? This completely removes the existing implementation. The whole point is that we implement the algorithm from scratch, without using the built-in function, so that people can see how the algorithm works. Please read our contributing guidelines.
As stated in the PR description,
Please help us out during Hacktoberfest by opening separate PRs for separate algorithms, rather than opening a single PR for edits in three separate algorithm files. This speeds up the review process by making it easier to review your code. Furthermore, in the case of this PR, there are some changes that appear to be potentially helpful, while others shouldn't be merged. |
Also, please do not ask to have your PR approved for Hacktoberfest in your PR title. It makes your title much harder to read, and it's strange to ask for a Hacktoberfest approval before anyone has verified that your PR should be merged. |
Describe your change:
Checklist: