|
838 | 838 | </report> |
839 | 839 |
|
840 | 840 |
|
| 841 | + <!-- CHARSET / ENCODING DETECTION |
| 842 | + Reports over the encodings_a / encodings_b tables. One row per file that ran |
| 843 | + charset detection: detected_encoding (final pick), encoding_detector (winning |
| 844 | + detector), declared_metadata (charset declared via Content-Type-Hint). A row |
| 845 | + exists only when an encoding was detected, so counts are over text-y files and |
| 846 | + joins to encodings are effectively inner. A and B are paired by id. These |
| 847 | + tables are not covered by any other report. --> |
| 848 | + |
| 849 | + <report reportName="Charset Detection Coverage" |
| 850 | + reportFilename="charset/charset_coverage.xlsx" |
| 851 | + format="xlsx" |
| 852 | + includeSql="true"> |
| 853 | + <sql> |
| 854 | + select 'paired_files' as METRIC, count(1) as CNT |
| 855 | + from profiles_a pa join profiles_b pb on pa.id=pb.id |
| 856 | + union all |
| 857 | + select 'detected_in_a', count(1) from encodings_a |
| 858 | + union all |
| 859 | + select 'detected_in_b', count(1) from encodings_b |
| 860 | + union all |
| 861 | + select 'detected_in_both', count(1) |
| 862 | + from encodings_a ea join encodings_b eb on ea.id=eb.id |
| 863 | + union all |
| 864 | + select 'flipped_a_to_b', count(1) |
| 865 | + from encodings_a ea join encodings_b eb on ea.id=eb.id |
| 866 | + where ea.detected_encoding <> eb.detected_encoding |
| 867 | + </sql> |
| 868 | + </report> |
| 869 | + |
| 870 | + <report reportName="Detected Encoding Distribution A" |
| 871 | + reportFilename="charset/detected_encoding_distribution_A.xlsx" |
| 872 | + format="xlsx" |
| 873 | + includeSql="true"> |
| 874 | + <sql> |
| 875 | + select detected_encoding as DETECTED_ENCODING, count(1) as COUNT |
| 876 | + from encodings_a |
| 877 | + group by detected_encoding |
| 878 | + order by COUNT desc |
| 879 | + </sql> |
| 880 | + </report> |
| 881 | + |
| 882 | + <report reportName="Detected Encoding Distribution B" |
| 883 | + reportFilename="charset/detected_encoding_distribution_B.xlsx" |
| 884 | + format="xlsx" |
| 885 | + includeSql="true"> |
| 886 | + <sql> |
| 887 | + select detected_encoding as DETECTED_ENCODING, count(1) as COUNT |
| 888 | + from encodings_b |
| 889 | + group by detected_encoding |
| 890 | + order by COUNT desc |
| 891 | + </sql> |
| 892 | + </report> |
| 893 | + |
| 894 | + <report reportName="Encoding Differences A -> B" |
| 895 | + reportFilename="charset/encoding_diffs_A_to_B.xlsx" |
| 896 | + format="xlsx" |
| 897 | + includeSql="true"> |
| 898 | + <sql> |
| 899 | + select concat(ea.detected_encoding, ' -> ', eb.detected_encoding) as ENCODING_A_TO_ENCODING_B, |
| 900 | + count(1) as COUNT |
| 901 | + from encodings_a ea |
| 902 | + join encodings_b eb on ea.id=eb.id |
| 903 | + where ea.detected_encoding <> eb.detected_encoding |
| 904 | + group by ENCODING_A_TO_ENCODING_B |
| 905 | + order by COUNT desc |
| 906 | + </sql> |
| 907 | + </report> |
| 908 | + |
| 909 | + <report reportName="Encoding Differences A -> B Details" |
| 910 | + reportFilename="charset/encoding_diffs_A_to_B_details.xlsx" |
| 911 | + format="xlsx" |
| 912 | + includeSql="true"> |
| 913 | + <sql> |
| 914 | + select c.file_path as FILE_PATH, |
| 915 | + case |
| 916 | + when pb.embedded_depth > 0 |
| 917 | + then pb.embedded_file_path |
| 918 | + else pb.file_name |
| 919 | + end as FILE_NAME_B, |
| 920 | + ea.detected_encoding as ENCODING_A, |
| 921 | + eb.detected_encoding as ENCODING_B, |
| 922 | + ea.encoding_detector as DETECTOR_A, |
| 923 | + eb.encoding_detector as DETECTOR_B, |
| 924 | + eb.declared_metadata as DECLARED_B, |
| 925 | + mb.mime_string as MIME_B, |
| 926 | + ca.oov as OOV_A, cb.oov as OOV_B, |
| 927 | + cb.oov - ca.oov as OOV_DELTA_B, |
| 928 | + ca.languageness as LANGUAGENESS_A, cb.languageness as LANGUAGENESS_B, |
| 929 | + cb.languageness - ca.languageness as LANGUAGENESS_DELTA_B, |
| 930 | + ca.num_replacement as FFFD_A, cb.num_replacement as FFFD_B, |
| 931 | + ca.num_non_ascii as NON_ASCII_A, cb.num_non_ascii as NON_ASCII_B, |
| 932 | + round(100.0*cb.num_replacement/nullif(cb.num_non_ascii,0),2) as FFFD_PCT_B, |
| 933 | + ca.num_common_tokens as COMMON_TOKENS_A, cb.num_common_tokens as COMMON_TOKENS_B, |
| 934 | + coalesce(cb.num_common_tokens,0)-coalesce(ca.num_common_tokens,0) as COMMON_TOKENS_DELTA_B, |
| 935 | + ca.lang_id_1 as LANG_A, cb.lang_id_1 as LANG_B |
| 936 | + from encodings_a ea |
| 937 | + join encodings_b eb on ea.id=eb.id |
| 938 | + join profiles_b pb on pb.id=ea.id |
| 939 | + join containers c on c.container_id=pb.container_id |
| 940 | + left join contents_a ca on ca.id=ea.id |
| 941 | + left join contents_b cb on cb.id=ea.id |
| 942 | + left join mimes mb on mb.mime_id=pb.mime_id |
| 943 | + where ea.detected_encoding <> eb.detected_encoding |
| 944 | + order by coalesce(cb.num_common_tokens,0)-coalesce(ca.num_common_tokens,0) asc |
| 945 | + limit 100000 |
| 946 | + </sql> |
| 947 | + </report> |
| 948 | + |
| 949 | + <report reportName="SBCS-Western to CJK Flips A -> B" |
| 950 | + reportFilename="charset/sbcs_to_cjk_flips_A_to_B.xlsx" |
| 951 | + format="xlsx" |
| 952 | + includeSql="true"> |
| 953 | + <sql> |
| 954 | + select concat(ea.detected_encoding, ' -> ', eb.detected_encoding) as ENCODING_A_TO_ENCODING_B, |
| 955 | + count(1) as COUNT |
| 956 | + from encodings_a ea |
| 957 | + join encodings_b eb on ea.id=eb.id |
| 958 | + where lower(ea.detected_encoding) in |
| 959 | + ('windows-1252','iso-8859-1','iso-8859-15','iso-8859-2','iso-8859-3', |
| 960 | + 'windows-1250','windows-1254','windows-1257','iso-8859-13','windows-1258', |
| 961 | + 'x-macroman','ibm850','ibm852') |
| 962 | + and lower(eb.detected_encoding) in |
| 963 | + ('gb18030','gbk','gb2312','big5','big5-hkscs','shift_jis','euc-jp','euc-kr', |
| 964 | + 'x-euc-tw','x-windows-874','x-windows-949','iso-2022-jp','iso-2022-kr','iso-2022-cn') |
| 965 | + group by ENCODING_A_TO_ENCODING_B |
| 966 | + order by COUNT desc |
| 967 | + </sql> |
| 968 | + </report> |
| 969 | + |
| 970 | + <report reportName="Encoding Detector Distribution A" |
| 971 | + reportFilename="charset/encoding_detector_distribution_A.xlsx" |
| 972 | + format="xlsx" |
| 973 | + includeSql="true"> |
| 974 | + <sql> |
| 975 | + select encoding_detector as ENCODING_DETECTOR, count(1) as COUNT |
| 976 | + from encodings_a |
| 977 | + group by encoding_detector |
| 978 | + order by COUNT desc |
| 979 | + </sql> |
| 980 | + </report> |
| 981 | + |
| 982 | + <report reportName="Encoding Detector Distribution B" |
| 983 | + reportFilename="charset/encoding_detector_distribution_B.xlsx" |
| 984 | + format="xlsx" |
| 985 | + includeSql="true"> |
| 986 | + <sql> |
| 987 | + select encoding_detector as ENCODING_DETECTOR, count(1) as COUNT |
| 988 | + from encodings_b |
| 989 | + group by encoding_detector |
| 990 | + order by COUNT desc |
| 991 | + </sql> |
| 992 | + </report> |
| 993 | + |
| 994 | + <report reportName="Detector Quality B (by detector and encoding)" |
| 995 | + reportFilename="charset/detector_quality_B.xlsx" |
| 996 | + format="xlsx" |
| 997 | + includeSql="true"> |
| 998 | + <sql> |
| 999 | + select eb.encoding_detector as ENCODING_DETECTOR, |
| 1000 | + eb.detected_encoding as DETECTED_ENCODING, |
| 1001 | + count(1) as COUNT, |
| 1002 | + round(avg(cb.oov),4) as AVG_OOV, |
| 1003 | + round(avg(cb.languageness),2) as AVG_LANGUAGENESS, |
| 1004 | + sum(cb.num_replacement) as TOTAL_FFFD, |
| 1005 | + sum(cb.num_non_ascii) as TOTAL_NON_ASCII, |
| 1006 | + round(100.0*sum(cb.num_replacement)/nullif(sum(cb.num_non_ascii),0),2) as FFFD_PCT |
| 1007 | + from encodings_b eb |
| 1008 | + join contents_b cb on cb.id=eb.id |
| 1009 | + group by eb.encoding_detector, eb.detected_encoding |
| 1010 | + order by AVG_OOV desc |
| 1011 | + </sql> |
| 1012 | + </report> |
| 1013 | + |
| 1014 | + <report reportName="Declared vs Detected B" |
| 1015 | + reportFilename="charset/declared_vs_detected_B.xlsx" |
| 1016 | + format="xlsx" |
| 1017 | + includeSql="true"> |
| 1018 | + <sql> |
| 1019 | + select eb.declared_metadata as DECLARED, eb.detected_encoding as DETECTED, |
| 1020 | + count(1) as COUNT |
| 1021 | + from encodings_b eb |
| 1022 | + where eb.declared_metadata is not null |
| 1023 | + group by eb.declared_metadata, eb.detected_encoding |
| 1024 | + order by COUNT desc |
| 1025 | + </sql> |
| 1026 | + </report> |
| 1027 | + |
| 1028 | + <report reportName="Declared vs Detected A" |
| 1029 | + reportFilename="charset/declared_vs_detected_A.xlsx" |
| 1030 | + format="xlsx" |
| 1031 | + includeSql="true"> |
| 1032 | + <sql> |
| 1033 | + select ea.declared_metadata as DECLARED, ea.detected_encoding as DETECTED, |
| 1034 | + count(1) as COUNT |
| 1035 | + from encodings_a ea |
| 1036 | + where ea.declared_metadata is not null |
| 1037 | + group by ea.declared_metadata, ea.detected_encoding |
| 1038 | + order by COUNT desc |
| 1039 | + </sql> |
| 1040 | + </report> |
| 1041 | + |
| 1042 | + |
841 | 1043 | <!-- Exceptions --> |
842 | 1044 | <report reportName="AllExceptionsByMimeA" |
843 | 1045 | reportFilename="exceptions/exceptions_by_mime_A.xlsx" |
|
0 commit comments