Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
os.system('git clone --depth 1 https://github.com/neologd/mecab-ipadic-neologd.git && cd mecab-ipadic-neologd && ./bin/install-mecab-ipadic-neologd -n -y -u -p $PWD')
|
|
|
|
| 4 |
|
| 5 |
import streamlit as st
|
| 6 |
|
| 7 |
import MeCab
|
| 8 |
|
| 9 |
-
tagger = MeCab.Tagger('-r /etc/mecabrc -Ochasen -d /home/user/app/mecab-ipadic-neologd')
|
| 10 |
st.set_page_config(page_title="NEologd demo")
|
| 11 |
st.title('NEologd demo')
|
| 12 |
|
|
@@ -29,6 +29,41 @@ def make_row(word):
|
|
| 29 |
|
| 30 |
data = []
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
node = tagger.parseToNode(text)
|
| 33 |
while node:
|
| 34 |
if node.feature.startswith('BOS/EOS'):
|
|
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
os.system('git clone --depth 1 https://github.com/neologd/mecab-ipadic-neologd.git && cd mecab-ipadic-neologd && ./bin/install-mecab-ipadic-neologd -n -y -u -p $PWD')
|
| 4 |
+
os.system('git clone --depth 1 https://github.com/neologd/mecab-unidic-neologd.git && cd mecab-unidic-neologd && ./bin/install-mecab-unidic-neologd -n -y -u -p $PWD')
|
| 5 |
|
| 6 |
import streamlit as st
|
| 7 |
|
| 8 |
import MeCab
|
| 9 |
|
|
|
|
| 10 |
st.set_page_config(page_title="NEologd demo")
|
| 11 |
st.title('NEologd demo')
|
| 12 |
|
|
|
|
| 29 |
|
| 30 |
data = []
|
| 31 |
|
| 32 |
+
tagger = MeCab.Tagger('-r /etc/mecabrc -Ochasen -d /home/user/app/mecab-ipadic-neologd')
|
| 33 |
+
node = tagger.parseToNode(text)
|
| 34 |
+
while node:
|
| 35 |
+
if node.feature.startswith('BOS/EOS'):
|
| 36 |
+
pass
|
| 37 |
+
else:
|
| 38 |
+
data.append(make_row(node))
|
| 39 |
+
node = node.next
|
| 40 |
+
|
| 41 |
+
st.table(data)
|
| 42 |
+
|
| 43 |
+
"""
|
| 44 |
+
### [mecab-unidic-NEologd : Neologism dictionary for unidic-mecab](https://github.com/neologd/mecab-unidic-neologd)
|
| 45 |
+
"""
|
| 46 |
+
|
| 47 |
+
data = []
|
| 48 |
+
|
| 49 |
+
tagger = MeCab.Tagger('-r /etc/mecabrc -Ochasen -d /home/user/app/mecab-unidic-neologd')
|
| 50 |
+
node = tagger.parseToNode(text)
|
| 51 |
+
while node:
|
| 52 |
+
if node.feature.startswith('BOS/EOS'):
|
| 53 |
+
pass
|
| 54 |
+
else:
|
| 55 |
+
data.append(make_row(node))
|
| 56 |
+
node = node.next
|
| 57 |
+
|
| 58 |
+
st.table(data)
|
| 59 |
+
|
| 60 |
+
"""
|
| 61 |
+
### [MeCab](https://taku910.github.io/mecab/)
|
| 62 |
+
"""
|
| 63 |
+
|
| 64 |
+
data = []
|
| 65 |
+
|
| 66 |
+
tagger = MeCab.Tagger('-r /etc/mecabrc -Ochasen')
|
| 67 |
node = tagger.parseToNode(text)
|
| 68 |
while node:
|
| 69 |
if node.feature.startswith('BOS/EOS'):
|