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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -45,8 +45,12 @@ def annotate_morphemes(word, prefixes=prefixes, suffixes=suffixes):
45
  annotation.append({stack[::-1]: 'root'})
46
  elif len(annotation) >=2 and list(annotation[-2].values())[0] == 'root' and list(annotation[-1].values())[0] in ('prefix', 'interfix'):
47
  if stack[::-1] in interfixes and list(annotation[-1].keys())[0] in interfixes:
48
- # print('68', stack[::-1], annotation)
49
  annotation.append({stack[::-1]: 'interfix'})
 
 
 
 
50
  elif list(annotation[-1].keys())[0] in interfixes:
51
  # print('69', stack[::-1], annotation)
52
  annotation[-1] = {list(annotation[-1].keys())[0]: 'interfix'}
@@ -65,7 +69,7 @@ def annotate_morphemes(word, prefixes=prefixes, suffixes=suffixes):
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'})
70
  else:
71
  if stack[::-1] in suffixes:
 
45
  annotation.append({stack[::-1]: 'root'})
46
  elif len(annotation) >=2 and list(annotation[-2].values())[0] == 'root' and list(annotation[-1].values())[0] in ('prefix', 'interfix'):
47
  if stack[::-1] in interfixes and list(annotation[-1].keys())[0] in interfixes:
48
+ # print('67', stack[::-1], annotation)
49
  annotation.append({stack[::-1]: 'interfix'})
50
+ elif stack[::-1] in suffixes and list(annotation[-1].keys())[0] in interfixes:
51
+ # print('68', stack[::-1], annotation)
52
+ annotation[-1] = {list(annotation[-1].keys())[0]: 'interfix'}
53
+ annotation.append({stack[::-1]: 'suffix'})
54
  elif list(annotation[-1].keys())[0] in interfixes:
55
  # print('69', stack[::-1], annotation)
56
  annotation[-1] = {list(annotation[-1].keys())[0]: 'interfix'}
 
69
  elif list(annotation[-1].values())[0] == 'postfix':
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: