a-v-bely commited on
Commit
18fbeb5
·
1 Parent(s): 386f0e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -62,6 +62,8 @@ def annotate_morphemes(word, prefixes=prefixes, suffixes=suffixes):
62
  elif list(annotation[-1].values())[0] == 'interfix':
63
  # print(73, stack[::-1])
64
  annotation.append({stack[::-1]: 'root'})
 
 
65
  else:
66
  # print('1111111111', stack[::-1], annotation[::-1], annotation)
67
  annotation.append({stack[::-1]: 'unk'})
@@ -87,7 +89,7 @@ def annotate_morphemes(word, prefixes=prefixes, suffixes=suffixes):
87
  if len(annotation) >=2 and list(annotation[-2].values())[0] == 'root' and list(annotation[-1].values())[0] == 'prefix':
88
  annotation[-1] = {list(annotation[-1].keys())[0]: 'interfix'}
89
  annotation.append({stack[::-1]: 'root'})
90
- elif list(annotation[-1].values())[0] in ('interfix', 'suffix', 'root'):
91
  annotation.append({stack[::-1]: 'root'})
92
  else:
93
  annotation.append({stack[::-1]: 'unk'})
 
62
  elif list(annotation[-1].values())[0] == 'interfix':
63
  # print(73, stack[::-1])
64
  annotation.append({stack[::-1]: 'root'})
65
+ elif list(annotation[-1].values())[0] == 'postfix':
66
+ annotation.append({stack[::-1]: 'root'})
67
  else:
68
  # print('1111111111', stack[::-1], annotation[::-1], annotation)
69
  annotation.append({stack[::-1]: 'unk'})
 
89
  if len(annotation) >=2 and list(annotation[-2].values())[0] == 'root' and list(annotation[-1].values())[0] == 'prefix':
90
  annotation[-1] = {list(annotation[-1].keys())[0]: 'interfix'}
91
  annotation.append({stack[::-1]: 'root'})
92
+ elif list(annotation[-1].values())[0] in ('ending', 'suffix', 'interfix', 'root'):
93
  annotation.append({stack[::-1]: 'root'})
94
  else:
95
  annotation.append({stack[::-1]: 'unk'})