返回列表 发帖

【完结】20币求空白还原文字

本帖最后由 lxh623 于 2019-4-8 10:38 编辑

这里有个文档,下载打开,是txt。有些汉字不显示,只是空白。
请问,有没有办法还原文字?显像出来。保存为UTF8。
http://bcc.blcu.edu.cn/
BCC汉语词频表   
谢谢!

本帖最后由 lxh623 于 2019-3-25 08:52 编辑

第一、是还原,至少提取含有类似字符的行。
第二、(另外计费)想批量搜索网站,得到那个数字(不下载网页)。比如,我准备文本,汉字2万,或者词语10到20万。不知道会不会被封,速度又怎么样?汉字选择多领域,或者古汉语。词汇只用选择多领域。

TOP

本帖最后由 flashercs 于 2019-3-26 15:13 编辑

空白字符是Unicode的private use,是自定义字体库,字体中没有该字符就显示为空白或方框,只能提取出来.要想显示字体,用eudcedit.exe自己编辑字体库.
请将以下代码保存为 "提取.bat"
@echo off
for /f "tokens=1 delims=:" %%A in ('findstr /n "#######*" %0') do more +%%A %0 >"%~dpn0.ps1"
powershell.exe -ExecutionPolicy Bypass -File "%~dpn0.ps1"
pause
exit /b
################################################################
# 要处理的txt文件路径或所在目录路径
$filesystemobjectpath = 'E:\unzip\weibo_wordfreq.release.txt'
# 是否处理子目录
$isRecursive = $false
function genFile {
  param (
    [string]$filepath
  )
  Write-Host $filepath -ForegroundColor Green
  $sr = [System.IO.StreamReader]::new($filepath, [System.Text.Encoding]::Default, $false)
  $sw = [System.IO.StreamWriter]::new($filepath + '_private.log', $false, [System.Text.Encoding]::Default)
  while (!$sr.EndOfStream) {
    $str = $sr.ReadLine()
    if ($str -match '[\uE000-\uF8FF]') {
      $sw.WriteLine($str)
    }
  }
  $sr.Close()
  $sw.Close()
}
function genFolder {
  param (
    [string]$folderPath,
    [switch]$recurse
  )
  if ($recurse) {
    Get-ChildItem -LiteralPath $folderPath -Filter '*.txt' -File -Include '*.txt' -Recurse|ForEach-Object {genFile $_.FullName}
  }
  else {
    Get-ChildItem -LiteralPath $folderPath -Filter '*.txt' -File -Include '*.txt'|ForEach-Object {genFile $_.FullName}
  }
}
if ((Get-Item -LiteralPath $filesystemobjectpath).Attributes -band [System.IO.FileAttributes]::Directory) {
  genFolder $filesystemobjectpath $isRecursive
}
else {
  genFile $filesystemobjectpath
}COPY
2

评分人数

    • lxh623: 谢谢!请查收!希望我没有记错。技术 + 1
    • 523066680: 20枚 bathome 币PB + 20
微信:flashercs
QQ:49908356

TOP

20B到手了
到现在都不知这PB有啥用
1

评分人数

    • CrLf: 20PB走一波PB + 20 技术 + 1
微信:flashercs
QQ:49908356

TOP

回复 4# flashercs
是不是一个批处理,一个脚本。我不知道怎样修改。谢谢!

TOP

回复 5# lxh623


    第8行:修改为需要处理的txt文件路径,能明白吗?
微信:flashercs
QQ:49908356

TOP

提取后的字符以记事本打开如图所示:
[attach]11863[/attach]
之所以有些字符可见,是因为 微软的字体渲染的fontlink功能的结果; fontlink到的字体 Segoe UI Symbol 定义了部分Unicode private-use字符,所以显示出来了,若要查看有哪些被Segoe UI Symbol定义了的字体,你可以打开charmap.exe;然后字体选择 Segoe UI Symbol, unicode字符选E000,你就会看到 Segoe UI Symbol已经定义的private-use字符;当然它仅定义了一部分,还有大部分空白字符是需要我们自己定义的,也就是自造字体,可以用eudcedit.exe来造字.
[attach]11864[/attach]
微信:flashercs
QQ:49908356

TOP

回复 7# flashercs
谢谢!

TOP

返回列表