This project implements a client–server dictionary application using TCP socket programming in Python. The server uses NLTK’s WordNet lexical database to fetch definitions of words requested by multiple clients concurrently.
The main focus of this project is to demonstrate:
- Client–server communication using TCP
- Multithreading on the server side
- Basic use of NLP resources (WordNet)
- Clean protocol handling and input validation
This project is suitable as an academic level networking + NLP foundation project.
- TCP-based client–server architecture
- Multithreaded server (handles multiple clients simultaneously)
- Word definition lookup using WordNet
- Graceful client disconnection using a command-based protocol
- Client-side input validation to prevent invalid requests
- Simple, readable, and modular code structure
- Python 3
- Socket Programming (TCP/IP)
- Multithreading
- NLTK (WordNet corpus)
.
├── server.py # Multithreaded TCP server
├── client.py # TCP client for user interaction
└── README.md # Project documentation
- Listens on a TCP port (
localhost:9999) - Accepts incoming client connections
- Spawns a new thread for each connected client
- Receives a word from the client
- Fetches its definition using WordNet
- Sends the definition back to the client
- Closes the connection gracefully when the client sends
__exit__
- Connects to the server over TCP
- Takes word input from the user
- Prevents empty input from being sent
- Sends valid words to the server
- Displays the received definition
- Terminates connection cleanly on
exit
git clone <repository-url>
cd <repository-folder>pip install nltkimport nltk
nltk.download('wordnet')
nltk.download('omw-1.4')python server.pypython client.pyEnter word (exit to quit): computer
Meaning: a machine for performing calculations automatically
- Uses only the most common WordNet meaning of a word
- Does not handle contextual word sense disambiguation
- TCP message handling is kept simple using delimiters
- No persistent storage or logging
These limitations are intentional to keep the project focused and understandable.
- Improve word sense selection using part-of-speech tagging
- Accept full sentences instead of single words
- Rank multiple meanings instead of returning only the first one
- Add basic logging (queries, response time)
- Introduce a structured message format (e.g., JSON)
- Understanding of TCP socket communication
- Practical experience with multithreaded servers
- Exposure to NLP resources like WordNet
- Clear separation of client-side and server-side responsibilities
- Handling real-world networking edge cases
This project is intended for academic and learning purposes.