Spaces:
Build error
Build error
Commit
·
9f2215d
1
Parent(s):
ce38e40
add corpus, dict and mdel
Browse files- app.py +28 -0
- corpus.mm +3 -0
- corpus.mm.index +3 -0
- lda_demo.model +3 -0
- lda_demo.model.expElogbeta.npy +3 -0
- lda_demo.model.id2word +3 -0
- lda_demo.model.state +3 -0
- livedoor_demo.dict +3 -0
- raw_corpus.csv +3 -0
- requirements.txt +69 -0
- word2vec.gensim.model +3 -0
- word2vec.gensim.model.syn1neg.npy +3 -0
- word2vec.gensim.model.wv.syn0.npy +3 -0
- word2vec.model +3 -0
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import pandas as pd
|
3 |
+
from gensim.corpora import Dictionary, MmCorpus
|
4 |
+
from gensim.models import LdaModel, Word2Vec
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
import streamlit as st
|
7 |
+
from pyLDAvis import prepared_data_to_html
|
8 |
+
import pyLDAvis.gensim_models as gensimvis
|
9 |
+
|
10 |
+
# 生データ・コーパス・辞書・モデルのロード
|
11 |
+
df = pd.read_csv("./raw_corpus.csv")
|
12 |
+
corpus = MmCorpus('./corpus.mm')
|
13 |
+
dict = Dictionary.load(f'./livedoor_demo.dict')
|
14 |
+
lda = LdaModel.load('./lda_demo.model')
|
15 |
+
|
16 |
+
st.caption("生データ一覧")
|
17 |
+
st.dataframe(df.iloc[:100])
|
18 |
+
|
19 |
+
st.caption("記事のカテゴリ")
|
20 |
+
fig, ax = plt.subplots()
|
21 |
+
count = df[["CATEGORY", "DOCUMENT"]].groupby("CATEGORY").count()
|
22 |
+
count.plot.pie(y="DOCUMENT", ax=ax, ylabel="", legend=False)
|
23 |
+
st.pyplot(fig)
|
24 |
+
|
25 |
+
# pyLDAvisによるトピックの可視化
|
26 |
+
vis = gensimvis.prepare(lda, corpus, dict)
|
27 |
+
html_string = prepared_data_to_html(vis)
|
28 |
+
st.components.v1.html(html_string, width=1300, height=800)
|
corpus.mm
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:38635f82ae9f3c4dda7102fc9490bdedc7252db2ce112567fa770ca12026e073
|
3 |
+
size 11175678
|
corpus.mm.index
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:72767db46c1cd1d6fa978d07d3292ab8f05f568ea07b2fb6e2bf5360a68a2f1c
|
3 |
+
size 36780
|
lda_demo.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:343b994ba88549e98bf9005b12aaa905a7fbd8799da33c56eaf239bbef306767
|
3 |
+
size 161307
|
lda_demo.model.expElogbeta.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:67b82332c681036407bff78f2e60e8317ea114c96037edd52e2296222e2e650a
|
3 |
+
size 1416296
|
lda_demo.model.id2word
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e2e99dcee6c62d468b5d64053a2654a3559ea6cad38c5ca934ee4db5e91d14f6
|
3 |
+
size 1283235
|
lda_demo.model.state
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d4d1a044ffad64e9769daf521cf6195c74a6f221332f3c1435ac0aca167f136d
|
3 |
+
size 1574192
|
livedoor_demo.dict
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2d7019ad7b4fd3f486a1ea96f65ce5a2c2c0fd8e0d56cb38a4f9beac1850fb14
|
3 |
+
size 1283368
|
raw_corpus.csv
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:746107980f471c893fa8fb1fb40e65f50bbf9b97fe5f7ad485e8d6997b9baf7f
|
3 |
+
size 26062717
|
requirements.txt
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
altair==4.2.2
|
2 |
+
attrs==22.2.0
|
3 |
+
blinker==1.5
|
4 |
+
cachetools==5.3.0
|
5 |
+
certifi==2022.12.7
|
6 |
+
charset-normalizer==3.0.1
|
7 |
+
click==8.1.3
|
8 |
+
contourpy==1.0.7
|
9 |
+
cycler==0.11.0
|
10 |
+
decorator==5.1.1
|
11 |
+
entrypoints==0.4
|
12 |
+
fonttools==4.38.0
|
13 |
+
fst-pso==1.8.1
|
14 |
+
funcy==1.18
|
15 |
+
future==0.18.3
|
16 |
+
FuzzyTM==2.0.5
|
17 |
+
gensim==4.3.0
|
18 |
+
gitdb==4.0.10
|
19 |
+
GitPython==3.1.31
|
20 |
+
idna==3.4
|
21 |
+
importlib-metadata==6.0.0
|
22 |
+
importlib-resources==5.12.0
|
23 |
+
Jinja2==3.1.2
|
24 |
+
joblib==1.2.0
|
25 |
+
jsonschema==4.17.3
|
26 |
+
kiwisolver==1.4.4
|
27 |
+
markdown-it-py==2.2.0
|
28 |
+
MarkupSafe==2.1.2
|
29 |
+
matplotlib==3.7.0
|
30 |
+
mdurl==0.1.2
|
31 |
+
miniful==0.0.6
|
32 |
+
numexpr==2.8.4
|
33 |
+
numpy==1.24.2
|
34 |
+
packaging==23.0
|
35 |
+
pandas==1.5.3
|
36 |
+
Pillow==9.4.0
|
37 |
+
protobuf==3.20.3
|
38 |
+
pyarrow==11.0.0
|
39 |
+
pydeck==0.8.0
|
40 |
+
pyFUME==0.2.25
|
41 |
+
Pygments==2.14.0
|
42 |
+
pyLDAvis==3.3.1
|
43 |
+
Pympler==1.0.1
|
44 |
+
pyparsing==3.0.9
|
45 |
+
pyrsistent==0.19.3
|
46 |
+
python-dateutil==2.8.2
|
47 |
+
pytz==2022.7.1
|
48 |
+
pytz-deprecation-shim==0.1.0.post0
|
49 |
+
requests==2.28.2
|
50 |
+
rich==13.3.1
|
51 |
+
scikit-learn==1.2.1
|
52 |
+
scipy==1.10.0
|
53 |
+
semver==2.13.0
|
54 |
+
simpful==2.9.0
|
55 |
+
six==1.16.0
|
56 |
+
sklearn==0.0.post1
|
57 |
+
smart-open==6.3.0
|
58 |
+
smmap==5.0.0
|
59 |
+
streamlit==1.19.0
|
60 |
+
threadpoolctl==3.1.0
|
61 |
+
toml==0.10.2
|
62 |
+
toolz==0.12.0
|
63 |
+
tornado==6.2
|
64 |
+
typing_extensions==4.5.0
|
65 |
+
tzdata==2022.7
|
66 |
+
tzlocal==4.2
|
67 |
+
urllib3==1.26.14
|
68 |
+
validators==0.20.0
|
69 |
+
zipp==3.14.0
|
word2vec.gensim.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9125139e4c1394e42e1c792f2ff5703a6180e9ac38b6c0122cc9397115eccd48
|
3 |
+
size 23527420
|
word2vec.gensim.model.syn1neg.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:164b5cd74b4abc03e7090eae31ceae68e8758aea374b07af7415bc789dcaf4be
|
3 |
+
size 67095280
|
word2vec.gensim.model.wv.syn0.npy
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3cca0fc3f50b79eb3518ce84ae54019767e41815d8d31748a00f77be650edbb1
|
3 |
+
size 67095280
|
word2vec.model
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5fa90bdfdcca128e8d6689ff883ab8d3e587ab6b348f7bed7f1ad13a50782b12
|
3 |
+
size 21550345
|