are OneHotEncoder and keras To_categorical same?
To answer your question:

the output of onehot_encode is (1000, 9739) shouldn't it be (1000,18377) ?


The OneHotEncoder instance will create a dimension per unique word seen in the training sample. Here you are only showing it 9739 different words at training so it does not need more dimensions to perform one hot encoding.

One way to have it accommodate the entire vocabulary is

onehot_encoder = OneHotEncoder(sparse=False, categories=human_vocab)
onehot_encoder.fit_transform(X)