end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

2024-01-01から1年間の記事一覧

reportlab & pypdf for python を用い、pdfに文字列や図形を透明(透かし)で追加

from pypdf import PdfReader, PdfWriter from reportlab.pdfgen import canvas from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont from reportlab.lib.colors import red,black import io import sys def main(): or…

Re: モリサワ 「Google Fonts」へユニバーサルデザインに配慮した「BIZ UDフォント」を提供

モリサワの「BIZ UDフォント」のメモ www.morisawa.co.jp github.com github.com forest.watch.impress.co.jp

openpyxl + pillow for python で excelに含まれる画像を抽出

import openpyxl import PIL def main(): excel_file = './test_includeing_img.xlsx' wb = openpyxl.load_workbook(excel_file) for xlsx_img in wb['Sheet1']._images: #print( xlsx_img.path ) # sheet中の座標 print( xlsx_img.anchor._from.col, xlsx_i…

TD-IDF (Term Frequency – Inverse Document Frequency) をpythonで実装

scikit-learn for pythonに頼っていましたが、実装してみました import math import collections def main(): """ TF-IDFとは? 各文書(document)にある各単語(term)が「その文書でどれくらい重要か」 https://atmarkit.itmedia.co.jp/ait/articles/2112/23/…

sqlite fts4 + sql.js によるブラウザでの全文検索

sql.jsは sqlite の javascript + web assembly版ですので、 先程のentryの続きとして、ブラウザでの全文検索を行います。 参考url SQLite FTS : trigram tokenizerでunigram&bigram検索までサポート-日本語全文検索 – スペース・アイ株式会社 【Python】SQ…

SQLite FTS5 Extension による全文検索

参考url 【Python】SQLite で日本語を全文検索するコード例【N-Gram, FTS4/FTS5】 | シラベルノート SQLite FTS5 Extension SQLite FTS : trigram tokenizerでunigram&bigram検索までサポート-日本語全文検索 – スペース・アイ株式会社 SQLite FTS5 拡張機…

kuromoji.js へのユーザ辞書追加

先程のentryの続きです 参考url [JavaScript] kuromoji.js の辞書に単語を追加する | 「それなら猫の手で」 kuromoji.js + UniDic で形態素解析(辞書のビルド) #JavaScript - Qiita kuromoji.js + SudachiDict で形態素解析(辞書のビルド、IPADic・UniDic…

kuromoji.js - javascript版 形態素解析

sudachipy for python (miniconda for win)による sudachiユーザ辞書作成 - end0tknr's kipple - web写経開発 sudachipy for python による sudachiユーザ辞書の利用 (形態素解析) - end0tknr's kipple - web写経開発 python版の形態素解析は、以前、上記ent…

microsoft listに添付されたexcelファイルをseleniumでダウンロード

Office365 (microsoft365)のmicrosoft listに添付されたexcelのリンクをクリックすると、 ファイルダウンロードにはならず、まずは、excel for webで起動されます。 selenium for pythonで excel for web からexcelファイルのダウンロードを 試みましたが、…

Re:区再編に伴う全国地方公共団体コードの変更について

「区名・区域に変更のない天竜区のコードも変更」のようなケースで 市区町村コードが変わっていて驚きました https://www.city.hamamatsu.shizuoka.jp/ksh/imf/tkdk.html CODE 名称 old 22140-6 静岡県 浜松市天竜区 new 22137-6 〃

bcp import from utf-8 csv to SQL Server 2022 for Linux

install SQL Server to Oracle Linux 8 - end0tknr's kipple - web写経開発 先日の上記entryの続きです。 今回は、SQL Server 2022 for Linux に対し、 utf-8で記載されたcsvファイルをbcpコマンドでインポートします。 目次 utf-8のデータベース作成と、そ…

install php-fpm , apache httpd to oracle linux

参考url https://qiita.com/daichi_pd/items/1d9b4c8bef2579abc670 https://qiita.com/hamburg-love/items/ae819a7abf921af77376 https://itc-engineering-blog.netlify.app/blogs/rhel9-apache-php-postgresql install apache httpd php php-fpm $ sudo yum…

install SQL Server to Oracle Linux 8

RHEL:Linux 上に SQL Server をインストールする - SQL Server | Microsoft Learn に記載の通りで全くOK。 以下は、インストールした sql serverのバージョン 1> SELECT @@VERSION 2> go - Microsoft SQL Server 2022 (RTM-CU12-GDR) (KB5036343) - 16.0.412…

sqlachemy + psycopg2 +fastapi for python で postgres への sql実行

先日のentryの続きとして、更に fastapi を経由し、 postgres への 生sqlを実行します import os import sys sys.path.append( os.path.dirname(__file__)+"/../lib" ) from fastapi.middleware.cors import CORSMiddleware import fastapi import json impo…

sqlachemy + psycopg2 for python で postgres への sql実行

# -*- coding: utf-8 -*- import sqlalchemy db_conf = {"user":"postgres", "passwd":"", "host" :"localhost", "port" :"5432", "db" :"saawo" } def main(): sql = sqlalchemy.text("SELECT * FROM city WHERE code = :code") engine = sqlalchemy.create…

DBeaver Community

これまで、DBへの接続clientは、 http://www.hi-ho.ne.jp/tsumiki/ にある CSE程度しか触ったことがありませんが https://dbeaver.io/ も興味深い

FastAPI for python における CORS設定( Cross-Origin Resource Sharing )

async load_disp_date_range(vue_obj){ let req_url = this.server_api_base() + "DispDateRange"; let res = await fetch(req_url); let disp_dates = await res.json(); vue_obj.disp_date_min = disp_dates[0]; vue_obj.disp_date_max = disp_dates[1]; v…

sklearn.feature_extraction.text.TfidfVectorizer for python によるTF-IDF特徴語算出

更に前回entryの続きとして以下 from sklearn.feature_extraction.text import TfidfVectorizer from sudachipy import dictionary import csv import pandas import re import unicodedata qa_sys_src_csv = "qa_srcs_full.csv" sudachi_conf_json = "c:/Us…

sudachipy for python による sudachiユーザ辞書の利用 (形態素解析)

先程のentryの続きです sudachi.json 元の sudachi.json をコピーし、「"userDict" : [~] 」を追加しています { "systemDict" : null, "characterDefinitionFile" : "char.def", "userDict" : ["c:/Users/end0t/tmp/QA_SGST/sudachi_user_dic/user.dic"], "…

sudachipy for python (miniconda for win)による sudachiユーザ辞書作成

以下の通りです sudachipy.exe コマンドを呼ぶのではなく、 https://github.com/WorksApplications/SudachiPy/blob/develop/sudachipy/dictionarylib/userdictionarybuilder.py にある UserDictionaryBuilder クラスを 内部的に呼びたかったのですが、userdi…

O'Reilly 「入門 自然言語処理」の12章

メモ O'Reilly Japan Blog - 「入門 自然言語処理」の12章を公開しています! Python による日本語自然言語処理 O'Reilly Japan - 入門 自然言語処理

psycopg2.DatabaseError: error with status PGRES_TUPLES_OK and no message from the libpq

pythonの自前コード内で、postgresへの connection poolを行い、更に、 concurrent.futures.ProcessPoolExecutor for python の並列処理による影響でしょうか psycopg2.DatabaseError: error with status PGRES_TUPLES_OK and no message from the libpq の…

TortoiseGitで repository path 'X:/tmp/saawo/' is not owned by current user エラー

wslで起動した oracle linuxをsambaで Xドライブをマウントし、 そこに TortoiseGitで git cloneし、commit等を行ったところ、以下のエラーが発生 --------------------------- TortoiseGit --------------------------- Could not get HEAD hash. libgit2 r…

emacs 27 for windows への jedi(python 自動補完)の install

ポイントは minicondaをinstallし、windowsのPATHを通す pip installで jediに加え、virtualenv もインストール かと思います。 step1 - miniconda (python11)の install 2024/3時点で、minicondaの最新は python12版ですが、 emacsのjediが対応していない為…

requests for python による大容量レスポンスの分割ダウンロード

requests for python で、巨大なfileをhttp getする場合、stream=True で chunk化 - end0tknr's kipple - web写経開発 以前の上記entryの修正版です。 国土交通省で公開している不動産取引価格情報取得API ( https://www.land.mlit.go.jp/webland/api.html )…

Oracle Linux 8.7 への日本語フォント インストール

$ sudo yum install ipa-gothic-fonts ipa-mincho-fonts \ ipa-pgothic-fonts ipa-pmincho-fonts 以前、centosに対しては上記のようにipaのフォントをインストールしていましたが、 redhat?には、このフォントがないみたい。 なので、以下 $ sudo yum search…

install postgres 16.2 from source to Oracle Linux 8.7

install postgres 14.1 from source to cent 7.9 - end0tknr's kipple - web写経開発 上記entryまでは、virtual box上のcentosにinstallしていましたが、 今回は、wsl(Windows Subsystem for Linux)上の Oracle Linuxへ、インストール $ cat /etc/redhat-rel…

csvを含むzipをjszip+papaparse for javascriptで読み sql.js で sql select

sql.js によるブラウザでの sqlite3 操作 - end0tknr's kipple - web写経開発 先日の上記entryでは sql.js で sqlite3のバイナリファイルを扱いましたが、 今回は、csvを含むzipをjszip+papaparse for javascriptで読み、sql.js で sql select <html lang="ja"> <head> <meta charset="UTF-8"> </meta></head></html>

pythonにおける csv ファイルのメール添付送信

code snippet ですが、少々の修正で、動作すると思います #!python # -*- coding: utf-8 -*- from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.application import MIMEApplication import csv import…

sql.js によるブラウザでの sqlite3 操作

web assemblyのおかげでしょうか、 最近は javascriptで sqlite3 のデータベースファイルを そのまま扱えるらしい。 参考url https://sql.js.org https://github.com/sql-js/sql.js install sqlite3 DOS> wsl $ cat /etc/redhat-release Red Hat Enterprise …