Slide 1

Slide 1 text

LibreOfficeで日本 語Linterが使いた い Kenichiro Matohara(matoken) 1

Slide 2

Slide 2 text

ActivityPub @ 鹿児島の右下の山奥から参加 好きなLinuxディストリビューションは Debian map: © OpenStreetMap contributors Kenichiro Matohara(matoken) https://matoken.org matoken@inari.opencocon.org 2

Slide 3

Slide 3 text

前回の補足 Whisperを日本語に最適化して高速化したkotoba-whisper v2 の紹介 Whisper.cpp + kotoba-whisper v2.1を試したがその後 v2.2がリリース v2.0 → whisper-large-v3 モデルを蒸留技術により日本語 に最適化 v2.1 → 句読点に対応 v2.2 → ダイアライゼーション(話者認識)に対応 OpenAI Whisper + kotoba-whisper v2.2をIntel® Core™ i7-10510Uで作業しながら5分の音声で試すと実時間の 3倍近く,RAMは5GB程使用 3

Slide 4

Slide 4 text

Linter, Formatter プログラミングでは一般的 テキストエディタやIDE,CI/CDなどで利用 自然言語でのLinterにRedPenやtextlintがある 表記ゆれ,漢字とかな,大文字小文字等々 テキストエディタから呼び出してチェックしてもらうと便利 4

Slide 5

Slide 5 text

NeoVim + textlint 5

Slide 6

Slide 6 text

textlintについては https://codeberg.org/matoken/kagolug- 2024.09/src/branch/main/slide/slide.adoc 6

Slide 7

Slide 7 text

LibreOffice WriterでもLinterを使い たい 少し検索しただけでは見当たらなかった LibreOffice Writerで保存時にplain textに変換してtextlintに 掛けてみる 7

Slide 8

Slide 8 text

LibreOffice Writerのファイルをプ レーンテキストに変換 LibreOffice同梱の soffice コマンド → STDOUTへの出力方法 がわからない Pandocを利用 $ soffice --headless --convert-to "txt:Text (encoded):UTF8" ./test.odt $ cat test.txt Github,youtubeとか 食べれますか? $ pandoc test.odt -t plain Github,youtubeとか 食べれますか? 8

Slide 9

Slide 9 text

標準入力からtextlint $ pandoc test.odt -t plain | textlint --color --stdin --stdin-filename text.txt text.txt ✓ error Github, => GitHub, ✓ error 全角のピリオドとカンマは使用しません。 ✓ error youtube => YouTube error 文末が"。"で終わっていません。 error ら抜き言葉を使用しています。 error Disallow to use "?" ✓ error 疑問符(?)を使用する場合は「全角」で表記します。 ✖ 7 problems (7 errors, 0 warnings) ✓ 4 fixable problems. Try to run: $ textlint --fix [file] 9

Slide 10

Slide 10 text

保存したときに実行する inotifywaitでファイルを監視し,ファイルに変更があった時に textlintを実行する $ inotifywait test.odt && pandoc test.odt -t plain | textlint --color --stdin --stdin-filename text.txt | aha | xs Setting up watches. Watches established. test.odt OPEN text.txt ✓ error Github, => GitHub, ✓ error 全角のピリオドとカンマは使用しません。 ✓ error youtube => YouTube error 文末が"。"で終わっていません。 error ら抜き言葉を使用しています。 error Disallow to use "?" ✓ error 疑問符(?)を使用する場合は「全角」で表記します。 ✖ 7 problems (7 errors, 0 warnings) ✓ 4 fixable problems. Try to run: $ textlint --fix [file] 10

Slide 11

Slide 11 text

無限ループ 無限ループの中に入れて保存のたびに実行 $ while true; do inotifywait test.odt && \ pandoc test.odt -t plain | \ textlint --color --stdin --stdin-filename text.txt; done 11

Slide 12

Slide 12 text

12

Slide 13

Slide 13 text

少し使ってみて 短い文章ならよい感じ 長い文章だとtextlintで出された行とLibreOffice Writer内での 行がどんどんずれるのでどこを指摘されているかが把握しづらく面倒 Markdownなどで書いて文章を完成させてからLibreOfficeに貼 り付け整形したほうが良さそう? でもその後の修正時が問題 LibreOffice textlintプラグイン的なもっとよい方法がありそう 知ってる方居たら教えてください 13

Slide 14

Slide 14 text

奥付 発表 2024-12- 14(sat) 発表者 利用ソフトウェア NeiVim + textlint + ライセンス 小江戸らぐ 12月のオフな集まり(第269回) Kenichiro Matohara(matoken) Asciidoctor Reveal.js CC BY 4.0 14