Sam Passaglia commited on
Commit
ba074a5
1 Parent(s): e640827
Files changed (1) hide show
  1. app.py +26 -26
app.py CHANGED
@@ -148,32 +148,32 @@ if len(spacy_dict["ents"]) > 0:
148
  else:
149
  st.markdown("**Yomikata** found no heteronyms in the input text.")
150
 
151
- # # Dictionary + Yomikata prediction
152
- # st.markdown("**Yomikata** can be coupled with a dictionary to get full furigana:")
153
- # dictionary = st.radio(
154
- # "It can be coupled with a dictionary",
155
- # ("sudachi", "unidic", "ipadic", "juman"),
156
- # horizontal=True,
157
- # label_visibility="collapsed",
158
- # )
159
-
160
- # dictreader = Dictionary(dictionary)
161
- # dictionary_prediction = dictreader.furigana(dbert_prediction)
162
- # html = parse_furigana(dictionary_prediction).to_html()
163
- # st.write(
164
- # f"{add_border(html)}",
165
- # unsafe_allow_html=True,
166
- # )
167
-
168
- # # Dictionary alone prediction
169
- # if len(spacy_dict["ents"]) > 0:
170
- # dictionary_prediction = dictreader.furigana(utils.remove_furigana(input_text))
171
- # html = parse_furigana(dictionary_prediction).to_html()
172
- # st.markdown("Without **Yomikata** disambiguation, the dictionary would yield:")
173
- # st.write(
174
- # f"{add_border(html)}",
175
- # unsafe_allow_html=True,
176
- # )
177
 
178
  # Randomize button
179
  if st.button("🎲 Randomize the input sentence"):
 
148
  else:
149
  st.markdown("**Yomikata** found no heteronyms in the input text.")
150
 
151
+ # Dictionary + Yomikata prediction
152
+ st.markdown("**Yomikata** can be coupled with a dictionary to get full furigana:")
153
+ dictionary = st.radio(
154
+ "It can be coupled with a dictionary",
155
+ ("sudachi", "unidic", "ipadic", "juman"),
156
+ horizontal=True,
157
+ label_visibility="collapsed",
158
+ )
159
+
160
+ dictreader = Dictionary(dictionary)
161
+ dictionary_prediction = dictreader.furigana(dbert_prediction)
162
+ html = parse_furigana(dictionary_prediction).to_html()
163
+ st.write(
164
+ f"{add_border(html)}",
165
+ unsafe_allow_html=True,
166
+ )
167
+
168
+ # Dictionary alone prediction
169
+ if len(spacy_dict["ents"]) > 0:
170
+ dictionary_prediction = dictreader.furigana(utils.remove_furigana(input_text))
171
+ html = parse_furigana(dictionary_prediction).to_html()
172
+ st.markdown("Without **Yomikata** disambiguation, the dictionary would yield:")
173
+ st.write(
174
+ f"{add_border(html)}",
175
+ unsafe_allow_html=True,
176
+ )
177
 
178
  # Randomize button
179
  if st.button("🎲 Randomize the input sentence"):