Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkayDevran committed Mar 29, 2019
2 parents 427a29f + 0fdbc68 commit 8a1423f
Showing 1 changed file with 29 additions and 36 deletions.
65 changes: 29 additions & 36 deletions Kuytu/Zemberek_Runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,54 +23,47 @@ def fixZemberekOutput(zemberek_output_path):
fs.append('None')
ss.append('None')
continue

line_parts = line.strip().split('#')

line_parts = line.strip().split('#')
first_sentence = line_parts[0]
second_sentence = 'None'
sentences = {}
d_flag = False
o_flag = False
lngth = len(line_parts)
try:
for j, part in enumerate(line_parts):

try:
if part.endswith('o.') and o_flag == False:
first_sentence += line_parts[j+1]
o_flag = True

if d_flag == True:
if o_flag == True:
try:
second_sentence = line_parts[3]
except:
second_sentence = 'None'
else:
try:
second_sentence = line_parts[2]
except:
second_sentence = 'None'

if part.endswith('(d.') and d_flag == False:
first_sentence = line_parts[j] + " " + line_parts[j+1]
d_flag = True
except Exception as e:
if '(d.' not in part:
first_sentence = line_parts[1]
for j, part in enumerate(line_parts):
try:
if (part.endswith('o.') or part.endswith('ö.')) and o_flag == False:
first_sentence += line_parts[j+1]
o_flag = True

if d_flag == True:
if o_flag == True:
try:
second_sentence = line_parts[3]
except:
second_sentence = 'None'
else:
first_sentence = 'None-Faulty'
except Exception as e:
fs.append('None')
ss.append('None')
continue
try:
second_sentence = line_parts[2]
except:
second_sentence = 'None'

if (part.endswith('(d.') or part.endswith('(d.?') or part.endswith('(d. ?')) and d_flag == False:
first_sentence = line_parts[j] + " " + line_parts[j+1]
d_flag = True
except:
pass

if d_flag == False and o_flag == False and (len(line_parts)>1):
second_sentence = line_parts[1]

fs.append(first_sentence)
ss.append(second_sentence)
#print '\n1. ', first_sentence, '\n2. ',second_sentence, '\n'
#print '\n1. ', first_sentence, '\n2. ',second_sentence, '\n'

f.close()
return fs,ss



# Start
set_environment()
Expand Down

0 comments on commit 8a1423f

Please sign in to comment.