Created
July 29, 2025 10:29
-
-
Save YoshiRi/2c817cb57608998cb84712fb8cdc87c9 to your computer and use it in GitHub Desktop.
Snippet for patent parsing with jupyter notebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # WidgetでGooglePatentをParseする | |
| from googlepatentscraper.document import Document | |
| from google.colab import widgets | |
| import ipywidgets as widgets | |
| from IPython.display import display, HTML, clear_output | |
| url_box = widgets.Text( | |
| value='', | |
| placeholder='Google PatentのURLを入力してください', | |
| description='URL:', | |
| disabled=False | |
| ) | |
| display(url_box) | |
| # ボタンを押して実行 | |
| def on_button_clicked(b): | |
| with output: | |
| clear_output() # 過去の出力をクリア | |
| url = url_box.value | |
| number = url.split("/")[-1] | |
| patent = Document(number) | |
| text = patent.data["description_alt"] | |
| display(HTML(f"<textarea rows=20 cols=100>{text}</textarea>")) | |
| button = widgets.Button(description="取得") | |
| output = widgets.Output() # 出力ウィジェットを作成 | |
| button.on_click(on_button_clicked) | |
| display(button, output) # ボタンと出力ウィジェットを表示 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment