This file contains 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
const express = require('express') | |
const app = express(); | |
const esclient = require('@elastic/elasticsearch'); | |
const axios = require('axios'); | |
const fetch = require('node-fetch'); | |
const http = require('http'); | |
const { execSync } = require('child_process'); | |
const port = 3000 | |
const dstport = 9200; |
This file contains 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
import numpy as np | |
import random | |
import pandas as pd | |
import numpy as np | |
import sys | |
import inspect | |
""" | |
Pandasでapply、特にaxis=1で処理したくなるような要件の可読性と速度の雑な確認 | |
(IPythonのREPLに貼り付けしてためした) |
This file contains 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
import sys | |
import spacy | |
from spacy.matcher import Matcher | |
import re | |
nlp = spacy.load('ja_core_news_md') | |
_text = """ | |
関西国際空港側の居酒屋で、酒を飲みすぎたため、電車で眠りこけてしまったため、寝過ごしてしまった。終点の駅で目が醒めたのだが、周りに何もなくてとても淋しい気持ちになった。ふと夜空を見上げると、八分咲きの美しい桜の花が慰めてくれるようだった。 |
This file contains 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
import json | |
import spacy | |
import re | |
import sys | |
import itertools | |
nlp = spacy.load('ja_core_news_md') | |
nlp.remove_pipe('ner') # 固有表現は使わないので除外 | |
数詞 = ('名詞-数詞', '名詞-数詞-') |
This file contains 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
import elasticsearch | |
import pandas as pd | |
es = elasticsearch.Elasticsearch("localhost:9200") | |
INDEX = 'ldgourmet' | |
AGGS = "aggregations" | |
BKTS = "buckets" | |
aNames = ['a1','a2'] |
This file contains 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
""" | |
sumyでドキュメント要約を行うサンプルプログラム | |
""" | |
# spaCy | |
import spacy | |
# sumy | |
from sumy.parsers.plaintext import PlaintextParser | |
# 以下、要約アルゴリズム | |
from sumy.summarizers.lex_rank import LexRankSummarizer |
This file contains 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
import pandas as pd | |
from collections import defaultdict | |
from collections import ChainMap | |
from elasticsearch import Elasticsearch | |
from elasticsearch.helpers import bulk | |
""" | |
livedoor グルメのDataSet のCSVをElasticsearchでの全文検索を意識して結合 | |
〜JSONデータ化してバルクロード実行するサンプルスクリプト |
This file contains 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
def set_analyzer(an, tk, fl): | |
# ======================== ここからtokenizerとfilterの定義 =============================== | |
def _set_filter_and_tokenizer(tk, fl): | |
デフォルトとするtoken_chars = [ # N-Gramで分かち書きするフィールドでターゲットとする文字種(最近、symbolは入れる方が良いと思い始めている) | |
"letter", | |
"digit", | |
"symbol" |
This file contains 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
import pandas as pd | |
import glob | |
import sys | |
import itertools | |
import re | |
import json | |
import collections | |
import itertools | |
import io |
This file contains 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
https://itdepends.hateblo.jp/entry/2020/05/04/120500 | |
WebRTCの勉強のためのサンプルプログラムです。 | |
自由に改変してかまいません。 | |
利用は自己責任でお願いします。 |