dkpro / dkpro-c4corpus

DKPro C4CorpusTools is a collection of tools for processing CommonCrawl corpus, including Creative Commons license detection, boilerplate removal, language detection, and near-duplicate removal.
https://dkpro.github.io/dkpro-c4corpus
Apache License 2.0
50 stars 8 forks source link

Limit charset detection to first 8k bytes #38

Closed tfmorris closed 8 years ago

tfmorris commented 8 years ago

I thought I had already reported this, but apparently not. Currently the character set detection uses all the bytes that it reads from the input stream. If called with a stream, ICU limits itself to the first 8K bytes, because that should be enough to determine what the character encoding is, but if it's handed a buffer instead, it uses the entire thing. For very large documents, this is inefficient without adding any accuracy.