GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — リスト内包表記 などのpython キーワードで検索可能にしてほしい · Issue #792 · python-doc-ja/python-doc-ja

リスト内包表記 などのpython キーワードで検索可能にしてほしい #792

New issue
Copy link
New issue
Copy link
Open
Open
リスト内包表記 などのpython キーワードで検索可能にしてほしい#792
Copy link

Description

@yabuki
yabuki
opened on Aug 18, 2018
Issue body actions

こんにちは。

ドキュメントを日本語の「リスト内包表記」で検索した所0件で悲しい気持ちになりました。
可能なら日本語でもヒットするようにしていただけると助かります。

Activity

  1. taketakeyyy commented on Aug 18, 2018

    @taketakeyyy
    taketakeyyy
    on Aug 18, 2018
    More actions

    こんにちは。
    気になって調べてみました。ベストプラクティスは見つかっておりません。

    https://docs.python.org/ja/3.8/tutorial/datastructures.html#list-comprehensions

    上記のURLのドキュメント中に「リスト内包表記」の文字列は存在するので、検索エンジンが原因でしょうか。(OpenSearchの設定?)

    色々試しましたところ、

    • 「リスト内包表記」 // 検索結果が見つからない
    • 「リスト 内包表記」 // 検索結果が見つからない
    • 「リスト 内包 表記」 // 検索結果が見つかる
    • 「リス 内包 表記」 // 検索結果が見つからない

    といった結果なので、部分文字列検索ではなく単語検索のようなことをしていると思われます。

    言語をEnglishにして以下の単語を検索した場合、

    • comprehensions // 検索結果が見つかる
    • comprehension // 検索結果が見つかる
    • comprehensio // 検索結果が見つからない
    • compre // 検索結果が見つかる(このような英単語は存在しない)

    となるので、一概には言えませんが、やはり単語検索している可能性が高いです。

    OpenSearchに詳しくないのでもしかしたら別の方が解決策を知っているかもしれませんが、場当たり的な対処法として「細かい単語で区切って検索する」という方法があるようです。

  2. shimizukawa commented on Aug 18, 2018

    @shimizukawa
    shimizukawa
    on Aug 18, 2018
    More actions

    html_search_option のデフォルトでは、Sphinx本体側でもっている検索インデックスを作るために、元の文章をTinySegmenter(のPython実装)を使って分かち書きしています。
    http://chasen.org/~taku/software/TinySegmenter/

    Sphinxのビルド時に生成される検索インデックス https://docs.python.org/ja/3.8/searchindex.js を「内包( \u5185\u5305 ) 」で探してみると、分割された状態になっていることがわかります。

    ユーザーが検索ボックスに入力する単語は、JS実装のTinySegmenterで分かち書きされ、Sphinxの用意した検索インデックスで検索するのですが、その分かち書きがうまく動作していない可能性がありそうです。

    Reacted by takey
  3. shimizukawa commented on Aug 18, 2018

    @shimizukawa
    shimizukawa
    on Aug 18, 2018
    More actions
    • リスト "\u30ea\u30b9\u30c8":[84,91,99,102,144,317,341,421,432,433,440,443,451,459],
    • 内包 "\u5185\u5305":[99,433,451],
    • 表記 "\u8868\u8a18":[99,421,425,433,442,451],

    共通するインデックス番号 99,433,451 それぞれのページ

    docnames[99] == 'howto/functional'
    docnames[433] == 'tutorial/datastructures'
    docnames[451] == 'whatsnew/2.0'
    
  4. shimizukawa commented on Aug 19, 2018

    @shimizukawa
    shimizukawa
    on Aug 19, 2018
    More actions

    やっぱり、検索語が分割されてないですね。
    image

    Sphinx自体の問題なのかどうか、調べてみます。

  5. shimizukawa commented on Aug 19, 2018

    @shimizukawa
    shimizukawa
    on Aug 19, 2018
    More actions

    検索語が分割される前提でコメントしたけど、そのような実装はなさそう( sphinx-doc/sphinx#3154 で実装してあると記憶違いしていた)。

    また、クライアントサイドの分かち書きを設定で差し込む仕組みも現状はないので、実現するには以下が必要そうです。

    1. クライアントサイドの単語分割の仕組みをプラグインで設定可能とする(サーバーサイドの単語分割は現状でもプラグインで設定可能)
    2. プラグインを用意する(JSのTinySegmenterを使うコードでよさそう)

    要望を https://github.com/sphinx-doc/sphinx/issues に書いてくれるとうれしいです

  6. cocoatomo commented on Aug 19, 2018

    @cocoatomo
    cocoatomo
    on Aug 19, 2018
    Contributor
    More actions

    Workaround として Google で「site:docs.python.org/ja/2.7 リスト内包表記」や「site:docs.python.org/ja/2 リスト内包表記」といった文言で検索してください.

    Reacted by YABUKI Yukiharu
  7. cocoatomo commented on Aug 19, 2018

    @cocoatomo
    cocoatomo
    on Aug 19, 2018
    Contributor
    More actions

    一般的な話として, issue の文面は起きている問題やどうして欲しいかを整理して書くものとなっています.

    これまで, そういう形式を明示的には強制はしていなかったのですが, これからは強制するものとしていきたいと思います.
    これは, issue の作成者以外の人にも問題の内容が分かるようにするためと, issue を閉じる条件を厳密にするためです.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.