a-v-bely commited on
Commit
abaf342
·
1 Parent(s): 70678c7

Update app

Browse files
Files changed (2) hide show
  1. .streamlit/config.toml +2 -0
  2. app.py +9 -7
.streamlit/config.toml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [theme]
2
+ base="light"
app.py CHANGED
@@ -70,7 +70,7 @@ def annotate_morphemes(word, prefixes=prefixes, suffixes=suffixes):
70
  annotation.append({stack[::-1]: 'root'})
71
  else:
72
  # print('1111111111', stack[::-1], annotation)
73
- annotation.append({stack[::-1]: 'unk'})
74
  else:
75
  if stack[::-1] in suffixes:
76
  # print(8, stack[::-1])
@@ -93,16 +93,18 @@ def annotate_morphemes(word, prefixes=prefixes, suffixes=suffixes):
93
  if len(annotation) >=2 and list(annotation[-2].values())[0] == 'root' and list(annotation[-1].values())[0] == 'prefix':
94
  annotation[-1] = {list(annotation[-1].keys())[0]: 'interfix'}
95
  annotation.append({stack[::-1]: 'root'})
96
- elif list(annotation[-1].values())[0] in ('ending', 'suffix', 'interfix', 'root'):
97
  annotation.append({stack[::-1]: 'root'})
98
  else:
99
- annotation.append({stack[::-1]: 'unk'})
100
  return [list(x.items())[0] for x in annotation[::-1]]
101
 
102
- st.header('Аннотирование морфемого разбора')
103
- st.write('Введите морфемный разбор слова или слов (разделитель - пробел) в формате словаря.')
104
- st.write('Например: пере=двиг=а-ть=ся быстр=о .')
105
- inpt = st.text_input(label='Разметить морфемы в слове(-ах): ')
 
 
106
  if inpt == '':
107
  pass
108
  elif ' ' in inpt:
 
70
  annotation.append({stack[::-1]: 'root'})
71
  else:
72
  # print('1111111111', stack[::-1], annotation)
73
+ annotation.append({stack[::-1]: 'unknown'})
74
  else:
75
  if stack[::-1] in suffixes:
76
  # print(8, stack[::-1])
 
93
  if len(annotation) >=2 and list(annotation[-2].values())[0] == 'root' and list(annotation[-1].values())[0] == 'prefix':
94
  annotation[-1] = {list(annotation[-1].keys())[0]: 'interfix'}
95
  annotation.append({stack[::-1]: 'root'})
96
+ elif annotation and list(annotation[-1].values())[0] in ('ending', 'suffix', 'interfix', 'root'):
97
  annotation.append({stack[::-1]: 'root'})
98
  else:
99
+ annotation.append({stack[::-1]: 'unknown'})
100
  return [list(x.items())[0] for x in annotation[::-1]]
101
 
102
+ st.set_page_config(layout='wide')
103
+ st.header('Аннотирование морфемого состава слова')
104
+ st.markdown('Введите разобранное по составу слово или слова (разделитель — пробел) в следующем формате.'
105
+ '\n\nОкончание отделяется от предыдущей морфемы символом "-", остальные морфемы разделяются символом "=".'
106
+ '\n\nНапример: "у=потребл=ениj-е", "пере=двиг=а-ть=ся быстр=о" .')
107
+ inpt = st.text_input(label='Аннотировать морфемы в слове(-ах): ')
108
  if inpt == '':
109
  pass
110
  elif ' ' in inpt: