{"id":16158358,"url":"https://github.com/ajaymahadeven/Word-Counter","last_synced_at":"2025-03-31T19:32:20.288Z","repository":{"id":158161963,"uuid":"550446781","full_name":"ajaymahadeven/Word-Counter","owner":"ajaymahadeven","description":"Word-Counter is a Java program that searches for specified words in a given text file and counts their occurrences. It provides a simple yet powerful command-line interface with several features, including searching for multiple words at once.","archived":false,"fork":false,"pushed_at":"2023-03-08T10:22:52.000Z","size":666,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T16:47:32.485Z","etag":null,"topics":["command-line","git","java","word-counter"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajaymahadeven.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-12T19:31:57.000Z","updated_at":"2024-10-11T18:07:50.000Z","dependencies_parsed_at":"2023-07-12T21:01:11.997Z","dependency_job_id":null,"html_url":"https://github.com/ajaymahadeven/Word-Counter","commit_stats":null,"previous_names":["thenameisajay/word-counter","ajaymahadeven/word-counter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaymahadeven%2FWord-Counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaymahadeven%2FWord-Counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaymahadeven%2FWord-Counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaymahadeven%2FWord-Counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajaymahadeven","download_url":"https://codeload.github.com/ajaymahadeven/Word-Counter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246527463,"owners_count":20792070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line","git","java","word-counter"],"created_at":"2024-10-10T01:53:58.531Z","updated_at":"2025-03-31T19:32:20.277Z","avatar_url":"https://github.com/ajaymahadeven.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Word-Counter\n\n---\n\n## Description \n\nWord-Counter is a Java program that searches for specified words in a given text file and counts their occurrences. It provides a simple yet powerful command-line interface with several features, including searching for multiple words at once.\n\nTo use the program, simply provide the name and path of the text file to search and the word(s) to look for as command-line arguments. The program will then search for occurrences of the specified words in the file and print the results to the terminal.\n\nIf either argument is missing, the program shows an output message describing the correct usage. If the specified file does not exist, it displays an error message indicating that the file was not found.\n\nThe program also supports searching for multiple words at once. When multiple words are specified, the results are displayed in a table format, with columns for each word and their respective counts. The table view is dynamically sized to fit the longest word and count.\n\nOverall, Word-Counter provides a simple yet effective way to search for and count words in text files.\n\n\n---\n\n## Installation and Usage\n\nMy program has the following features :\n\n• Accept two arguments from the command line.\n– The \u003cstrong\u003e first argument \u003c/strong\u003e is the name (and path) of the file containing the text.\n– The \u003cstrong\u003e second argument \u003c/strong\u003e is the word that is being searched for.\n\n– If either argument is missing, it shows output of the following message:\n         Usage: \u003ccode\u003e java WordCounter \u003cfilename\u003e \u003csearchTerm\u003e \u003c/code\u003e\n         \n– If the specified file does not exist in the given location, it's output is of : \u003ccode\u003e File not found:\nfollowed by a space and the name of the file. \u003c/code\u003e\n\nTo install :\n\u003col\u003e\n       \u003cli\u003e Clone the repository and run the program using the following command:\n       \u003cli\u003e Compile the program using the following command in src folder : \u003ccode\u003e javac *.java \u003c/code\u003e\n       \u003cli\u003e Run the program using the following command in src folder : \u003ccode\u003e java WordCounter filename searchTerm \u003c/code\u003e \n\u003c/ol\u003e\n\n---\n\n## Features\n– Searches through the file for occurrences of the specified word.\n– The word should only be counted when it appears as a whole word. For example, when searching for hope , the word orthopedic does not count as a match.\n– To keep things simple, a word is defined as a continuous sequence of characters from the ranges A–Z, a–z, 0–9, and the underscore ( _ ) character. All other characters are to be ignored. Hence, they're counted as two separate words.\n– Printing the results to the terminal.\n– The message printed has the form “The word ‘\u003cword\u003e’ appears \u003cnumber\u003e time(s).”\n#### For example:\n* The word 'animal' appears 17 times.\n* The word 'lugubrious' appears 1 time. \n* Support searching for multiple words at once.\n\n* All command-line arguments from the second argument onwards are treated as words to search for.\n* If multiple words are specified, instead of printing the message specified above, the results are shown as a table in the following form:\n* The columns in this view adapts to the lengths of the words and numbers shown: they should be wide enough to display all words and numbers with at least one space on either side, as shown.\n* Words and column-headers should be left-aligned, while numbers should be right-aligned.\n\n\u003ctable\u003e\n\u003cthead\u003e\n\u003ctr class=\"header\"\u003e\n\u003cth style=\"text-align: left;\"\u003eWORD\u003c/th\u003e\n \u003cth style=\"text-align: right;\"\u003eCOUNT\u003c/th\u003e\n\u003c/tr\u003e \u003c/thead\u003e \u003ctbody\u003e\n\u003ctr class=\"odd\"\u003e\n\u003ctd style=\"text-align: left;\"\u003eround\u003c/td\u003e\n\u003ctd style=\"text-align: right;\"\u003e17\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr class=\"even\"\u003e\n\u003ctd style=\"text-align: left;\"\u003eability\u003c/td\u003e\n\u003ctd style=\"text-align: right;\"\u003e0\u003c/td\u003e\n\u003c/tr\u003e \n\u003ctr class=\"odd\"\u003e\n\u003ctd style=\"text-align: left;\"\u003eenemy\u003c/td\u003e\n\u003ctd style=\"text-align: right;\"\u003e1\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr class=\"even\"\u003e\n\u003ctd style=\"text-align: left;\"\u003eTOTAL\u003c/td\u003e\n\u003ctd style=\"text-align: right;\"\u003e18\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n---\n## CONTRIBUTION GUIDELINES\n\u003cul\u003e\n\u003cli\u003e Clone the repository from GitHub.\n\u003cli\u003e Create a new branch for your feature or bug fix.\n\u003cli\u003e Implement your feature or bug fix.\n\u003cli\u003e Commit your changes and push to your branch on the GitHub server.\n\u003cli\u003e Submit a merge request to merge your changes into the main branch.\n\u003c/li\u003e\n\u003c/ul\u003e\n\n---\n\n## LICENSE\nThis project is done part of coursework of \u003cstrong\u003e CS5001 - Object-Oriented Programming \u003c/strong\u003e of the \u003cstrong\u003e Computer Science Dept of University of St.Andrews.\u003c/strong\u003e\nThis project is licensed under the \u003ccode\u003e MIT License \u003c/code\u003e - see the \u003ccode\u003e LICENSE.md \u003c/code\u003e file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaymahadeven%2FWord-Counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajaymahadeven%2FWord-Counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaymahadeven%2FWord-Counter/lists"}