I find myself in the process of extracting bigrams (sequences of two characters) from text data to perform an analysis of frequencies and develop a model
Now, the frequencies and related quintiles are of course affected by the text length, which can vary both in the train set and in the future score sets
I searched some proper approach to follow to avoid the variance in text length to affect the model performances.
It seems that one approach is the following:
“ Recall that for batching, we need to have all the sequences in a given batch be of uniform length ( N of words).
To do that, we either:
• (1) pad the sequences that are shorter than a given length or
• (2) truncate the sequences that are bigger than the given length.
• The question is how do we decide this length? We have several options:
We decide on a global maximum sequence length based on the sequence length characteristics of the training data. “
Meaning that:
- It is identified in the training set, within the distribution of N of words composing a text, the maximum value or 75% quantile , and use it as upper limit
- Based on this value, all the texts with greater length are truncated
The approach seems sound to me in avoiding that text length will affect the bigrams distributions and model performance on the score set
Still, I would know if someone has managed similar tasks before and if any relevant material can be suggested