owned this note
owned this note
Published
Linked with GitHub
# 山元研究相談
## Todo
- 奥原先生のやったとこまでやる
- ok matome.pyをコマンドライン引数で実行できるようにする
- Server.pyを沼田ファイル参考にしてcmd = 'python matome.py ' + key1 + ' ' + key2で実行できるようにする
- それでindex.htmlで受け取った値からグラフ保存できるか確認
## 出力の詳細な文言
「A」と 「B」が含まれるページ内での関連語ランキングTop10
### 例
1. 山
2. 富山
3. お金
5. 革
# 18日までにやること
- 共起ネットのサンプルをできるようにすること(前処理付き)
- 共起ネット内での単語とnodeの強さ辞書を変数に格納できるようにする
## タイトル
Web内容マイニングによる個別知識の共通単語を介した相関ルールからの発想支援
[共起ネットワークの実装用ライブラリ](https://www.sejuku.net/blog/91371#NetworkX)
```
include <stdio.h>
```
```python=
print('hello')
print('hoge')
```
## 10月25日やることリスト
1. 有向グラフだと繋がりが無いパスができて計算ができない?ので無向グラフでもよいか先生にメールで相談
## tex 参考文献の書き方
```latex
¥begin{enumerate}
¥item
Ministry of Public Management, "Boost Open Data Strategy", http://www.soumu.go.jp¥¥/menu¥_seisaku/ictseisaku/ictriyou/opendata/, Accessed: May 5, 2018.
¥item
NTT Communications, "Report of Deploying Information Infrastructure of Hazzard Data", "No. 1.0, 2013.
¥item
Ilya Sutskever Oriol Vinyals Quoc V. Le, "Sequence to Sequence Learning with Neural Networks", {¥it NIPS}, 2014
¥item
斎藤 康毅, "ゼロから作るDeep Learning 2 自然言語処理編", オライリー・ジャパン, 2018.
¥end{enumerate}
```
## javascriptによるネットワーク可視化
https://github.com/vasturiano/3d-force-graph
## 簡易サーバー
```python=
import sys
sys.path.append('../')
from flask import Flask, jsonify, request
import numpy as np
from inference_specify import generate_sentence, add_z
app = Flask(__name__)
LOAD_CHECKPOINT = 'bin/2020-Jan-16-13:16:29/E0.pytorch'
@app.route('/create/<x>/<y>')
def get_invention(x=None, y=None):
if x==None or y==None:
return jsonify({'code':400, 'error-message':'Invalid format: request parameters must include x and y cordinate!'})
input = np.array([x, y], dtype='float')
out_text = generate_sentence(input, load_checkpoint=LOAD_CHECKPOINT)
dic = {
'code':200,
'text':out_text,
'message':'Success your request.'
}
return jsonify(dic)
# This code is for Test run
if __name__ == "__main__":
app.run(debug=True)
```
```javascript=
function appendScript(URL) {
var el = document.createElement('script');
el.src = URL;
document.body.appendChild(el);
};
```
```javascript=
function loadJS(src){
var script = document.createElement('script');
script.src = src;
document.body.appendChild(script);
}
loadJS('sample_mapping.js');
```
```javascript=
async function createInvention(x, y) {
reqURL = API + x + '/' + y
try {
const response = await axios.get(reqURL);
return response.data.text;
} catch (error) {
console.error(error);
}
}
```
```javascript=
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
createInvention(newData.x, newData.y).then(result => {
document.getElementById( "output" ).textContent = result
});