This project recreates the T9 (Text on 9 keys) predictive text input system, reminiscent of the late 1990s cell phone technology. Users input a sequence of numbers corresponding to a standard 12-key phone dialpad, and the system generates possible word combinations. This project includes the implementation of a CodeConversion
class, a functional interface for word checking, and a T9Texting
class that integrates all components to find valid words from a given numeric sequence.
- Location:
T9Texting/src/main/java
- Purpose: Generates all possible letter combinations for a given sequence of digits using a mapping of digits to letters.
- Core Methods:
generateCombinations
: Recursively generates letter combinations for the input sequence.- Accessor methods for
code
andmap
fields.
- Location:
T9Texting/src/main/java
- Purpose: Contains functional interfaces used in the project.
- Key Interfaces:
WordChecker
: A functional interface with a single methodisWord
, used to determine if a string constitutes a valid word.
- Location:
T9Texting/src/main/java
- Functionality: Serves as the entry point of the application. It simulates a T9 texting environment where users input a sequence of digits, and the system outputs all valid words as per a stubbed dictionary.
- Key Components:
main
: Initializes a stubbed dictionary and the digit-to-letter map, then finds and prints valid words for a given numeric sequence.findWords
: UsesCodeConversion
to generate all possible combinations and then filters them based on validity using the provided dictionary.
- Setup: Ensure Java is installed and configured on your system.
- Compilation: Navigate to the project directory and compile the Java files. For example, using
javac T9Texting/src/main/*.java
. - Execution: Run the
T9Texting
class. For example,java T9Texting/src/main/T9Texting
. - Input: The
main
method inT9Texting
class currently uses a hardcoded input sequence (4663
). Modify this as needed to test different inputs.
The project includes a basic stubbed dictionary for testing purposes, which considers a word valid if its length is even. For more comprehensive testing, integrate a more complex dictionary or word-checking mechanism.
- Location:
T9Texting/src/testing/java
There are 2 JUnit testing files under this directory:TestCodeConversion
andTestT9Texting
.
- Functionality: Tests the object I created to make sure fields are updated correctly and the object's method's output is correct.
- Functionality: Tests the
findWords
functions to make sure the output is correct given the parameters in the problem statement provided.