joshdavham commited on
Commit
b0922d9
·
1 Parent(s): 7ce5cb1

add tables for pos and goshu

Browse files
Files changed (1) hide show
  1. app.py +48 -1
app.py CHANGED
@@ -588,4 +588,51 @@ else:
588
 
589
  word_coverage_chart = get_word_coverage_chart()
590
 
591
- st.altair_chart(word_coverage_chart, use_container_width=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
588
 
589
  word_coverage_chart = get_word_coverage_chart()
590
 
591
+ st.altair_chart(word_coverage_chart, use_container_width=True)
592
+ # grammar table
593
+
594
+ data = {
595
+ 'Complete Beginner': [0.02638719922016275 ,0.0192492959834, 0.00476028625918155, 0.2503071253071253],
596
+ 'Beginner': [0.0473047304730473, 0.0266429840142095, 0.005813953488372, 0.2454068241469816],
597
+ 'Intermediate': [0.06625719079578135, 0.03514773095199635, 0.0087719298245614, 0.23239271705403663],
598
+ 'Advanced': [0.0766787658802177, 0.0373056994818652, 0.0108588351431391, 0.2237101220953131]
599
+ }
600
+ df = pd.DataFrame(data)
601
+
602
+ row_labels = ['Median Perc. Subordinating Conjunctions', 'Median Perc. Adverbs', 'Median Perc. Determiners', 'Median Perc. Nouns']
603
+ df.index = row_labels
604
+
605
+ # Apply header-specific styling using set_table_styles
606
+ styled_df = df.style.set_table_styles({
607
+ 'Complete Beginner': [{'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(165, 190, 228, 0.45)')]}],
608
+ 'Beginner': [{'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(154, 214, 216, 0.45)')]}],
609
+ 'Intermediate': [{'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(199, 174, 205, 0.45)')]}],
610
+ 'Advanced': [{'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(221, 158, 158, 0.45)')]}],
611
+ }).format("{:.2%}")
612
+
613
+ # Display the styled DataFrame
614
+ st.markdown(styled_df.to_html(), unsafe_allow_html=True)
615
+
616
+ # word origin table
617
+
618
+ data = {
619
+ 'Complete Beginner': [0.06999874574159035, 0.8578043261266064, 0.03301790801790795],
620
+ 'Beginner': [0.0955284552845528, 0.8399311531841652, 0.0279441117764471],
621
+ 'Intermediate': [0.1165702954621605, 0.8259877335615461, 0.0241447813837379],
622
+ 'Advanced': [0.1303328645100797, 0.8225274725274725, 0.0157535445475231],
623
+ }
624
+ df = pd.DataFrame(data)
625
+
626
+ row_labels = ['Median Perc. Kango (漢語)', 'Median Perc. Wago (和語)', 'Median Perc. Garaigo (外来語)']
627
+ df.index = row_labels
628
+
629
+ # Apply header-specific styling using set_table_styles
630
+ styled_df = df.style.set_table_styles({
631
+ 'Complete Beginner': [{'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(165, 190, 228, 0.45)')]}],
632
+ 'Beginner': [{'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(154, 214, 216, 0.45)')]}],
633
+ 'Intermediate': [{'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(199, 174, 205, 0.45)')]}],
634
+ 'Advanced': [{'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(221, 158, 158, 0.45)')]}],
635
+ }).format("{:.2%}")
636
+
637
+ # Display the styled DataFrame
638
+ st.markdown(styled_df.to_html(), unsafe_allow_html=True)