seomoz / dragnet_data Goto Github PK
View Code? Open in Web Editor NEWTraining/test data for Dragnet
License: GNU Affero General Public License v3.0
Training/test data for Dragnet
License: GNU Affero General Public License v3.0
I was trying to use the data for some experiments, but when reading it directly with open
in python3, in encountered an encoding error for file R121.html
:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcc in position 1213: invalid continuation byte
I wrote a small script to check the encoding of the failing files using the chardet
utility. The code is below.
for f in *.html; do
encoding=$(file -i $f | cut -d"=" -f 2) # get the mime encoding
if [ "$encoding" != "us-ascii" ] && [ "$encoding" != "utf-8" ]; then
res=$(chardetect $f) # try to detect it otherwise
encoding=$(echo $res | cut -d" " -f 2)
echo $res
fi
done
And produces the following result:
R121.html: Windows-1254 with confidence 0.5434633906826465
R17.html: ISO-8859-1 with confidence 0.73
R736.html: Windows-1252 with confidence 0.73
R757.html: Windows-1252 with confidence 0.73
R826.html: Windows-1252 with confidence 0.73
R827.html: Windows-1252 with confidence 0.73
T156.html: windows-1251 with confidence 0.7538428528079772
T19.html: Windows-1252 with confidence 0.73
T2.html: Windows-1254 with confidence 0.5434729438118417
T31.html: Windows-1254 with confidence 0.5239184224706976
T97.html: ISO-8859-1 with confidence 0.73
These inconsistencies are not major and I managed to fix them afterwards with a few changes to the detection script, but a few failed even with recode
(R121.html
, T19.html
, T2.html
, T31.html
) and I had to remove them. Here is the script I used to convert the inconsistent ones.
for f in *.html; do
encoding=$(file -i $f | cut -d"=" -f 2) # get the mime encoding
if [ "$encoding" != "us-ascii" ] && [ "$encoding" != "utf-8" ]; then
res=$(chardetect $f) # try to detect it otherwise
encoding=$(echo $res | cut -d" " -f 2)
echo $res - CONVERTING TO UTF-8
recode ${encoding}..utf-8 $f
fi
done
This might be an issue on my part, maybe, so I'm curious if this is something that came to your attention before.
Hi, I'm currently compiling additional, more modern html documents with gold standard content + comments for use in training dragnet models, and I have a few questions:
Thanks for your help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.