コマンドラインで「pdfgrep」の合字を認識する代替方法はありますか?

コマンドラインで「pdfgrep」の合字を認識する代替方法はありますか?

私は常に "pdfgrep"を使用してコマンドラインから複数のPDFファイルの内部を検索します。ところで問題が生じました。これはこのハイフン文字「fi」です(参照:https://www.compart.com/en/unicode/U+FB01)。 「fi」は「fixed」という単語にあるため、「固定小数点演算子」という検索語は使用できませんpdfgrep -iR 'fixed point operator'。ところで、Foxit reader、EvinceなどのPDFリーダーを使ってファイルを開くと、「fi」が「f」と「i」に分割され、検索が可能です。 「pdfgrep」に対するより安定した代替手段はありますか?それとも、エンコードを拡張するために「pdfgrep」にオプションキーワードがありますか?

PDFファイルはhttp://direct.mit.edu/books/chapter-pdf/238450/9780262321037_can.pdf

Ubuntu 20.04、amd64、カーネルバージョンLinux 5.6.0-1018-oem。 pdfgrepにはオプションがあります--unac。ただし、pdfgrepを使用してインストールすると、sudo apt-get install pdfgrepコマンド--unacは「pdfgrep:コンパイル時にUNACサポートが無効になりました!」と報告します。

pdfgrep:
  Installed: 2.1.2-1build1
  Candidate: 2.1.2-1build1
  Version table:
 *** 2.1.2-1build1 500
        500 http://mirrors.huaweicloud.com/ubuntu focal/universe amd64 Packages
        100 /var/lib/dpkg/status

ベストアンサー1

この問題を解決するには、まずUTF-8形式を使用して合字を見つける必要がありますpdftotext。たとえば、次のように実行しました。

pdftotext -f 11 -l 13 ~/Mathematics/Analysis/MeasureTheory.pdf text && cat text 

以下のように結果行を取得します。

   1.6.  Infinite and σ-finite measures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

fiそして、実際に端末には☎ベルが鳴る電話がありますが、fiブラウザではでレンダリングされることがわかりました。

だから私は続けますpdfgrep

pdfgrep --page-range=11-13 fi ~/Mathematics/Analysis/MeasureTheory.pdf

ついに私は欲しい結果を得ました。

   1.6.  Infinite and σ-finite measures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
   2.4.  The general definition of the Lebesgue integral . . . . . . . . . . . . . . 118
   2.6.  Integration with respect to infinite measures . . . . . . . . . . . . . . . . 124
   3.5.  Infinite products of measures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

おすすめ記事