added Documentation and checked for the file path correctness and added an extra condition in ConstructCodebook to check if the data is empty or not