A simple Java program to find specific strings in a large text. The program should be composed of the following modules:
- The main module - reads a large text file in parts (e.g. 1000 lines in each part) andvsends each part (as string) to a matcher. After all matchers completed, it calls the aggregator to combine and print the results
- The matcher - gets a text string as input and searches for matches of a given set of strings. The result is a map from a word to its location(s) in the text
- The aggregator - aggregates the results from all the matchers and prints the results. For this task, please use the text at http://norvig.com/big.txt , and the strings to find should be the 50 most common English first names:
- Dictionary – Keep the words to be used in appropriate data structure and make it available through this module.
- Sample dictionary: James,John,Robert,Michael,William,David,Richard,Charles,Joseph,Thomas,Christopher,Daniel,Paul,Mark,Donald,George,Kenneth,Steven,Edward,Brian,Ronald,Anthony,Kevin,Jason,Matthew,Gary,Timothy,Jose,Larry,Jeffrey,Frank,Scott,Eric,Stephen,Andrew,Raymond,Gregory,Joshua,Jerry,Dennis,Walter,Patrick,Peter,Harold,Douglas,Henry,Carl,Arthur,Ryan,Roger
The results should be printed (in no particular order) after all text pieces have been processed. The results can also be made available through an API.
Timothy --> [[lineOffset=13000, charOffset=19775], [lineOffset=13000, charOffset=42023]]
Java 11+
Maven 3.6+
This application was initialized from start.spring.io as below https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.3.4.RELEASE&packaging=jar&jvmVersion=11&groupId=com.bhatman.proto&artifactId=word-search&name=word-search&description=Search%20word%20from%20a%20dictionary&packageName=com.bhatman.proto.word-search
mvnw clean package
mvnw spring-boot:run
OR java -jar target\word-search-1.0.1.jar